Skip to content

Commit e8bf853

Browse files
ttuegel23Skidoo
authored andcommitted
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 ec9ce1c commit e8bf853

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
@@ -1219,7 +1219,7 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
12191219
where
12201220
-- You are eligible to per-component build if this list is empty
12211221
why_not_per_component g
1222-
= cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag
1222+
= cuz_buildtype ++ cuz_spec ++ cuz_length ++ cuz_flag ++ cuz_coverage
12231223
where
12241224
cuz reason = [text reason]
12251225
-- We have to disable per-component for now with
@@ -1256,6 +1256,12 @@ elaborateInstallPlan verbosity platform compiler compilerprogdb pkgConfigDB
12561256
| fromFlagOrDefault True (projectConfigPerComponent sharedPackageConfig)
12571257
= []
12581258
| otherwise = cuz "you passed --disable-per-component"
1259+
-- Enabling program coverage introduces odd runtime dependencies
1260+
-- between components.
1261+
cuz_coverage
1262+
| fromFlagOrDefault False (packageConfigCoverage localPackagesConfig)
1263+
= cuz "program coverage is enabled"
1264+
| otherwise = []
12591265

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

0 commit comments

Comments
 (0)