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

Add SemanticDB support - cont. #1508

Merged
merged 42 commits into from
Oct 2, 2023
Merged

Conversation

crt-31
Copy link
Contributor

@crt-31 crt-31 commented Aug 9, 2023

Description

Adds Semanticdb output capability

This PR extends the PR drafts #1467 and #1329, and as such builds on the great work so far by @olafurpg and @ricochet1k, and @aishfenton. In particular, this PR moves the semanticddb handling into a phase instead of the scalacworker, as well as some other improvements.

Features

  • Semanticdb output can be enabled on a toolchain by settting scala_toolchain.enable_semanticdb. Default is False for performance reasons (generating semanticdb adds considerable overhead to a build).
    • Works with setup_scala_toolchain() too
  • Scala 2 & 3 is supported.
  • By default, Semanticdb files are output to a semanticdb folder. Also supports bundling of semanticdb files inside the output jar if desired.
  • 3rd party tooling can obtain Semanticdb information (i.e. directory containing the semanticdb files) through a SemanticdbInfo Provider (i.e. using an aspect). Example included.

Motivation

Semanticdb is needed by many tools and IDEs (i.e. Metals, Scalafix, etc). This will hopefully support integration of more tools with rules_scala and help accelerate its usage in the community.

olafurpg and others added 30 commits August 18, 2022 12:50
This reverts commit cb07f15.
This reverts commit 993aa30.
Also bump versions of its dependencies:
* org.ow2.asm:asm: 6.1.1 -> 9.0
* net.sf.jopt-simple:jopt-simple: 4.6 -> 5.0.4
@johnynek
Copy link
Member

I hope we can merge this soon. It's been a long-missing capability.

@liucijus
Copy link
Collaborator

@crt-31 sorry for the delay with a review. I'm currently on my PTO, I'll do a proper review after two weeks if this can wait.

I quickly went over changes - implementation looks good. I want to do some testing and a bit of naming nit-picking when I'll be back for a proper review.

Copy link
Collaborator

@liucijus liucijus left a comment

Choose a reason for hiding this comment

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

Thanks a lot @crt-31, please address nits

docs/scala_toolchain.md Outdated Show resolved Hide resolved
examples/semanticdb/README.md Show resolved Hide resolved
scala/private/macros/setup_scala_toolchain.bzl Outdated Show resolved Hide resolved
scala/BUILD Outdated Show resolved Hide resolved
third_party/repositories/scala_2_12.bzl Show resolved Hide resolved
- fixed semanticdb example
- added prefix '_' to semanticdb output path
- renamed certain vars to not prepend with "scala_"
- changed depsprovider var name to be plural instead of singular
@crt-31
Copy link
Contributor Author

crt-31 commented Sep 14, 2023

@liucijus, are you able to rerun the CI tests for this PR? It seems to have hung for some reason.

@liucijus
Copy link
Collaborator

@liucijus, are you able to rerun the CI tests for this PR? It seems to have hung for some reason.

Unfortunately, no, but let's ignore it as it's flaky

Copy link
Collaborator

@liucijus liucijus left a comment

Choose a reason for hiding this comment

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

Thanks @crt-31!

@liucijus liucijus merged commit ee6c91d into bazelbuild:master Oct 2, 2023
1 of 2 checks passed
@nigredo-tori nigredo-tori mentioned this pull request Oct 2, 2023
7 tasks
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.

8 participants