Skip to content

Commit

Permalink
Improve compatibility with different Bazel versions
Browse files Browse the repository at this point in the history
  • Loading branch information
antonsviridov-src committed Oct 10, 2024
1 parent 27e9fc6 commit 187e67b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 10 additions & 3 deletions scip-java/src/main/resources/scip-java/scip_java.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _scip_java(target, ctx):
output_dir = []

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

ctx.actions.run_shell(
Expand Down Expand Up @@ -99,8 +99,15 @@ def _scip_java(target, ctx):

launcher_javac_flags = []
compiler_javac_flags = []

for value in compilation.javac_options_list:

# In different versions of bazel javac options are either a nested set or a depset or a list...
javac_options = []
if hasattr(compilation, "javac_options_list"):
javac_options = compilation.javac_options_list
else:
javac_options = compilation.javac_options.to_list()

for value in javac_options:
# NOTE(Anton): for some bizarre reason I see empty string starting the list of
# javac options - which then gets propagated into the JSON config, and ends up
# crashing the actual javac invokation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ class ScipBuildTool(index: IndexCommand) extends BuildTool("SCIP", index) {
/** Recursively collects all Java files in the working directory */
private def collectAllSourceFiles(config: Config, dir: Path): List[Path] = {
if (config.sourceFiles.nonEmpty) {
println(config.sourceFiles)
config
.sourceFiles
.flatMap { relativePath =>
Expand Down

0 comments on commit 187e67b

Please sign in to comment.