Skip to content
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

Enable cross-repo navigation. #166

Merged
merged 1 commit into from
Apr 16, 2021
Merged

Conversation

olafurpg
Copy link
Member

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.

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
Member 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 😆

@@ -74,6 +74,7 @@ public SemanticdbVisitor(

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
Member 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