-
Notifications
You must be signed in to change notification settings - Fork 45
Support mixed Java/Scala modules using Java annotation processors #159
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
Conversation
Thank you for the contribution! I'm a bit hesitant to add this to the project, for a few reasons:
Given that, I'm not even sure that Lombok is compatible with the preferred way of compiling mixed projects, regardless of the usage of scoverage. I would perhaps seek their help in first making it compatible, and that would perhaps solve the issue here as well.
|
As you say, there are some things one needs to consider when using Java annotation processors. The default configuration of the Gradle Scala plugin is to compile Java with the |
I missed that part in their documentation. In any case, they do recommend using the gradle plugin (though I'm not sure that matters).
I'm not familiar with Java annotation processing, but from what I gather, it is a Java compiler feature which is not supported by the Scala compiler (without even considering scoverage). See this question in the Gradle forums (though it's an old question and things might have changed) and this relatively recent issue in the gradle repostiory. Furthermore, I see here a mentioning of Lombok being an exceptional annotation processor (I'm not sure it matters):
In any case, I'm not sure how does coverage breaks your build if you have a separate source directory with all the sources that require annotation processing. If I'm not mistaken, you could define a custom java compilation task to compile these source files, and make the scala compilation task (not even scoverage) depend on it. Would this not work? |
It does that, because it copies the You can see that in action when you revert the line I added to copy over the
it fails with the following error:
As you can see, the non-scoverage tasks
That might well work, but it would be a workaround. |
I see now. Thank you for being patience and working hard on explaining the situation at hand. Overall I'm happy that we have some sort of documentation for this issue. May I add two requests to the PR?
|
e3c162e
to
d48486e
Compare
Already done. But it seems CI is working again.
Done. If you'd like to phrase the comment differently, just let me know. |
d48486e
to
cc77b81
Compare
It's looking good :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
As I said before, I really appreciate your patience and willingness to explain the reasoning behind this PR.
deployed 6.1.0 with this PR - thanks both |
We use an annotation processor (lombok) on some Java files in a combined Java/Scala module.
When we tried running scoverage on that module, we noticed that the
compileScoverage*
tasks failed because the annotation processor wasn't being run, even though the non-scoveragecompile*
tasks succeed.This PR changes the scoverage compile task to inherit the
annotationProcessorPath
from the original compile task, in addition tocompileClasspath
andruntimeClasspath
.That fixes the compilation problem we observed.
I'm not sure this is the best solution to this problem, so please let me know if you can think of a better one.