-
Notifications
You must be signed in to change notification settings - Fork 17
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
Sometimes buildExe compiles modules twice when once is enough #189
Comments
Sorry if this is hijacking the issue, but I was just discussing something related with @dcoutts. If there are no source changes, would calling |
Originally, buildExe was intended to recompile only as much as needed (by keeping all old build directories intact between compilations). However, you discovered it leads to buggy behaviour and we implemented a quickfix (1.): So, I guess, we should implement fix 2. or fix 3. (though I'm not sure it's valid, unless our code is only to work on Linux) and remove the quickfix 1. @edsko: do I get it right? |
Backporting the fix only helps when running on a file system with high resolution filestamps. Some Linux file systems are in that category, but not all; and OSX's file system isn't either. That's why we didn't go ahead with backporting the fix. |
Sorry, didn't realize you were waiting on my feedback. Option (2) from that issue sounds good. |
I've implemented and pushed a variant of fix 2. to #119 (and reverted the old workaround). Thanks to @edsko, I could get away with a much simpler actual fix code than anticipated. Nevertheless, debugging, preparing tests and testing took very long, as always, and I still can't say I understand all progress messages from the tests. The focus on convoluted and pathological cases in our tests doesn't help either. I'd need to extract all suspect tests, run them manually with ghc in verbose mode and match the obtained output with the progress lines from ide-backend. But I think the issue of recompilation in consecutive runs is fixed and if there are problems, they concern the initial issue --- unneeded compilation within a single run. As a side effect of the better fix to #119, the initial example from the top of this issue "Relative include paths (#156) with dynamic include path change" now does not do any spurious recompilations. However the following test series still produce more progress messages than I can easily justify, so they are candidates for further investigation:
|
See #237 (comment) . |
I now even got a module compiled three times:
Not sure what's going on.. |
BuildExe compiles a library from loaded modules and then compiles (possibly many) executables using the library (and thus avoiding recompilation of the modules for each executable in turn). In some cases (I can't see a clear pattern, though this seems to only happen for modules called Main, but in files not named "Main.hs"), buildExe compiles a module the second time, while it should take it from the library. E.g., in ghc-errors.hs test "Relative include paths (#156) with dynamic include path change" it produces the following progress messages list
while the correct list should be
For comparison and illustration, for a single Main module in a Main.hs file, the progress messages, as currently produces, are correct and look as follows
The first compilation is as part of the library, the second as an exe. If
buildExe
is invoked with 4 executables to build, Main, Exe1, Exe2 and Exe3, and Exe* depend on the Main module, then Exe* don't need to recompile Main, but use it from the library, resulting inThe text was updated successfully, but these errors were encountered: