From 7bbc66f3a0151a979d72c9fad6dc5435048cbbc9 Mon Sep 17 00:00:00 2001 From: Andreas Klebinger <klebinger.andreas@gmx.at> Date: Wed, 5 May 2021 16:12:40 +0200 Subject: [PATCH] Add a project file to be used with hackage-head This can be used via passing --head to the nofib runner. It will build benchmark dependencies using the given benchmark compiler and hackage.head. --- nofib.head | 13 +++++++++++++ shake/README.mkd | 6 ++++++ shake/runner/Main.hs | 4 +++- shake/runner/RunnerTypes.hs | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 nofib.head diff --git a/nofib.head b/nofib.head new file mode 100644 index 00000000..30fa13eb --- /dev/null +++ b/nofib.head @@ -0,0 +1,13 @@ +-- A cabal.project file to be used with hackage head. +-- Use by running `cabal --project-file nofib.head <usual command>` + +packages: shake + +repository head.hackage.ghc.haskell.org + url: https://ghc.gitlab.haskell.org/head.hackage/ + secure: True + key-threshold: 3 + root-keys: + f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 + 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 + 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d \ No newline at end of file diff --git a/shake/README.mkd b/shake/README.mkd index 5e8e4097..abb75f13 100644 --- a/shake/README.mkd +++ b/shake/README.mkd @@ -6,6 +6,12 @@ variety of compile- and run-time metrics. These metrics are recorded in a common semi-structured CSV file format, which can be compared and analysed with the included `nofib-compare` utility. +## Hackage head support + +Simply pass `--head` to the shake runner to use hackage.head. + +This works by using `nofib.head` as cabal project file for test dependencies instead of +`cabal.project`. ## Usage diff --git a/shake/runner/Main.hs b/shake/runner/Main.hs index 67ef1407..ab37c55e 100644 --- a/shake/runner/Main.hs +++ b/shake/runner/Main.hs @@ -249,7 +249,9 @@ buildRules nofib@Build{..} = do -- TODO: Invoking cabal in the way we do without any package argument fails. root <- liftIO $ IO.makeAbsolute buildDepsRoot unless (null deps) $ withResource pkgDbResource 1 $ - cmd_ "cabal" ("--store-dir=" <> root) "v2-install" "--lib" "-w" compiler "--allow-newer" deps ("-j"<> show threads) + let project_file = if useHackageHead then "--project-file=nofib.head" else "" + in + cmd_ "cabal" project_file ("--store-dir=" <> root) "v2-install" "--lib" "-w" compiler "--allow-newer" deps ("-j"<> show threads) liftIO $ writeFile out "" -- Benchmark rules diff --git a/shake/runner/RunnerTypes.hs b/shake/runner/RunnerTypes.hs index 510f6cd4..6de6204d 100644 --- a/shake/runner/RunnerTypes.hs +++ b/shake/runner/RunnerTypes.hs @@ -66,6 +66,7 @@ data Nofib ,rts_args :: [String] ,times :: Int ,keepGoing :: Bool + ,useHackageHead :: Bool -- ^ Use hackage.head via nofib.head project file ,verbosity :: Int -- ^ Default 1 } deriving (Show) @@ -105,6 +106,7 @@ nofibMode = <*> many (option str (long "rts-arg" <> help "Extra arguments to pass to runtime system when running")) <*> option auto (long "times" <> short 't' <> value 1 <> help "Number of times to run each test") <*> switch (long "keep-going" <> help "Ignore output missmatches") + <*> switch (long "head" <> help "Use nofib.head project file for building test dependencies.") <*> option auto (long "verbosity" <> short 'v' <> short 'V' <> value 1 <> help "Verbosity, default = 1") -- GitLab