-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add support for Incremental compilation #128
base: main
Are you sure you want to change the base?
Add support for Incremental compilation #128
Conversation
Why use source path? Nobody should ever use source path in any "smart" build tool (and Gradle, for instance but not only, uses an empty source path on purpose; see https://blog.ltgt.net/most-build-tools-misuse-javac/ for the rationale). Incremental compilation is "as easy as" putting the output location in the classpath (so the compiled classes from earlier compilation tasks are available) and passing fewer source files to compile. If you use the source path and don't include previously-compiled classes to the classpath, what you're doing is "implicit compilation" of the "missing" classes, which is entirely different, and something almost nobody does nowadays (possibly Maven under some circumstances, but I'd argue that this is either a broken build configuration or a Maven bug anyway). I don't have time to dig into how to do that with compile-testing, and/or whether it's possible already, but IMO your approach in this PR is wrong. |
You can use either source path or classpath, it's a normal option that is supported by javac. But I am really not sure of the real impact of this as actually even if the compilation is implicitly being done again, as we are talking of source/classes that didn't change. If you want we can limit this PR to search in the classpath. The PR, again, actually supports both implicit compilation or using classes that were compiled in previous builds. Let us know if you want to change this. Do you mind to turn your next comment into something positive that you ask us to do to get this merged ? And if you could answer the 2 open questions in the original PR description, it would be nice too. |
@tbroyer Did you see my comment above ? |
@tbroyer is that closer to what you asked for ? The new commit only uses classpath to provide the previously generated classes. It's more a proof of concept, the PR would need some cleanup. |
If you want my opinion (I'm not a project member, so I have no power on whether this PR will or won't be merged): I, for one, don't like incremental compilation to begin with, so I'll refrain from commenting further on whether this PR (and what you want to achieve) is a good idea or not (at the risk of not sounding much more positive this time again 😉). BTW, I think you can achieve the same API using Another approach of course, though not applicable to all use-cases, is to have the classes as part of your code ( |
@tbroyer it seems to me that using the file folder is not much better than using the Also, I tried using compiled classes for incremental testing and using the And regarding incremental annotation processing, we are actually working on that and the PR here comes from this work. |
Any news? |
Solves issue #126.
The idea is that we only needed to preserve the same file manager, and make it able to retrieve sources and classes that were already compiled.
There are 2 other things we could do starting from this PR, but I would like to get some feedback first:
IncrementalCompileTester
. Let us know if we can help, it looks like an interesting thing to code.Please note that this PR is a by-product of the research we have been doing on incremental annotation processing in the Incap project.