Skip to content

Commit

Permalink
Compute the SemanticDB target root correctly
Browse files Browse the repository at this point in the history
In Bazel, `File#short_path` is prefixed with `..` if the file belongs to
an external repository. However, this isn't meant to be interpreted as a
relative path, as external repositories' outputs are in the `external`
output directory.

This meant that when `semanticdb_bundle` was enabled and external
repositories contained Scala rules, they'd fail to build, since the
`-P:semanticdb:sourceroot` or `-semanticdb-target` compiler options
would be computed incorrectly.
  • Loading branch information
Jaden Peterson committed Nov 19, 2024
1 parent ae550b8 commit 222acba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rules/private/phases/phase_semanticdb.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def _semanticdb_directory_from_file(file):
nested function closure by default.
"""

return "{}/{}".format(file.root.path, file.short_path[:file.short_path.find("META-INF") - 1])
return file.path[:file.path.find("META-INF") - 1]

#
# PHASE: semanticdb
Expand Down

0 comments on commit 222acba

Please sign in to comment.