mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-01-11 23:08:30 +01:00
Add library profiling support #3973
* Implements --enable-library-profiling in the executable * Adds pbEnableLibProfiling * Adds ability to skip profiling on some packages, e.g. skipped-profiling: - transformers-compat
This commit is contained in:
parent
1f2824540e
commit
335fa91385
@ -88,12 +88,13 @@ data BuildConstraints = BuildConstraints
|
||||
}
|
||||
|
||||
data PackageConstraints = PackageConstraints
|
||||
{ pcVersionRange :: VersionRange
|
||||
, pcMaintainer :: Maybe Maintainer
|
||||
, pcTests :: TestState
|
||||
, pcHaddocks :: TestState
|
||||
, pcBuildBenchmarks :: Bool
|
||||
, pcFlagOverrides :: Map FlagName Bool
|
||||
{ pcVersionRange :: VersionRange
|
||||
, pcMaintainer :: Maybe Maintainer
|
||||
, pcTests :: TestState
|
||||
, pcHaddocks :: TestState
|
||||
, pcBuildBenchmarks :: Bool
|
||||
, pcFlagOverrides :: Map FlagName Bool
|
||||
, pcEnableLibProfile :: Bool
|
||||
}
|
||||
deriving (Show, Eq)
|
||||
instance ToJSON PackageConstraints where
|
||||
@ -115,6 +116,7 @@ instance FromJSON PackageConstraints where
|
||||
pcBuildBenchmarks <- o .: "build-benchmarks"
|
||||
pcFlagOverrides <- Map.mapKeysWith const mkFlagName <$> o .: "flags"
|
||||
pcMaintainer <- o .:? "maintainer"
|
||||
pcEnableLibProfile <- fmap (fromMaybe False) (o .:? "library-profiling")
|
||||
return PackageConstraints {..}
|
||||
|
||||
-- | The proposed plan from the requirements provided by contributors.
|
||||
@ -152,6 +154,7 @@ data ConstraintFile = ConstraintFile
|
||||
, cfSkippedBenchmarks :: Set PackageName
|
||||
, cfPackages :: Map Maintainer (Vector Dependency)
|
||||
, cfGithubUsers :: Map Text (Set Text)
|
||||
, cfSkippedLibProfiling :: Set PackageName
|
||||
}
|
||||
|
||||
instance FromJSON ConstraintFile where
|
||||
@ -162,6 +165,7 @@ instance FromJSON ConstraintFile where
|
||||
cfExpectedTestFailures <- getPackages o "expected-test-failures"
|
||||
cfExpectedHaddockFailures <- getPackages o "expected-haddock-failures"
|
||||
cfSkippedBenchmarks <- getPackages o "skipped-benchmarks"
|
||||
cfSkippedLibProfiling <- getPackages o "skipped-profiling"
|
||||
cfPackages <- o .: "packages"
|
||||
>>= mapM (mapM toDep)
|
||||
. Map.mapKeysWith const Maintainer
|
||||
@ -196,6 +200,7 @@ toBC ConstraintFile {..} = do
|
||||
mpair = lookup name revmap
|
||||
pcMaintainer = fmap fst mpair
|
||||
pcVersionRange = maybe anyVersion snd mpair
|
||||
pcEnableLibProfile = not (name `member` cfSkippedLibProfiling)
|
||||
pcTests
|
||||
| name `member` cfSkippedTests = Don'tBuild
|
||||
| name `member` cfExpectedTestFailures = ExpectFailure
|
||||
|
||||
@ -27,8 +27,9 @@ import System.IO (BufferMode (LineBuffering), hSetBuffering)
|
||||
|
||||
-- | Flags passed in from the command line.
|
||||
data BuildFlags = BuildFlags
|
||||
{ bfEnableTests :: !Bool
|
||||
, bfDoUpload :: !Bool
|
||||
{ bfEnableTests :: !Bool
|
||||
, bfDoUpload :: !Bool
|
||||
, bfEnableLibProfile :: !Bool
|
||||
} deriving (Show)
|
||||
|
||||
data BuildType = Nightly | LTS BumpType
|
||||
@ -180,6 +181,7 @@ completeBuild buildType buildFlags = withManager tlsManagerSettings $ \man -> do
|
||||
, pbJobs = 8
|
||||
, pbGlobalInstall = False
|
||||
, pbEnableTests = bfEnableTests buildFlags
|
||||
, pbEnableLibProfiling = bfEnableLibProfile buildFlags
|
||||
}
|
||||
performBuild pb >>= mapM_ putStrLn
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ data PerformBuild = PerformBuild
|
||||
, pbGlobalInstall :: Bool
|
||||
-- ^ Register packages in the global database
|
||||
, pbEnableTests :: Bool
|
||||
, pbEnableLibProfiling :: Bool
|
||||
}
|
||||
|
||||
data PackageInfo = PackageInfo
|
||||
@ -299,6 +300,8 @@ singleBuild pb@PerformBuild {..} SingleBuild {..} =
|
||||
tell' $ "--datadir=" ++ fpToText (pbDataDir pb)
|
||||
tell' $ "--docdir=" ++ fpToText (pbDocDir pb)
|
||||
tell' $ "--flags=" ++ flags
|
||||
when (pbEnableLibProfiling && pcEnableLibProfile) $
|
||||
tell' "--enable-library-profiling"
|
||||
where
|
||||
tell' x = tell (x:)
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ updateBuildConstraints BuildPlan {..} =
|
||||
, pcHaddocks = maybe ExpectSuccess pcHaddocks moldPC
|
||||
, pcBuildBenchmarks = maybe True pcBuildBenchmarks moldPC
|
||||
, pcFlagOverrides = maybe mempty pcFlagOverrides moldPC
|
||||
, pcEnableLibProfile = maybe False pcEnableLibProfile moldPC
|
||||
}
|
||||
where
|
||||
moldBP = lookup name bpPackages
|
||||
|
||||
@ -66,4 +66,7 @@ main =
|
||||
not
|
||||
(switch
|
||||
(long "skip-upload" <>
|
||||
help "Skip uploading bundle, docs, etc."))
|
||||
help "Skip uploading bundle, docs, etc.")) <*>
|
||||
switch
|
||||
(long "enable-library-profiling" <>
|
||||
help "Enable profiling when building")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user