Skip to content

Commit ea4ea11

Browse files
gbazmergify-bot
authored andcommitted
glob expand extra-src-files when tracking for rebuild (#7608)
* glob expand extra-src-files when tracking for rebuild * changelog Co-authored-by: Gershom Bazerman <gershom@arista.com> (cherry picked from commit 751308c)
1 parent ab688ed commit ea4ea11

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

cabal-install/src/Distribution/Client/SourceFiles.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
-- we cannot "see" easily.
1313
module Distribution.Client.SourceFiles (needElaboratedConfiguredPackage) where
1414

15+
import Control.Monad.IO.Class
16+
1517
import Distribution.Client.ProjectPlanning.Types
1618
import Distribution.Client.RebuildMonad
1719

1820
import Distribution.Solver.Types.OptionalStanza
1921

22+
import Distribution.Simple.Glob (matchDirFileGlobWithDie)
2023
import Distribution.Simple.PreProcess
2124

2225
import Distribution.Types.PackageDescription
@@ -35,6 +38,7 @@ import Distribution.ModuleName
3538

3639
import Prelude ()
3740
import Distribution.Client.Compat.Prelude
41+
import Distribution.Verbosity (silent)
3842

3943
import System.FilePath
4044

@@ -138,13 +142,14 @@ needBuildInfo pkg_descr bi modules = do
138142
-- A.hs-boot; need to track both.
139143
findNeededModules ["hs", "lhs", "hsig", "lhsig"]
140144
findNeededModules ["hs-boot", "lhs-boot"]
145+
expandedExtraSrcFiles <- liftIO $ fmap concat . for (extraSrcFiles pkg_descr) $ \fpath -> matchDirFileGlobWithDie silent (\ _ _ -> return []) (specVersion pkg_descr) "." fpath
141146
traverse_ needIfExists $ concat
142147
[ cSources bi
143148
, cxxSources bi
144149
, jsSources bi
145150
, cmmSources bi
146151
, asmSources bi
147-
, extraSrcFiles pkg_descr
152+
, expandedExtraSrcFiles
148153
]
149154
for_ (installIncludes bi) $ \f ->
150155
findFileMonitored ("." : includeDirs bi) f

changelog.d/pr-7608

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
synopsis: Glob expand extra-source-files when tracking for rebuild
2+
packages: cabal-install
3+
prs: #7608
4+
issues: #4746
5+
6+
description: {
7+
8+
- Since 3.4, extra-source-files have been tracked by cabal-install in the rebuild-checking logic. However, this tracking did not, until this PR, take into account glob-expansion.
9+
10+
}

0 commit comments

Comments
 (0)