Skip to content

Commit 62df280

Browse files
Don't create a subpath for extracted_srcjar (#767)
This avoids an issue where we declare output to be a prefix of the rule
1 parent c3ab8ea commit 62df280

File tree

2 files changed

+15
-6
lines changed
  • examples/bazel-example/src/main/java/srcjar_example
  • scip-java/src/main/resources/scip-java

2 files changed

+15
-6
lines changed

examples/bazel-example/src/main/java/srcjar_example/BUILD

+9
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ java_library(
2626
":generated-srcjar",
2727
],
2828
)
29+
30+
java_test(
31+
name = "testing_test",
32+
srcs = [
33+
"Foo.java",
34+
":generated-srcjar",
35+
],
36+
test_class = "Foo",
37+
)

scip-java/src/main/resources/scip-java/scip_java.bzl

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ different contents.
99
This aspect is needed for scip-java to inspect the structure of the Bazel build
1010
and register actions to index all java_library/java_test/java_binary targets.
1111
The result of running this aspect is that your bazel-bin/ directory will contain
12-
many *.scip (https://github.com/sourcegraph/scip) and
12+
many *.scip (https://github.com/sourcegraph/scip) and
1313
*.semanticdb (https://scalameta.org/docs/semanticdb/specification.html) files.
1414
These files encode information about which symbols are referenced from which
1515
locations in your source code.
@@ -66,13 +66,13 @@ def _scip_java(target, ctx):
6666

6767
if len(source_files) == 0:
6868
return None
69-
69+
7070
output_dir = []
7171

7272
for source_jar in source_jars:
73-
dir = ctx.actions.declare_directory(ctx.label.name + "/extracted_srcjar/" + source_jar.short_path)
73+
dir = ctx.actions.declare_directory(ctx.label.name + ".extracted_srcjar/" + source_jar.short_path)
7474
output_dir.append(dir)
75-
75+
7676
ctx.actions.run_shell(
7777
inputs = javac_action.inputs,
7878
outputs = [dir],
@@ -99,7 +99,7 @@ def _scip_java(target, ctx):
9999

100100
launcher_javac_flags = []
101101
compiler_javac_flags = []
102-
102+
103103
# In different versions of bazel javac options are either a nested set or a depset or a list...
104104
javac_options = []
105105
if hasattr(compilation, "javac_options_list"):
@@ -108,7 +108,7 @@ def _scip_java(target, ctx):
108108
javac_options = compilation.javac_options
109109

110110
for value in javac_options:
111-
# NOTE(Anton): for some bizarre reason I see empty string starting the list of
111+
# NOTE(Anton): for some bizarre reason I see empty string starting the list of
112112
# javac options - which then gets propagated into the JSON config, and ends up
113113
# crashing the actual javac invokation.
114114
if value != "":

0 commit comments

Comments
 (0)