diff --git a/ghcide/bench/hist/Main.hs b/ghcide/bench/hist/Main.hs index d0beffcbed..bd819571dc 100644 --- a/ghcide/bench/hist/Main.hs +++ b/ghcide/bench/hist/Main.hs @@ -55,6 +55,7 @@ import Development.Shake.Classes import System.Console.GetOpt import Data.Maybe import Control.Monad.Extra +import System.FilePath configPath :: FilePath @@ -84,7 +85,12 @@ main = shakeArgsWith shakeOpts [configOpt] $ \configs wants -> pure $ Just $ do _ -> want wants ghcideBuildRules :: MkBuildRules BuildSystem -ghcideBuildRules = MkBuildRules findGhcForBuildSystem "ghcide" buildGhcide +ghcideBuildRules = MkBuildRules findGhcForBuildSystem "ghcide" projectDepends buildGhcide + where + projectDepends = do + need . map ("src" ) =<< getDirectoryFiles "src" ["//*.hs"] + need . map ("session-loader" ) =<< getDirectoryFiles "session-loader" ["//*.hs"] + need =<< getDirectoryFiles "." ["*.cabal"] -------------------------------------------------------------------------------- diff --git a/shake-bench/src/Development/Benchmark/Rules.hs b/shake-bench/src/Development/Benchmark/Rules.hs index 793b1498ab..1ded4a61af 100644 --- a/shake-bench/src/Development/Benchmark/Rules.hs +++ b/shake-bench/src/Development/Benchmark/Rules.hs @@ -177,6 +177,8 @@ data MkBuildRules buildSystem = MkBuildRules findGhc :: buildSystem -> FilePath -> IO FilePath -- | Name of the binary produced by 'buildProject' , executableName :: String + -- | An action that captures the source dependencies, used for the HEAD build + , projectDepends :: Action () -- | Build the project found in the cwd and save the build artifacts in the output folder , buildProject :: buildSystem -> [CmdOption] @@ -204,9 +206,8 @@ buildRules build MkBuildRules{..} = do , build -/- "binaries/HEAD/ghc.path" ] &%> \[out, ghcpath] -> do + projectDepends liftIO $ createDirectoryIfMissing True $ dropFileName out - -- TOOD more precise dependency tracking - need =<< getDirectoryFiles "." ["//*.hs", "*.cabal"] buildSystem <- askOracle $ GetBuildSystem () buildProject buildSystem [Cwd "."] (takeDirectory out) ghcLoc <- liftIO $ findGhc buildSystem "."