Skip to content

Conversation

@olafurpg
Copy link
Contributor

Previously, lsif-java was only able to index a single repositories. It
was not possible to navigate between repositories. Now, the emitted LSIF
contains packageInformation nodes that document how to link LSIF
indexes between repositories.

Rough summary of the changes in this commit:

  • New LsifBuildTool that we use to index *-sources.jar of
    Java libraries and the JDK sources.
  • New ClasspathEntry class to represent a Maven library. We extract
    ClasspathEntry values from the build via text files in the
    SemanticDB targetroot.
  • Miscellaneous small bugfixes while indexing the JDK and Guava.
  • Fixes Exception indexing google/guava repo from parsing descriptor from a local symbol #150.
  • Improved error reporting to debug issues in the javac wrapper that
    we use for Gradle and Maven.

@olafurpg olafurpg requested a review from Strum355 April 16, 2021 10:41
@olafurpg olafurpg self-assigned this Apr 16, 2021
@olafurpg olafurpg force-pushed the pkg-info branch 2 times, most recently from d01703e to e5920f3 Compare April 16, 2021 11:26
Previously, lsif-java was only able to index a single repositories. It
was not possible to navigate between repositories. Now, the emitted LSIF
contains `packageInformation` nodes that document how to link LSIF
indexes between repositories.

Rough summary of the changes in this commit:

- New `LsifBuildTool` that we use to index `*-sources.jar` of
  Java libraries and the JDK sources.
- New `ClasspathEntry` class to represent a Maven library. We extract
  `ClasspathEntry` values from the build via text files in the
  SemanticDB targetroot.
- Miscellaneous small bugfixes while indexing the JDK and Guava.
- Fixes sourcegraph#150.
- Improved error reporting to debug issues in the `javac` wrapper that
  we use for Gradle and Maven.
Comment on lines +109 to +117
| def artifactType = org.gradle.api.attributes.Attribute.of("artifactType", String.class)
| def attributeType = "jar"
| if (config.canBeResolved) {
| def artifacts = config.incoming.artifactView { view ->
| view.lenient = true
| view.attributes { container ->
| container.attribute(artifactType, attributeType)
| }
| }.artifacts
Copy link
Contributor

Choose a reason for hiding this comment

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

Really interesting! How did you come across this solution?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Damn, wish I knew of this many months ago 😆


private <T extends JCTree & JCDiagnostic.DiagnosticPosition> void emitSymbolOccurrence(
Symbol sym, T posTree, Role role, CompilerRange kind) {
if (sym == null) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an issue you came across?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, hit on three NPEs when compiling the JDK

Copy link
Contributor

@Strum355 Strum355 left a comment

Choose a reason for hiding this comment

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

🎉 awesome work! A lot to unpack here but LGTM 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception indexing google/guava repo from parsing descriptor from a local symbol

2 participants