Skip to content

Commit 187e67b

Browse files
Improve compatibility with different Bazel versions
1 parent 27e9fc6 commit 187e67b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def _scip_java(target, ctx):
7070
output_dir = []
7171

7272
for source_jar in source_jars:
73-
dir = ctx.actions.declare_directory("extracted_" + source_jar.basename)
73+
dir = ctx.actions.declare_directory("extracted_srcjar/" + source_jar.short_path)
7474
output_dir.append(dir)
7575

7676
ctx.actions.run_shell(
@@ -99,8 +99,15 @@ def _scip_java(target, ctx):
9999

100100
launcher_javac_flags = []
101101
compiler_javac_flags = []
102-
103-
for value in compilation.javac_options_list:
102+
103+
# In different versions of bazel javac options are either a nested set or a depset or a list...
104+
javac_options = []
105+
if hasattr(compilation, "javac_options_list"):
106+
javac_options = compilation.javac_options_list
107+
else:
108+
javac_options = compilation.javac_options.to_list()
109+
110+
for value in javac_options:
104111
# NOTE(Anton): for some bizarre reason I see empty string starting the list of
105112
# javac options - which then gets propagated into the JSON config, and ends up
106113
# crashing the actual javac invokation.

scip-java/src/main/scala/com/sourcegraph/scip_java/buildtools/ScipBuildTool.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,6 @@ class ScipBuildTool(index: IndexCommand) extends BuildTool("SCIP", index) {
718718
/** Recursively collects all Java files in the working directory */
719719
private def collectAllSourceFiles(config: Config, dir: Path): List[Path] = {
720720
if (config.sourceFiles.nonEmpty) {
721-
println(config.sourceFiles)
722721
config
723722
.sourceFiles
724723
.flatMap { relativePath =>

0 commit comments

Comments
 (0)