@@ -845,8 +845,10 @@ ensureConfig :: HasEnvConfig env
845845ensureConfig newConfigCache pkgDir ExecuteEnv {.. } announce cabal cabalfp task = do
846846 newCabalMod <- liftIO $ modificationTime <$> getFileStatus (toFilePath cabalfp)
847847 setupConfigfp <- setupConfigFromDir pkgDir
848- newSetupConfigMod <- liftIO $ either (const Nothing ) (Just . modificationTime) <$>
849- tryJust (guard . isDoesNotExistError) (getFileStatus (toFilePath setupConfigfp))
848+ let getNewSetupConfigMod =
849+ liftIO $ either (const Nothing ) (Just . modificationTime) <$>
850+ tryJust (guard . isDoesNotExistError) (getFileStatus (toFilePath setupConfigfp))
851+ newSetupConfigMod <- getNewSetupConfigMod
850852 -- See https://github.com/commercialhaskell/stack/issues/3554
851853 taskAnyMissingHack <- view $ actualCompilerVersionL. to getGhcVersion. to (< mkVersion [8 , 4 ])
852854 needConfig <-
@@ -905,6 +907,11 @@ ensureConfig newConfigCache pkgDir ExecuteEnv {..} announce cabal cabalfp task =
905907 TTLocalMutable {} -> writeConfigCache pkgDir newConfigCache
906908 TTRemotePackage {} -> return ()
907909 writeCabalMod pkgDir newCabalMod
910+ -- This file gets updated one more time by the configure step, so get
911+ -- the most recent value. We could instead change our logic above to
912+ -- check if our config mod file is newer than the file above, but this
913+ -- seems reasonable too.
914+ getNewSetupConfigMod >>= writeSetupConfigMod pkgDir
908915
909916 return needConfig
910917 where
0 commit comments