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

Don't generate SemanticDB for generated or external sources #79

Conversation

jadenPete
Copy link

Previously, we only checked if a source ended with the "scala" extension before adding it to SemanticDbInfo. However, we don't want to generate SemanticDB files for generated files or external files, because they'll have the output directory (beginning with bazel-out) in their paths, which isn't guaranteed to be consistent.

Also, tell the SemanticDB compiler plugin to generate SemanticDB outside of the output JAR, even if we don't want SemanticDB generated for any of the sources. That way, the output JAR won't include SemanticDB files we don't want.

@jadenPete jadenPete requested review from jjudd and ryan28561 January 27, 2025 23:31
@jadenPete jadenPete self-assigned this Jan 27, 2025
if (
source.extension == "scala" and \
source.is_source and \
source.owner.workspace_name == ctx.label.workspace_name

Choose a reason for hiding this comment

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

since I'm seeing the word workspace here, is this bazel 8 compatible?

Copy link
Author

Choose a reason for hiding this comment

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

Actually, it's not. Good catch. It seems it was deprecated in favor of the more accurately named repo_name:
https://bazel.build/rules/lib/builtins/Label#workspace_name

I'll correct this.

@ryan28561 ryan28561 self-requested a review January 27, 2025 23:40
@jadenPete jadenPete force-pushed the dont-generate-semanticdb-for-generated-or-external-sources branch from b3630c0 to 3723c3a Compare January 29, 2025 15:47
@jadenPete
Copy link
Author

Squashed.

@jadenPete jadenPete force-pushed the dont-generate-semanticdb-for-generated-or-external-sources branch from 09830b0 to 5f84626 Compare January 29, 2025 16:02
@jadenPete
Copy link
Author

Squashed.

Previously, we only checked if a source ended with the "scala" extension
before adding it to `SemanticDbInfo`. However, we don't want to generate
SemanticDB files for generated files or external files, because they'll
have the output directory (beginning with `bazel-out`) in their paths,
which isn't guaranteed to be consistent.

Also, tell the SemanticDB compiler plugin to generate SemanticDB outside
of the output JAR, even if we don't want SemanticDB generated for any of
the sources. That way, the output JAR won't include SemanticDB files we
don't want.
@jadenPete jadenPete force-pushed the dont-generate-semanticdb-for-generated-or-external-sources branch from 6f3b476 to 1a8dcb0 Compare January 29, 2025 19:02
@jadenPete
Copy link
Author

Squashed.

@jadenPete jadenPete merged commit 6c7b46c into lucid-master Jan 29, 2025
1 check passed
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.

2 participants