Skip to content

Commit

Permalink
Don't fiddle with the buildable field
Browse files Browse the repository at this point in the history
Looks like I totally outsmarted myself here working on the Cabal 2.0
migration. Please see the newly added comment in this commit.
  • Loading branch information
snoyberg committed Aug 17, 2017
1 parent 66a9b1e commit aae34fc
Showing 1 changed file with 18 additions and 27 deletions.
45 changes: 18 additions & 27 deletions src/Stack/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
--
Expand Down

0 comments on commit aae34fc

Please sign in to comment.