Skip to content

Conversation

@keynmol
Copy link
Contributor

@keynmol keynmol commented Mar 14, 2024

Fix two bugs in Gradle plugin.

  • Don't add plugin parameters multiple times - javac seems to consider that an error
> javac -classpath (cs fetch com.sourcegraph:semanticdb-javac:0.9.9) HelloWorld.java "-Xplugin:semanticdb -targetroot:. -sourceroot:." -Xplugin:semanticdb
error: plug-in not found: semanticdb
1 error

> javac -classpath (cs fetch com.sourcegraph:semanticdb-javac:0.9.9) HelloWorld.java "-Xplugin:semanticdb -targetroot:. -sourceroot:."
# finishes successfully
  • Anticipate "main" source set being absent and handle that gracefully

Test plan

Reproducing both failures seems difficult as I've only spotted them while working on indexing spring codebase.

keynmol added 2 commits March 14, 2024 11:31
javac seems to consider that an error, and it
can happen if there are multiple java compilation tasks
@keynmol keynmol changed the title Handle error when retrieving source set Fix bugs in Gradle integration Mar 14, 2024
@keynmol keynmol marked this pull request as ready for review March 14, 2024 12:35
Comment on lines 548 to 555
private object Logging {
def info(msg: Any*) =
System.err.println(s"[INFO] [scip-java.gradle] ${msg.mkString(" ")}")

def warn(msg: Any*) =
System.err.println(s"[INFO] [scip-java.gradle] ${msg.mkString(" ")}")

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mildly surprised that we didn't already have a standard logging functionality, given the amount of logging we have in scip-clang, I'm guessing it's not a problem here because things mostly just work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because things mostly just work

god no, things mostly don't :D

But the problem is that all failures come from Gradle and from unexpected places, and so far there hasn't been a single case where there was some sort of information we could query from Gradle that would allow us to log it and debug remotely.

So logging doesn't really help - the warnings here are for customers mostly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going forward I do want to identify bits of information that could guide investigations and log them preemptively.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😞

….scala

Co-authored-by: Varun Gandhi <varun.gandhi@sourcegraph.com>
@keynmol keynmol merged commit b866188 into main Mar 14, 2024
@keynmol keynmol deleted the gradle-plugin-fixes branch March 14, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants