Skip to content

Commit 2592dc6

Browse files
committed
Disable per-component build when program coverage enabled
Creating the test program coverage report requires the test runner to know the build directory for the library component. If per-component builds are enabled, this is not possible because the library is not in-scope at the same time as the test component. The only apparent solution that does not require rethinking per-component builds entirely is to disable it when coverage is enabled. Resolves: #4798
1 parent 0c37de7 commit 2592dc6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cabal-install/Distribution/Client/ProjectPlanning.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
12111211
where
12121212
-- You are eligible to per-component build if this list is empty
12131213
why_not_per_component g
1214-
= cuz_custom ++ cuz_spec ++ cuz_length ++ cuz_flag
1214+
= cuz_custom ++ cuz_spec ++ cuz_length ++ cuz_flag ++ cuz_coverage
12151215
where
12161216
cuz reason = [text reason]
12171217
-- At this point in time, only non-Custom setup scripts
@@ -1243,6 +1243,12 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
12431243
| fromFlagOrDefault True (projectConfigPerComponent sharedPackageConfig)
12441244
= []
12451245
| otherwise = cuz "you passed --disable-per-component"
1246+
-- Enabling program coverage introduces odd runtime dependencies
1247+
-- between components.
1248+
cuz_coverage
1249+
| fromFlagOrDefault False (packageConfigCoverage localPackagesConfig)
1250+
= cuz "program coverage is enabled"
1251+
| otherwise = []
12461252

12471253
-- | Sometimes a package may make use of features which are only
12481254
-- supported in per-package mode. If this is the case, we should

0 commit comments

Comments
 (0)