diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2018-11-18 15:14:27 +0100 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2019-01-22 03:06:51 +0100 |
commit | a65efc2566dd4aa60380da8c03b878131095eea3 (patch) | |
tree | 7cf3f835cd626957aff73ab1157494efc420825b /lib | |
parent | 1d9d69b076e101ee67842b4e82423e8d57559544 (diff) |
Include package.yaml in Unit modification times for Stack projects
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Distribution/Helper.hs | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs index 0c2fddb..fb6fb7a 100644 --- a/lib/Distribution/Helper.hs +++ b/lib/Distribution/Helper.hs @@ -213,15 +213,22 @@ getUnitModTimes Unit { uDistDir=DistDirLib distdirv1 , uCabalFile=CabalFile cabal_file_path + , uPackageDir + , uImpl } = do - cabal_file_mtime <- getFileModTime cabal_file_path - let setup_config = distdirv1 </> "setup-config" - setup_config_mtime <- (traverse getFileModTime <=< mightExist) setup_config - return UnitModTimes - { umtCabalFile = cabal_file_mtime - , umtSetupConfig = setup_config_mtime - } + umtPkgYaml <- + case uImpl of + UnitImplStack{} + -> traverse getFileModTime =<< mightExist package_yaml_path + _ -> return Nothing + umtCabalFile <- getFileModTime cabal_file_path + umtSetupConfig <- (traverse getFileModTime <=< mightExist) setup_config_path + return UnitModTimes {..} + where + package_yaml_path = uPackageDir </> "package.yaml" + setup_config_path = distdirv1 </> "setup-config" + -- | The version of GHC the project is configured to use compilerVersion :: Query pt (String, Version) @@ -326,9 +333,10 @@ shallowReconfigureProject QueryEnv ["new-build", "--dry-run", "all"] "" return () shallowReconfigureProject QueryEnv - { qeProjLoc = ProjLocStackDir _projdir, .. } = - -- TODO: do we need to do anything here? Maybe package.yaml support needs to - -- do stuff here? + { qeProjLoc = ProjLocStackDir projdir, .. } = do + -- -- In case we ever need to read the cabal files before the Unit stage, this command regenerates them from package.yaml + -- _ <- liftIO $ qeReadProcess (Just projdir) (stackProgram qePrograms) + -- ["build", "--dry-run"] "" return () reconfigureUnit :: QueryEnvI c pt -> Unit pt -> IO () |