Skip to content

Commit 74c46ae

Browse files
committed
Warn if builddir is going to be ignored.
builddir can only be specified from the command line. Closes: #7941
1 parent f19ce68 commit 74c46ae

File tree

7 files changed

+30
-2
lines changed

7 files changed

+30
-2
lines changed

cabal-install/src/Distribution/Client/ProjectConfig.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ import Distribution.Simple.Compiler
111111
import Distribution.Simple.Program
112112
( ConfiguredProgram(..) )
113113
import Distribution.Simple.Setup
114-
( Flag(Flag), toFlag, flagToMaybe, flagToList
114+
( Flag(..), toFlag, flagToMaybe, flagToList
115115
, fromFlag, fromFlagOrDefault )
116116
import Distribution.Client.Setup
117117
( defaultSolver, defaultMaxBackjumps )

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ rebuildProjectConfig verbosity
353353
pure (os, arch, compilerInfo compiler)
354354

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# cabal v2-build
2+
Warning: The builddir option is not supported in project and config files. It will be ignored.
3+
Resolving dependencies...
4+
Build profile: -w ghc-<GHCVER> -O1
5+
In order, the following would be built:
6+
- main-0.1 (lib) (first run)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
packages: .
2+
builddir: something
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import Test.Cabal.Prelude
2+
3+
main = cabalTest $ do
4+
cabal "v2-build" ["--dry-run", "all"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cabal-version: 3.0
2+
3+
name: main
4+
version: 0.1
5+
build-type: Simple
6+
category: Test
7+
maintainer: Joe
8+
synopsis: Test input
9+
description: Test input
10+
license: BSD-3-Clause
11+
12+
library
13+
build-depends: base
14+
default-language: Haskell2010

doc/cabal-project.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ package, and thus apply globally:
288288
to the root of the project (i.e., where the ``cabal.project``
289289
file lives.)
290290

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

293293
.. _cmdoption-project-dir:
294294
.. option:: --project-dir=DIR

0 commit comments

Comments
 (0)