Skip to content

Commit

Permalink
fix: modern rule check
Browse files Browse the repository at this point in the history
- fix: explicitly check against modern rule status before resolving
  toolchain, unconditionally take it if running modern

applies on top of #70

Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Sep 1, 2023
1 parent 5e2899d commit a0c767a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/native_image/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,15 @@ def _graal_binary_implementation(ctx):
direct_inputs = []
transitive_inputs = [classpath_depset]

if graal_attr == None:
# if we aren't handed a specific `native-image` tool binary, or we are running
# under the modern `native_image` rule, then attempt to resolve via toolchains...
if graal_attr == None or not (ctx.attr._legacy_rule):
# resolve via toolchains
info = ctx.toolchains[_GVM_TOOLCHAIN_TYPE].graalvm
graal_attr = info.native_image_bin

# but fall back to explicitly-provided tool, which should override, with the
# remainder of the resolved toolchain present
graal_attr = graal_attr or info.native_image_bin
gvm_toolchain = info
extra_tool_deps.append(info.gvm_files)

Expand Down Expand Up @@ -263,6 +268,7 @@ def _graal_binary_implementation(ctx):
args.add("-H:+JNI")

inputs = depset(direct_inputs, transitive = transitive_inputs)

run_params = {
"outputs": [binary],
"arguments": [args],
Expand Down

0 comments on commit a0c767a

Please sign in to comment.