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
Makes shake build and cache Shakefiles by using shake itself to rebui… #525
base: master
Are you sure you want to change the base?
Conversation
…ld when nessesary, instead of just executing runhaskell on them
…to perform building and linking of the whole Shakefile, but only if necessary
…ated after dropping comments
…ly parsing dependencies
From what I can see, this only works if the Shakefile.hs doesn't import any local modules - which might lead to it not rebuilding when it should. Does that match your understanding? |
Maybe the solution is to always run |
True. I didn't consider local modules, it looks like calling ghc --make should just do the work, although calling ghc-make if it's installed should be even better. I'll give it a try tomorrow and see what I can do. |
Ok, I see the actual difficulty of this now, let's see if I got this straight: -Just calling "ghc --make" implies linking every single time, that makes this approach quite slow and not very much viable. -On the other hand, getting the dependencies of Shakefile.hs beforehand and then use shake itself to decide when compiling or linking are needed can get quite complex, since it includes parsing the .hs files. -Or actually isn't it, since those dependencies are exactly what ghc-make is getting when parsing the Makefile generated by ghc -M |
|
Alright, that makes perfect sense to me. I'll be commiting soon. |
After some investigation and coding I found out that, at least on version 7.10.3, The best solution I could come up with is using The parsing of the Makefile is a bit dependant on how ghc formats it, but I tried to make it as resilient as possible by dropping comments and consuming white spaces. |
Sorry for taking a long time to respond... I'm unconvinced GHC relinks every time with ghc --make (this was a bug with GHC 6.4 if you omitted the |
It seems like there are a bunch of options:
So only 2 and 4 make sense, and we're trading 0.6s vs 3.5s first and 0.15s subsequently. The other disadvantage of 4 is it writes to the file system. If those numbers are typical, I'd suggest we stick with 2. If those numbers change to be quite large quite rapidly for even moderately sized build systems, I'd go with 4. Do you have any measurements for the build system you wrote? |
…ld when nessesary, instead of just executing runhaskell on them