-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow per-component builds with coverage enabled #9464
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ import Distribution.PackageDescription.Utils (cabalBug) | |
import Distribution.Pretty | ||
import Distribution.Simple.BuildPaths | ||
import Distribution.Simple.Compiler | ||
import Distribution.Simple.Flag (Flag (..), fromFlag, toFlag) | ||
import Distribution.Simple.GHC.Build | ||
( checkNeedsRecompilation | ||
, componentGhcOptions | ||
|
@@ -39,7 +38,7 @@ import Distribution.Simple.LocalBuildInfo | |
import qualified Distribution.Simple.PackageIndex as PackageIndex | ||
import Distribution.Simple.Program | ||
import Distribution.Simple.Program.GHC | ||
import Distribution.Simple.Setup.Config | ||
import Distribution.Simple.Setup.Common | ||
import Distribution.Simple.Setup.Repl | ||
import Distribution.Simple.Utils | ||
import Distribution.System | ||
|
@@ -399,10 +398,9 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do | |
-- Determine if program coverage should be enabled and if so, what | ||
-- '-hpcdir' should be. | ||
let isCoverageEnabled = exeCoverage lbi | ||
distPref = fromFlag $ configDistPref $ configFlags lbi | ||
hpcdir way | ||
| gbuildIsRepl bm = mempty -- HPC is not supported in ghci | ||
| isCoverageEnabled = toFlag $ Hpc.mixDir distPref way (gbuildName bm) | ||
| isCoverageEnabled = toFlag $ Hpc.mixDir (tmpDir </> extraCompilationArtifacts) way | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an artifact of (Really, they call it tmpDir because the build dir is postfixed with |
||
| otherwise = mempty | ||
|
||
rpaths <- getRPaths lbi clbi | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,8 @@ import Control.Monad (forM_) | |
import qualified Distribution.ModuleName as ModuleName | ||
import Distribution.Package | ||
import Distribution.PackageDescription as PD | ||
import Distribution.Pretty | ||
import Distribution.Simple.BuildPaths | ||
import Distribution.Simple.Compiler | ||
import Distribution.Simple.Flag (Flag (..), fromFlag, toFlag) | ||
import Distribution.Simple.GHC.Build | ||
( checkNeedsRecompilation | ||
, componentGhcOptions | ||
|
@@ -28,7 +26,7 @@ import Distribution.Simple.Program | |
import qualified Distribution.Simple.Program.Ar as Ar | ||
import Distribution.Simple.Program.GHC | ||
import qualified Distribution.Simple.Program.Ld as Ld | ||
import Distribution.Simple.Setup.Config | ||
import Distribution.Simple.Setup.Common | ||
import Distribution.Simple.Setup.Repl | ||
import Distribution.Simple.Utils | ||
import Distribution.System | ||
|
@@ -97,15 +95,9 @@ buildOrReplLib mReplFlags verbosity numJobs pkg_descr lbi lib clbi = do | |
-- Determine if program coverage should be enabled and if so, what | ||
-- '-hpcdir' should be. | ||
let isCoverageEnabled = libCoverage lbi | ||
-- TODO: Historically HPC files have been put into a directory which | ||
-- has the package name. I'm going to avoid changing this for | ||
-- now, but it would probably be better for this to be the | ||
-- component ID instead... | ||
pkg_name = prettyShow (PD.package pkg_descr) | ||
distPref = fromFlag $ configDistPref $ configFlags lbi | ||
hpcdir way | ||
| forRepl = mempty -- HPC is not supported in ghci | ||
| isCoverageEnabled = toFlag $ Hpc.mixDir distPref way pkg_name | ||
| isCoverageEnabled = toFlag $ Hpc.mixDir (libTargetDir </> extraCompilationArtifacts) way | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and this is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, but this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are a few naming inconsistencies amongst these functions |
||
| otherwise = mempty | ||
|
||
createDirectoryIfMissingVerbose verbosity True libTargetDir | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This this function going to repeat this work for each package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, 🤦