From ea8e60f5bc794b843627d9ccdbecc9f4f8c20960 Mon Sep 17 00:00:00 2001 From: Ken Micklas Date: Wed, 10 Jun 2020 20:24:32 -0400 Subject: [PATCH] Rebuild on changes in all extra-source-files This should alleviate #4746 for most use cases, if the dependent files are declared in `extra-source-files`. The downside is that `cabal` will not be able to avoid invoking GHC in as many cases, but GHC's `--make` should be smart enough to avoid any "actual" rebuilding that isn't necessary. --- cabal-install/Distribution/Client/SourceFiles.hs | 8 +------- changelog.d/issue-4746 | 3 +++ 2 files changed, 4 insertions(+), 7 deletions(-) create mode 100644 changelog.d/issue-4746 diff --git a/cabal-install/Distribution/Client/SourceFiles.hs b/cabal-install/Distribution/Client/SourceFiles.hs index 507f7a2b6a3..33fdd24b0df 100644 --- a/cabal-install/Distribution/Client/SourceFiles.hs +++ b/cabal-install/Distribution/Client/SourceFiles.hs @@ -150,14 +150,8 @@ needBuildInfo pkg_descr bi modules = do , jsSources bi , cmmSources bi , asmSources bi + , extraSrcFiles pkg_descr ] - -- A MASSIVE HACK to (1) make sure we rebuild when header - -- files change, but (2) not have to rebuild when anything - -- in extra-src-files changes (most of these won't affect - -- compilation). It would be even better if we knew on a - -- per-component basis which headers would be used but that - -- seems to be too difficult. - traverse_ needIfExists (filter ((==".h").takeExtension) (extraSrcFiles pkg_descr)) for_ (installIncludes bi) $ \f -> findFileMonitored ("." : includeDirs bi) f >>= maybe (return ()) need diff --git a/changelog.d/issue-4746 b/changelog.d/issue-4746 new file mode 100644 index 00000000000..61c44a0a2a7 --- /dev/null +++ b/changelog.d/issue-4746 @@ -0,0 +1,3 @@ +synopsis: all extra-source-files are change-tracked +packages: cabal-install +issues: #4746