Repository navigation
Cache source directory listings when preprocessing #12606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Lotion-3
wants to merge
4
commits into
haskell:master
Choose a base branch
from
Lotion-3:perf/preprocess-dir-cache
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7bab838
Cache source directory listings when preprocessing
Lotion-3 ad327b7
Use atomic IORef operations for the source directory cache
Lotion-3 8c53793
Leave non-ASCII names out of the listing instead of not caching the d…
Lotion-3 a77d04d
Use FilePath for the names in the source directory cache
Lotion-3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module Main where | ||
|
|
||
| import Foo | ||
|
|
||
| main :: IO () | ||
| main = putStrLn $ "hsc2hs value: " ++ show foo |
13 changes: 13 additions & 0 deletions
13
cabal-testsuite/PackageTests/PreProcess/Hsc2HsRerun/my.cabal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| cabal-version: 3.6 | ||
| name: Hsc2HsRerun | ||
| version: 0.1 | ||
| license: BSD-3-Clause | ||
| stability: stable | ||
| category: PackageTests | ||
| build-type: Simple | ||
| description: Check that preprocessors are re-run when their input changes. | ||
|
|
||
| executable my-executable | ||
| main-is: Main.hs | ||
| other-modules: Foo | ||
| build-depends: base |
12 changes: 12 additions & 0 deletions
12
cabal-testsuite/PackageTests/PreProcess/Hsc2HsRerun/setup.cabal.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Setup configure | ||
| Configuring Hsc2HsRerun-0.1... | ||
| # Setup build | ||
| Preprocessing executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| Building executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| # my-executable | ||
| hsc2hs value: 1 | ||
| # Setup build | ||
| Preprocessing executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| Building executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| # my-executable | ||
| hsc2hs value: 2 |
12 changes: 12 additions & 0 deletions
12
cabal-testsuite/PackageTests/PreProcess/Hsc2HsRerun/setup.out
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Setup configure | ||
| Configuring Hsc2HsRerun-0.1... | ||
| # Setup build | ||
| Preprocessing executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| Building executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| # my-executable | ||
| hsc2hs value: 1 | ||
| # Setup build | ||
| Preprocessing executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| Building executable 'my-executable' for Hsc2HsRerun-0.1... | ||
| # my-executable | ||
| hsc2hs value: 2 |
23 changes: 23 additions & 0 deletions
23
cabal-testsuite/PackageTests/PreProcess/Hsc2HsRerun/setup.test.hs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import Test.Cabal.Prelude | ||
|
|
||
| -- Check that hsc2hs is re-run when the .hsc file changes, and that the newly | ||
| -- generated module is used. This was broken in #11810, where a stale | ||
| -- preprocessor output in the build directory was mistaken for a source file. | ||
| main = setupAndCabalTest $ do | ||
| writeSourceFile "Foo.hsc" (hscModule 1) | ||
| setup "configure" [] | ||
| setup "build" [] | ||
| runExe' "my-executable" [] >>= assertOutputContains "hsc2hs value: 1" | ||
| delay | ||
| writeSourceFile "Foo.hsc" (hscModule 2) | ||
| setup "build" [] | ||
| runExe' "my-executable" [] >>= assertOutputContains "hsc2hs value: 2" | ||
| where | ||
| hscModule :: Int -> String | ||
| hscModule n = | ||
| unlines | ||
| [ "module Foo where" | ||
| , "" | ||
| , "foo :: Int" | ||
| , "foo = #{const " ++ show n ++ "}" | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- | ||
| synopsis: Fewer file system lookups when preprocessing modules | ||
| packages: [Cabal] | ||
| prs: 12606 | ||
| issues: [10489] | ||
| --- | ||
|
|
||
| When preprocessing a component, Cabal looked for a file with every known | ||
| preprocessor suffix in every source directory for every module, calling | ||
| `doesFileExist` each time. It now lists each source directory once, and uses the | ||
| listing to rule out files that do not exist. This speeds up the "Preprocessing" | ||
| step for packages with many modules, especially on Windows. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.