Skip to content

Commit

Permalink
Prepare for --incompatible_use_toolchain_providers_in_java_common
Browse files Browse the repository at this point in the history
  • Loading branch information
cushon committed Mar 6, 2019
1 parent f3113fb commit 4c03f63
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scala/private/rule_impls.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ load(
"write_manifest",
)
load("@io_bazel_rules_scala//scala:jars_to_labels.bzl", "JarsToLabelsInfo")
load("@bazel_tools//tools/jdk:toolchain_utils.bzl", "find_java_runtime_toolchain", "find_java_toolchain")

_java_extension = ".java"

Expand Down Expand Up @@ -363,17 +364,16 @@ def try_to_compile_java_jar(
ctx,
ctx.attr.javacopts + ctx.attr.javac_jvm_flags +
java_common.default_javac_opts(
ctx,
java_toolchain_attr = "_java_toolchain",
java_toolchain = ctx.attr._java_toolchain[java_common.JavaToolchainInfo],
),
),
deps = providers_of_dependencies,
#exports can be empty since the manually created provider exposes exports
#needs to be empty since we want the provider.compile_jars to only contain the sources ijar
#workaround until https://github.com/bazelbuild/bazel/issues/3528 is resolved
exports = [],
java_toolchain = ctx.attr._java_toolchain,
host_javabase = ctx.attr._host_javabase,
java_toolchain = find_java_toolchain(ctx, ctx.attr._java_toolchain),
host_javabase = find_java_runtime_toolchain(ctx, ctx.attr._host_javabase),
strict_deps = ctx.fragments.java.strict_java_deps,
)
return struct(
Expand Down Expand Up @@ -468,7 +468,7 @@ def _compile_or_empty(
ctx.actions,
jar = ctx.outputs.jar,
target_label = ctx.label,
java_toolchain = ctx.attr._java_toolchain,
java_toolchain = find_java_toolchain(ctx, ctx.attr._java_toolchain),
)
else:
# macro code needs to be available at compile-time,
Expand Down Expand Up @@ -867,8 +867,8 @@ def _pack_source_jars(ctx):
output_jar = ctx.outputs.jar,
sources = scala_sources,
source_jars = bundled_source_jars,
java_toolchain = ctx.attr._java_toolchain,
host_javabase = ctx.attr._host_javabase,
java_toolchain = find_java_toolchain(ctx, ctx.attr._java_toolchain),
host_javabase = find_java_runtime_toolchain(ctx, ctx.attr._host_javabase),
)
if scala_source_jar:
source_jars.append(scala_source_jar)
Expand Down

0 comments on commit 4c03f63

Please sign in to comment.