From aae34fccd81207d6867a76c6d93c57865a260f5d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 17 Aug 2017 16:55:42 +0300 Subject: [PATCH] Don't fiddle with the buildable field Looks like I totally outsmarted myself here working on the Cabal 2.0 migration. Please see the newly added comment in this commit. --- src/Stack/Package.hs | 45 ++++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/src/Stack/Package.hs b/src/Stack/Package.hs index 0faf4efa29..1e0eda54d8 100644 --- a/src/Stack/Package.hs +++ b/src/Stack/Package.hs @@ -799,41 +799,32 @@ resolvePackageDescription packageConfig (GenericPackageDescription desc defaultF (packageConfigPlatform packageConfig) flags - -- Due to https://github.com/haskell/cabal/issues/1725, - -- versions of Cabal before 2.0 would always require that the - -- dependencies for all libraries and executables be present, - -- even if they were not buildable. To ensure that Stack is - -- compatible with those older Cabal libraries (which may be - -- in use depending on the snapshot chosen), we set buildable - -- to True for libraries and executables. updateLibDeps lib deps = lib {libBuildInfo = - (libBuildInfo lib) - { targetBuildDepends = deps - , buildable = True - } - } + (libBuildInfo lib) {targetBuildDepends = deps}} updateExeDeps exe deps = exe {buildInfo = - (buildInfo exe) - { targetBuildDepends = deps - , buildable = True - } - } + (buildInfo exe) {targetBuildDepends = deps}} + + -- Note that, prior to moving to Cabal 2.0, we would set + -- testEnabled/benchmarkEnabled here. These fields no longer + -- exist, and the equivalent functionality shoudl be taken + -- care of elsewhere (like Stack.Build.Source checking what + -- components are being built). The only wrinkle in the Cabal + -- 2.0 story is https://github.com/haskell/cabal/issues/1725, + -- where older versions of Cabal (which may be used for + -- actually building code) don't properly exclude + -- build-depends for non-buildable components. Testing + -- indicates that everything is working fine, and that this + -- comment can be completely ignored. I'm leaving the comment + -- anyway in case something breaks and you, poor reader, are + -- investigating. updateTestDeps test deps = test {testBuildInfo = - (testBuildInfo test) - { targetBuildDepends = deps - , buildable = packageConfigEnableTests packageConfig - } - } + (testBuildInfo test) {targetBuildDepends = deps}} updateBenchmarkDeps benchmark deps = benchmark {benchmarkBuildInfo = - (benchmarkBuildInfo benchmark) - { targetBuildDepends = deps - , buildable = packageConfigEnableBenchmarks packageConfig - } - } + (benchmarkBuildInfo benchmark) {targetBuildDepends = deps}} -- | Make a map from a list of flag specifications. --