mirror of
https://github.com/commercialhaskell/stackage.git
synced 2026-03-02 15:04:37 +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
|
data PackageConstraints = PackageConstraints
|
||||||
{ pcVersionRange :: VersionRange
|
{ pcVersionRange :: VersionRange
|
||||||
, pcMaintainer :: Maybe Maintainer
|
, pcMaintainer :: Maybe Maintainer
|
||||||
, pcTests :: TestState
|
, pcTests :: TestState
|
||||||
, pcHaddocks :: TestState
|
, pcHaddocks :: TestState
|
||||||
, pcBuildBenchmarks :: Bool
|
, pcBuildBenchmarks :: Bool
|
||||||
, pcFlagOverrides :: Map FlagName Bool
|
, pcFlagOverrides :: Map FlagName Bool
|
||||||
|
, pcEnableLibProfile :: Bool
|
||||||
}
|
}
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
instance ToJSON PackageConstraints where
|
instance ToJSON PackageConstraints where
|
||||||
@ -115,6 +116,7 @@ instance FromJSON PackageConstraints where
|
|||||||
pcBuildBenchmarks <- o .: "build-benchmarks"
|
pcBuildBenchmarks <- o .: "build-benchmarks"
|
||||||
pcFlagOverrides <- Map.mapKeysWith const mkFlagName <$> o .: "flags"
|
pcFlagOverrides <- Map.mapKeysWith const mkFlagName <$> o .: "flags"
|
||||||
pcMaintainer <- o .:? "maintainer"
|
pcMaintainer <- o .:? "maintainer"
|
||||||
|
pcEnableLibProfile <- fmap (fromMaybe False) (o .:? "library-profiling")
|
||||||
return PackageConstraints {..}
|
return PackageConstraints {..}
|
||||||
|
|
||||||
-- | The proposed plan from the requirements provided by contributors.
|
-- | The proposed plan from the requirements provided by contributors.
|
||||||
@ -152,6 +154,7 @@ data ConstraintFile = ConstraintFile
|
|||||||
, cfSkippedBenchmarks :: Set PackageName
|
, cfSkippedBenchmarks :: Set PackageName
|
||||||
, cfPackages :: Map Maintainer (Vector Dependency)
|
, cfPackages :: Map Maintainer (Vector Dependency)
|
||||||
, cfGithubUsers :: Map Text (Set Text)
|
, cfGithubUsers :: Map Text (Set Text)
|
||||||
|
, cfSkippedLibProfiling :: Set PackageName
|
||||||
}
|
}
|
||||||
|
|
||||||
instance FromJSON ConstraintFile where
|
instance FromJSON ConstraintFile where
|
||||||
@ -162,6 +165,7 @@ instance FromJSON ConstraintFile where
|
|||||||
cfExpectedTestFailures <- getPackages o "expected-test-failures"
|
cfExpectedTestFailures <- getPackages o "expected-test-failures"
|
||||||
cfExpectedHaddockFailures <- getPackages o "expected-haddock-failures"
|
cfExpectedHaddockFailures <- getPackages o "expected-haddock-failures"
|
||||||
cfSkippedBenchmarks <- getPackages o "skipped-benchmarks"
|
cfSkippedBenchmarks <- getPackages o "skipped-benchmarks"
|
||||||
|
cfSkippedLibProfiling <- getPackages o "skipped-profiling"
|
||||||
cfPackages <- o .: "packages"
|
cfPackages <- o .: "packages"
|
||||||
>>= mapM (mapM toDep)
|
>>= mapM (mapM toDep)
|
||||||
. Map.mapKeysWith const Maintainer
|
. Map.mapKeysWith const Maintainer
|
||||||
@ -196,6 +200,7 @@ toBC ConstraintFile {..} = do
|
|||||||
mpair = lookup name revmap
|
mpair = lookup name revmap
|
||||||
pcMaintainer = fmap fst mpair
|
pcMaintainer = fmap fst mpair
|
||||||
pcVersionRange = maybe anyVersion snd mpair
|
pcVersionRange = maybe anyVersion snd mpair
|
||||||
|
pcEnableLibProfile = not (name `member` cfSkippedLibProfiling)
|
||||||
pcTests
|
pcTests
|
||||||
| name `member` cfSkippedTests = Don'tBuild
|
| name `member` cfSkippedTests = Don'tBuild
|
||||||
| name `member` cfExpectedTestFailures = ExpectFailure
|
| name `member` cfExpectedTestFailures = ExpectFailure
|
||||||
|
|||||||
@ -27,8 +27,9 @@ import System.IO (BufferMode (LineBuffering), hSetBuffering)
|
|||||||
|
|
||||||
-- | Flags passed in from the command line.
|
-- | Flags passed in from the command line.
|
||||||
data BuildFlags = BuildFlags
|
data BuildFlags = BuildFlags
|
||||||
{ bfEnableTests :: !Bool
|
{ bfEnableTests :: !Bool
|
||||||
, bfDoUpload :: !Bool
|
, bfDoUpload :: !Bool
|
||||||
|
, bfEnableLibProfile :: !Bool
|
||||||
} deriving (Show)
|
} deriving (Show)
|
||||||
|
|
||||||
data BuildType = Nightly | LTS BumpType
|
data BuildType = Nightly | LTS BumpType
|
||||||
@ -180,6 +181,7 @@ completeBuild buildType buildFlags = withManager tlsManagerSettings $ \man -> do
|
|||||||
, pbJobs = 8
|
, pbJobs = 8
|
||||||
, pbGlobalInstall = False
|
, pbGlobalInstall = False
|
||||||
, pbEnableTests = bfEnableTests buildFlags
|
, pbEnableTests = bfEnableTests buildFlags
|
||||||
|
, pbEnableLibProfiling = bfEnableLibProfile buildFlags
|
||||||
}
|
}
|
||||||
performBuild pb >>= mapM_ putStrLn
|
performBuild pb >>= mapM_ putStrLn
|
||||||
|
|
||||||
|
|||||||
@ -62,6 +62,7 @@ data PerformBuild = PerformBuild
|
|||||||
, pbGlobalInstall :: Bool
|
, pbGlobalInstall :: Bool
|
||||||
-- ^ Register packages in the global database
|
-- ^ Register packages in the global database
|
||||||
, pbEnableTests :: Bool
|
, pbEnableTests :: Bool
|
||||||
|
, pbEnableLibProfiling :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
data PackageInfo = PackageInfo
|
data PackageInfo = PackageInfo
|
||||||
@ -299,6 +300,8 @@ singleBuild pb@PerformBuild {..} SingleBuild {..} =
|
|||||||
tell' $ "--datadir=" ++ fpToText (pbDataDir pb)
|
tell' $ "--datadir=" ++ fpToText (pbDataDir pb)
|
||||||
tell' $ "--docdir=" ++ fpToText (pbDocDir pb)
|
tell' $ "--docdir=" ++ fpToText (pbDocDir pb)
|
||||||
tell' $ "--flags=" ++ flags
|
tell' $ "--flags=" ++ flags
|
||||||
|
when (pbEnableLibProfiling && pcEnableLibProfile) $
|
||||||
|
tell' "--enable-library-profiling"
|
||||||
where
|
where
|
||||||
tell' x = tell (x:)
|
tell' x = tell (x:)
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@ updateBuildConstraints BuildPlan {..} =
|
|||||||
, pcHaddocks = maybe ExpectSuccess pcHaddocks moldPC
|
, pcHaddocks = maybe ExpectSuccess pcHaddocks moldPC
|
||||||
, pcBuildBenchmarks = maybe True pcBuildBenchmarks moldPC
|
, pcBuildBenchmarks = maybe True pcBuildBenchmarks moldPC
|
||||||
, pcFlagOverrides = maybe mempty pcFlagOverrides moldPC
|
, pcFlagOverrides = maybe mempty pcFlagOverrides moldPC
|
||||||
|
, pcEnableLibProfile = maybe False pcEnableLibProfile moldPC
|
||||||
}
|
}
|
||||||
where
|
where
|
||||||
moldBP = lookup name bpPackages
|
moldBP = lookup name bpPackages
|
||||||
|
|||||||
@ -66,4 +66,7 @@ main =
|
|||||||
not
|
not
|
||||||
(switch
|
(switch
|
||||||
(long "skip-upload" <>
|
(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