diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index c89f2a3524a..ae21e7f3799 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -635,22 +635,22 @@ filterCommonFlags :: CommonSetupFlags -> Version -> CommonSetupFlags filterCommonFlags flags cabalLibVersion -- NB: we expect the latest version to be the most common case, -- so test it first. - | cabalLibVersion >= mkVersion [3, 11, 0] = flags_latest + | cabalLibVersion >= mkVersion [3, 13, 0] = flags_latest | cabalLibVersion < mkVersion [1, 2, 5] = flags_1_2_5 | cabalLibVersion < mkVersion [2, 1, 0] = flags_2_1_0 - | cabalLibVersion < mkVersion [3, 11, 0] = flags_3_11_0 + | cabalLibVersion < mkVersion [3, 13, 0] = flags_3_13_0 | otherwise = error "the impossible just happened" -- see first guard where flags_latest = flags - flags_3_11_0 = + flags_3_13_0 = flags_latest { setupWorkingDir = NoFlag } - -- Cabal < 3.11 does not support the --working-dir flag. + -- Cabal < 3.13 does not support the --working-dir flag. flags_2_1_0 = - flags_3_11_0 + flags_3_13_0 { -- Cabal < 2.1 doesn't know about -v +timestamp modifier - setupVerbosity = fmap verboseNoTimestamp (setupVerbosity flags_3_11_0) + setupVerbosity = fmap verboseNoTimestamp (setupVerbosity flags_3_13_0) } flags_1_2_5 = flags_2_1_0 diff --git a/cabal-testsuite/PackageTests/WorkingDir/Main.hs b/cabal-testsuite/PackageTests/WorkingDir/Main.hs new file mode 100644 index 00000000000..2c123dd8d35 --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/Main.hs @@ -0,0 +1,6 @@ +module Main where + +import Dep(foo) + +main :: IO () +main = print foo diff --git a/cabal-testsuite/PackageTests/WorkingDir/Setup.hs b/cabal-testsuite/PackageTests/WorkingDir/Setup.hs new file mode 100644 index 00000000000..e336d1360dc --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/Setup.hs @@ -0,0 +1,7 @@ +module Main where + +import Distribution.Simple ( defaultMain ) + +main :: IO () +main = defaultMain + diff --git a/cabal-testsuite/PackageTests/WorkingDir/cabal.project b/cabal-testsuite/PackageTests/WorkingDir/cabal.project new file mode 100644 index 00000000000..d3728fff485 --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/cabal.project @@ -0,0 +1 @@ +packages: ., dep diff --git a/cabal-testsuite/PackageTests/WorkingDir/dep/Dep.hs b/cabal-testsuite/PackageTests/WorkingDir/dep/Dep.hs new file mode 100644 index 00000000000..42677d6abf7 --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/dep/Dep.hs @@ -0,0 +1,4 @@ +module Dep where + +foo :: Int +foo = 17 diff --git a/cabal-testsuite/PackageTests/WorkingDir/dep/Setup.hs b/cabal-testsuite/PackageTests/WorkingDir/dep/Setup.hs new file mode 100644 index 00000000000..e336d1360dc --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/dep/Setup.hs @@ -0,0 +1,7 @@ +module Main where + +import Distribution.Simple ( defaultMain ) + +main :: IO () +main = defaultMain + diff --git a/cabal-testsuite/PackageTests/WorkingDir/dep/dep.cabal b/cabal-testsuite/PackageTests/WorkingDir/dep/dep.cabal new file mode 100644 index 00000000000..56a03ad8ec9 --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/dep/dep.cabal @@ -0,0 +1,18 @@ +cabal-version: 2.4 +name: dep +version: 0.1.0.0 +synopsis: Test that we don't pass --working-dir when unsupported +license: BSD-3-Clause +author: NA +maintainer: NA +category: Testing +build-type: Custom + +custom-setup + setup-depends: base, Cabal >= 2.4 && < 3.13 + +library + build-depends: base + default-language: Haskell2010 + hs-source-dirs: . + exposed-modules: Dep diff --git a/cabal-testsuite/PackageTests/WorkingDir/setup.test.hs b/cabal-testsuite/PackageTests/WorkingDir/setup.test.hs new file mode 100644 index 00000000000..206db0e09e3 --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/setup.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +main = cabalTest $ recordMode DoNotRecord $ do + skipUnlessAnyCabalVersion "< 3.13" + cabalWithStdin "v2-build" [] "" + return () diff --git a/cabal-testsuite/PackageTests/WorkingDir/working-dir-test.cabal b/cabal-testsuite/PackageTests/WorkingDir/working-dir-test.cabal new file mode 100644 index 00000000000..c9ef242ee61 --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDir/working-dir-test.cabal @@ -0,0 +1,18 @@ +cabal-version: 2.4 +name: working-dir-test +version: 0.1.0.0 +synopsis: Test that we don't pass --working-dir when unsupported +license: BSD-3-Clause +author: NA +maintainer: NA +category: Testing +build-type: Custom + +custom-setup + setup-depends: base, Cabal >= 2.4 && < 3.13 + +executable Exe + default-language: Haskell2010 + build-depends: base, dep + hs-source-dirs: . + main-is: Main.hs