Commit 5e1d004c authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Minor revision

parent a432cffc
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Hadrian.Oracles.ArgsHash (
TrackArgument, trackAllArguments, checkArgsHash, argsHashOracle
TrackArgument, trackAllArguments, trackArgsHash, argsHashOracle
) where
import Control.Monad
......@@ -34,13 +34,14 @@ newtype ArgsHashKey c b = ArgsHashKey (Target c b)
-- in the Shake database. This optimisation is normally harmless, because
-- argument list constructors are assumed not to examine target sources, but
-- only append them to argument lists where appropriate.
checkArgsHash :: (ShakeValue c, ShakeValue b) => Target c b -> Action ()
checkArgsHash t = do
trackArgsHash :: (ShakeValue c, ShakeValue b) => Target c b -> Action ()
trackArgsHash t = do
let hashedInputs = [ show $ hash (inputs t) ]
hashedTarget = target (context t) (builder t) hashedInputs (outputs t)
void (askOracle $ ArgsHashKey hashedTarget :: Action Int)
-- | Oracle for storing per-target argument list hashes.
-- | This oracle stores per-target argument list hashes in the Shake database,
-- allowing the user to track them between builds using 'trackArgsHash' queries.
argsHashOracle :: (ShakeValue c, ShakeValue b) => TrackArgument c b -> Args c b -> Rules ()
argsHashOracle trackArgument args = void $
addOracle $ \(ArgsHashKey target) -> do
......@@ -51,7 +51,7 @@ customBuild rs opts target = do
argList <- interpret target getArgs
verbose <- interpret target verboseCommands
let quietlyUnlessVerbose = if verbose then withVerbosity Loud else quietly
checkArgsHash target -- Rerun the rule if the hash of argList has changed.
trackArgsHash target -- Rerun the rule if the hash of argList has changed.
withResources rs $ do
putInfo target
quietlyUnlessVerbose $ case targetBuilder of
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment