Skip to content

Commit

Permalink
Rebuild on changes in all extra-source-files
Browse files Browse the repository at this point in the history
This should alleviate haskell#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.
  • Loading branch information
kmicklas committed Jun 11, 2020
1 parent 5ce6b08 commit ea8e60f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 1 addition & 7 deletions cabal-install/Distribution/Client/SourceFiles.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions changelog.d/issue-4746
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
synopsis: all extra-source-files are change-tracked
packages: cabal-install
issues: #4746

0 comments on commit ea8e60f

Please sign in to comment.