Repository navigation
Warn about used unlisted modules - #1455
sebastiaanvisser wants to merge 11 commits into
Conversation
…sent from the .cabal file.
And put the warning code in its own function.
This might happen for example when we build with cyclic dependencies.
|
LGTM @dcoutts do you also want to take a look? |
There was a problem hiding this comment.
We should move this under Distribution.Simple, as that's where all the build system stuff lives.
In fact, it's completely ghc-specific at the moment (in principle the type is generic but the parsing is ghc-specific) so perhaps Distribution.Simple.GHC.ModuleDependencies is the right location.
|
So yes, I think it looks good. Just want to change where the module lives and that's it. |
|
Sounds good. Fixed. |
|
Great. Also just realised that this does it just for libs, not for exes. @sebastiaanvisser if you want to add that then great, if you don't have the time then I'll do it. @tibbe this isn't essential for the 1.18.0.0 release because we can include it in a 1.18.1.x because it only adds to the API, doesn't change it. So we can put it in straight after the immediate release and gather a bit more testing. OTOH, I wouldn't object to it going in. |
|
Do we really want to do this on every |
|
I voted for during |
|
I vote for every build, but lets see how expensive it really is first. |
|
does this also cover files that are in tree, but unlisted in the cabal file? |
|
@dcoutts I'll make sure to also do this for executables and not only libraries. @tibbe I'll will try to do some profiling for some smaller and some larger projects. I suspect not much overhead in general. @23Skidoo @cartazio No it doesn't cover all the files in the tree. It only covers unlisted Haskell modules that are (direct or indirectly) imported by listed dependencies. |
|
Checking for unlisted modules is now also done for executables. Before the check is done the Any more modules that need special treatment? |
|
Some simple profiling results A no-op build simulating development in which we expect the most overhead. The patch makes the build slightly slower, but barely noticeable.
A larger install in which we expect the overhead to be negligible. The version of the patch is actually slightly faster, which is probably just noise.
|
|
A 2-3% overhead seems OK to me. |
|
Can you measure the overhead on a larger program, such as darcs or agda? Also, I'd expect the overhead to be closer to 100% for incremental builds (running |
|
A incremental cabal build of Agda for me slows down from |
|
@sebastiaanvisser That's quite a lot, especially for an incremental build. I think we should only do this on |
|
Hmm, this is a bit disappointing. Note that check & sdist currently don't do any build so that's not going to be easy. I wonder if we can't do better with the ghc -M approach to make it more incremental. For example could we do it on a per-file basis to discover direct deps only, and so then we only have to do that when the file changes. Indeed if we peruse the approach of finding (& caching) the build graph ourselves then we could make incremental builds where nothing changes really quick (ie by not delegating to ghc --make at all). |
|
Alternatively, we could use GHC API and write a small wrapper for |
|
Can we just add a check so that it's not re-generated if nothing has changed? Or are we worrying about the case where one file has changed? What are you calling an incremental build here? If we do the ghc -M approach and we don't use ghc --make then we ought to be able to avoid the overhead of doing the full module scan twice. |
|
What's the status of this pull request? |
|
I'm using this patch now for a while now and I'm am very happy with it. It prevented me from deploying broken packages to our local Hackage server a few times now, which feels like a win. A side effect of the patch is that it also warns about non-existing modules in your The performance issues are not at all a problem for any of our personal uses cases. I don't care about no-op builds for package containing 250 modules. It's just unnoticeable in real life. I do understand that some other Cabal users might notice a performance difference when user very large packages. I'm not planning on changing it to work on check/sdist, I don't have the time to do it now and I don't have enough knowledge about the inner workings of Cabal to find a proper architecture. It's up to you guys. |
|
@sebastiaanvisser Thanks for the update. I will go ahead and close the pull request then, as I want to only want to keep active pull requests open, to avoid us missing any due to the sheer number of open ones*. The pull request will still be there if someone wants to pick it up in the future. ** We have the problem with our issue list right now, which is too big to be very useful anymore. |
|
@tibbe We discussed this with @dcoutts in the context of parallel Related: #1562 (we can output the set of extensions used by the program together with the build graph). |
|
@23Skidoo Is there already a GHC ticket for your efforts? |
|
@nh2 I haven't had time to finish this, but I plan to do it this summer. |
(After some discussions with @dcoutts at Zurihac2013)
Two small contributions:
.cabalfile. For all unlisted module we produce a warning so users are encouraged to add the modules.Currently the module dependencies are not stored anywhere, however this might be a useful thing to do in the future if more parts of the build process require it.
GHC might fail on the -M flag in the case of cyclic dependencies. I don't want to disallow building programs with cyclic dependencies so we catch all errors in warn in the case of failure. Of course, we do continue the normal build process.
Let me know if anything is missing or things could be clearer. Thanks!