Skip to content

Commit aae34fc

Browse files
committed
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.
1 parent 66a9b1e commit aae34fc

File tree

1 file changed

+18
-27
lines changed

1 file changed

+18
-27
lines changed

src/Stack/Package.hs

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -799,41 +799,32 @@ resolvePackageDescription packageConfig (GenericPackageDescription desc defaultF
799799
(packageConfigPlatform packageConfig)
800800
flags
801801

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.
809802
updateLibDeps lib deps =
810803
lib {libBuildInfo =
811-
(libBuildInfo lib)
812-
{ targetBuildDepends = deps
813-
, buildable = True
814-
}
815-
}
804+
(libBuildInfo lib) {targetBuildDepends = deps}}
816805
updateExeDeps exe deps =
817806
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, and the equivalent functionality shoudl be taken
812+
-- care of elsewhere (like Stack.Build.Source checking what
813+
-- components are being built). The only wrinkle in the Cabal
814+
-- 2.0 story is https://github.com/haskell/cabal/issues/1725,
815+
-- where older versions of Cabal (which may be used for
816+
-- actually building code) don't properly exclude
817+
-- build-depends for non-buildable components. Testing
818+
-- indicates that everything is working fine, and that this
819+
-- comment can be completely ignored. I'm leaving the comment
820+
-- anyway in case something breaks and you, poor reader, are
821+
-- investigating.
823822
updateTestDeps test deps =
824823
test {testBuildInfo =
825-
(testBuildInfo test)
826-
{ targetBuildDepends = deps
827-
, buildable = packageConfigEnableTests packageConfig
828-
}
829-
}
824+
(testBuildInfo test) {targetBuildDepends = deps}}
830825
updateBenchmarkDeps benchmark deps =
831826
benchmark {benchmarkBuildInfo =
832-
(benchmarkBuildInfo benchmark)
833-
{ targetBuildDepends = deps
834-
, buildable = packageConfigEnableBenchmarks packageConfig
835-
}
836-
}
827+
(benchmarkBuildInfo benchmark) {targetBuildDepends = deps}}
837828

838829
-- | Make a map from a list of flag specifications.
839830
--

0 commit comments

Comments
 (0)