Skip to content

Commit 8029f06

Browse files
committed
Filter Setup flags: filter working dir on < 3.13
The --working-dir flag is only available for Cabal >= 3.13. This commit fixes an incorrect conditional: we only filtered out this flag for Cabal < 3.11, instead of < 3.13. Test: PackageTests/WorkingDir Fixes #9940
1 parent d428c5f commit 8029f06

File tree

9 files changed

+73
-6
lines changed

9 files changed

+73
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,22 +635,22 @@ filterCommonFlags :: CommonSetupFlags -> Version -> CommonSetupFlags
635635
filterCommonFlags flags cabalLibVersion
636636
-- NB: we expect the latest version to be the most common case,
637637
-- so test it first.
638-
| cabalLibVersion >= mkVersion [3, 11, 0] = flags_latest
638+
| cabalLibVersion >= mkVersion [3, 13, 0] = flags_latest
639639
| cabalLibVersion < mkVersion [1, 2, 5] = flags_1_2_5
640640
| cabalLibVersion < mkVersion [2, 1, 0] = flags_2_1_0
641-
| cabalLibVersion < mkVersion [3, 11, 0] = flags_3_11_0
641+
| cabalLibVersion < mkVersion [3, 13, 0] = flags_3_13_0
642642
| otherwise = error "the impossible just happened" -- see first guard
643643
where
644644
flags_latest = flags
645-
flags_3_11_0 =
645+
flags_3_13_0 =
646646
flags_latest
647647
{ setupWorkingDir = NoFlag
648648
}
649-
-- Cabal < 3.11 does not support the --working-dir flag.
649+
-- Cabal < 3.13 does not support the --working-dir flag.
650650
flags_2_1_0 =
651-
flags_3_11_0
651+
flags_3_13_0
652652
{ -- Cabal < 2.1 doesn't know about -v +timestamp modifier
653-
setupVerbosity = fmap verboseNoTimestamp (setupVerbosity flags_3_11_0)
653+
setupVerbosity = fmap verboseNoTimestamp (setupVerbosity flags_3_13_0)
654654
}
655655
flags_1_2_5 =
656656
flags_2_1_0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Main where
2+
3+
import Dep(foo)
4+
5+
main :: IO ()
6+
main = print foo
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Main where
2+
3+
import Distribution.Simple ( defaultMain )
4+
5+
main :: IO ()
6+
main = defaultMain
7+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
packages: ., dep
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module Dep where
2+
3+
foo :: Int
4+
foo = 17
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Main where
2+
3+
import Distribution.Simple ( defaultMain )
4+
5+
main :: IO ()
6+
main = defaultMain
7+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cabal-version: 2.4
2+
name: dep
3+
version: 0.1.0.0
4+
synopsis: Test that we don't pass --working-dir when unsupported
5+
license: BSD-3-Clause
6+
author: NA
7+
maintainer: NA
8+
category: Testing
9+
build-type: Custom
10+
11+
custom-setup
12+
setup-depends: base, Cabal >= 2.4 && < 3.13
13+
14+
library
15+
build-depends: base
16+
default-language: Haskell2010
17+
hs-source-dirs: .
18+
exposed-modules: Dep
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Test.Cabal.Prelude
2+
3+
main = cabalTest $ recordMode DoNotRecord $ do
4+
skipUnlessAnyCabalVersion "< 3.13"
5+
cabalWithStdin "v2-build" [] ""
6+
return ()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cabal-version: 2.4
2+
name: working-dir-test
3+
version: 0.1.0.0
4+
synopsis: Test that we don't pass --working-dir when unsupported
5+
license: BSD-3-Clause
6+
author: NA
7+
maintainer: NA
8+
category: Testing
9+
build-type: Custom
10+
11+
custom-setup
12+
setup-depends: base, Cabal >= 2.4 && < 3.13
13+
14+
executable Exe
15+
default-language: Haskell2010
16+
build-depends: base, dep
17+
hs-source-dirs: .
18+
main-is: Main.hs

0 commit comments

Comments
 (0)