@@ -799,41 +799,38 @@ resolvePackageDescription packageConfig (GenericPackageDescription desc defaultF
799
799
(packageConfigPlatform packageConfig)
800
800
flags
801
801
802
- -- Due to https://github.com/haskell/cabal/issues/1725,
803
- -- versions of Cabal before 2.0 would always require that the
804
- -- dependencies for all libraries and executables be present,
805
- -- even if they were not buildable. To ensure that Stack is
806
- -- compatible with those older Cabal libraries (which may be
807
- -- in use depending on the snapshot chosen), we set buildable
808
- -- to True for libraries and executables.
809
802
updateLibDeps lib deps =
810
803
lib {libBuildInfo =
811
- (libBuildInfo lib)
812
- { targetBuildDepends = deps
813
- , buildable = True
814
- }
815
- }
804
+ (libBuildInfo lib) {targetBuildDepends = deps}}
816
805
updateExeDeps exe deps =
817
806
exe {buildInfo =
818
- (buildInfo exe)
819
- { targetBuildDepends = deps
820
- , buildable = True
821
- }
822
- }
807
+ (buildInfo exe) {targetBuildDepends = deps}}
808
+
809
+ -- Note that, prior to moving to Cabal 2.0, we would set
810
+ -- testEnabled/benchmarkEnabled here. These fields no longer
811
+ -- exist, so we modify buildable instead here. The only
812
+ -- wrinkle in the Cabal 2.0 story is
813
+ -- https://github.com/haskell/cabal/issues/1725, where older
814
+ -- versions of Cabal (which may be used for actually building
815
+ -- code) don't properly exclude build-depends for
816
+ -- non-buildable components. Testing indicates that everything
817
+ -- is working fine, and that this comment can be completely
818
+ -- ignored. I'm leaving the comment anyway in case something
819
+ -- breaks and you, poor reader, are investigating.
823
820
updateTestDeps test deps =
824
- test {testBuildInfo =
825
- (testBuildInfo test)
826
- { targetBuildDepends = deps
827
- , buildable = packageConfigEnableTests packageConfig
828
- }
829
- }
821
+ let bi = testBuildInfo test
822
+ bi' = bi
823
+ { targetBuildDepends = deps
824
+ , buildable = buildable bi && packageConfigEnableTests packageConfig
825
+ }
826
+ in test { testBuildInfo = bi' }
830
827
updateBenchmarkDeps benchmark deps =
831
- benchmark {benchmarkBuildInfo =
832
- (benchmarkBuildInfo benchmark)
833
- { targetBuildDepends = deps
834
- , buildable = packageConfigEnableBenchmarks packageConfig
835
- }
836
- }
828
+ let bi = benchmarkBuildInfo benchmark
829
+ bi' = bi
830
+ { targetBuildDepends = deps
831
+ , buildable = buildable bi && packageConfigEnableBenchmarks packageConfig
832
+ }
833
+ in benchmark { benchmarkBuildInfo = bi' }
837
834
838
835
-- | Make a map from a list of flag specifications.
839
836
--
0 commit comments