-
Notifications
You must be signed in to change notification settings - Fork 202
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
Scala/Java mixed projects fail to compile using processorpath bloop + metals #2059
Comments
Hi @gersonsosa Not sure if you were saying that you'd like to look at or fix this yourself. If so, the code responsible for adding the semanticdb plugin is here... bloop/frontend/src/main/scala/bloop/data/Project.scala Lines 477 to 504 in 7a7a913
Currently it adds the semanticdb plugin to the classpath and adds various javac options. I guess it could test to see if I note here that it's recommended to use the classpath unless you're using annotation processors so I don't know if there would be an issue moving to It would also need to be changed in Metals here... and possibly here but I don't know this area... |
It looks correct what @Arthurm1 wrote. Let us know if you are interesting in helping out! If you can't, it would be awesome if you created a small repro that we can take a look like. So probably a small project that uses a preprocessor. |
@Arthurm1 @tgodzik thanks for your response, sure I’m in for helping out, while playing with the code it seems that with the changes in bloop
things run smooth once again. What I would like some guidance is if I can include a sample project for example here as a test in the code or it would be best to just test the parts I change independently and where should I put those tests additionally I haven’t checked metals code but I can give a try after having a PR for bloop. |
I think using a sample project is perfectly fine, we already have some tests that use it. For example in the BspProtocolSuite. We have a method that loads up those test project ( |
To elaborate on why I'm not sure I have to change metals usages of javac I think the parts where metals compile java sources using
I added a small test to a branch here it seems to work as expected https://github.com/gersonsosa/metals/tree/fix-java-options-processorpath |
@gersonsosa I think you're right. It looks like the on-the-fly generation ignores the java options. I'm looking to try to change how this code works so I'd recommend not bothering to change Metals. |
Hello folks, hope everything is good on your end.
I'm facing an issue with bloop + metals since a few months ago, here is the overall description
After issuing
bloopInstall
in my gradle project and starting metals, bloop fails to compile for scala/java mixed projects that include a "-processorpath" with an error.I would expect that the build succeeds after starting metals, in fact it does before I start metals, the reason that this happens is that metals creates the .bloop/bloop-settings.json file with semanticdb configuration for java.
However after trying a lot of things with it, I found a way to workaround the issue by appending the semanticdb plugin path to the already existing
-processorpath
entry in the corresponding bloop config file for the project.So it goes from this
to this
And with that it succeeds, apparently java compiler only searches for a compiler plugin processor in the classpath if you leave out the "-processorpath" option.
So I bug into the code and I see some places where semanticbd options are attached in memory, but I wanted to have some guidance on where to start to create a minimal repo to reproduce the issue, including a failing test in the project.
I'm running on macOS
Gradle version 7.5.1
Gradle bloop version: ch.epfl.scala:gradle-bloop_2.12:1.5.3, also tested with ch.epfl.scala:gradle-bloop_2.13:1.6.0
Bloop version: 1.5.4, also tested with 1.5.6
Thanks for reading until here!
Cheers
The text was updated successfully, but these errors were encountered: