Skip to content

Commit 23ee719

Browse files
committed
Formulates Paths_ module to ignore with _ in place of -
1 parent d791af6 commit 23ee719

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/Stack/Build/Source.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ checkBuildCache pkgName oldCache files = do
512512
-- Filter out the cabal_macros file to avoid spurious recompilations
513513
go fp _ _ | takeFileName fp == "cabal_macros.h" = pure (Set.empty, Map.empty)
514514
-- Filter out the Paths_<pkg name> file to avoid spurious recompilations
515-
go fp _ _ | takeFileName fp == "Paths_" ++ packageNameString pkgName ++ ".hs" = pure (Set.empty, Map.empty)
515+
go fp _ _ | takeFileName fp == pathsFile = pure (Set.empty, Map.empty)
516516
-- Common case where it's in the cache and on the filesystem.
517517
go fp (Just digest') (Just fci)
518518
| fci.hash == digest' = pure (Set.empty, Map.singleton fp fci)
@@ -524,6 +524,14 @@ checkBuildCache pkgName oldCache files = do
524524
go fp (Just digest') Nothing =
525525
pure (Set.singleton fp, Map.singleton fp $ FileCacheInfo digest')
526526

527+
pathsFile =
528+
"Paths_" ++ map fixPathsFileChar (packageNameString pkgName) ++ ".hs"
529+
530+
-- cabal doesn't currently expose this logic from
531+
-- Distribution.Simple.Build.PathsModule
532+
fixPathsFileChar '-' = '_'
533+
fixPathsFileChar c = c
534+
527535
-- | Returns entries to add to the build cache for any newly found unlisted
528536
-- modules
529537
addUnlistedToBuildCache ::

0 commit comments

Comments
 (0)