Skip to content

Commit

Permalink
Warn if builddir is going to be ignored.
Browse files Browse the repository at this point in the history
builddir can only be specified from the command line.

Closes: #7941
  • Loading branch information
andreabedini committed May 29, 2023
1 parent 5c74602 commit eeb90a1
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ rebuildProjectConfig
pure (os, arch, compilerInfo compiler)

projectConfig <- instantiateProjectConfigSkeletonFetchingCompiler fetchCompiler mempty projectConfigSkeleton
when (projectConfigDistDir (projectConfigShared $ projectConfig) /= NoFlag) $
liftIO $
warn verbosity "The builddir option is not supported in project and config files. It will be ignored."
localPackages <- phaseReadLocalPackages (projectConfig <> cliConfig)
return (projectConfig, localPackages)

Expand Down
6 changes: 6 additions & 0 deletions cabal-testsuite/PackageTests/Project/WarnBuilddir/cabal.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# cabal v2-build
Warning: The builddir option is not supported in project and config files. It will be ignored.
Resolving dependencies...
Build profile: -w ghc-<GHCVER> -O1
In order, the following would be built:
- main-0.1 (lib) (first run)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages: .
builddir: something
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Test.Cabal.Prelude

main = cabalTest $ do
cabal "v2-build" ["--dry-run", "all"]
14 changes: 14 additions & 0 deletions cabal-testsuite/PackageTests/Project/WarnBuilddir/main.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: 3.0

name: main
version: 0.1
build-type: Simple
category: Test
maintainer: Joe
synopsis: Test input
description: Test input
license: BSD-3-Clause

library
build-depends: base
default-language: Haskell2010
2 changes: 1 addition & 1 deletion doc/cabal-project.rst
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ package, and thus apply globally:
to the root of the project (i.e., where the ``cabal.project``
file lives.)

This option cannot be specified via a ``cabal.project`` file.
This option can only be specified from the command line.

.. _cmdoption-project-dir:
.. option:: --project-dir=DIR
Expand Down

0 comments on commit eeb90a1

Please sign in to comment.