diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 7edb4d6..1654b63 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -2177,7 +2177,7 @@ "moduleExtensions": { "//:extensions.bzl%graalvm": { "general": { - "bzlTransitiveDigest": "9NmT+hwMGsPsF9XQCI9vso59c+pVtfnC2OZh0+CUbMI=", + "bzlTransitiveDigest": "EAWeNOx/cefzvx+Wf0BZfIy319PSyXN+ldla18CoDsE=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { diff --git a/internal/native_image/builder.bzl b/internal/native_image/builder.bzl index 69e28c0..fc3225b 100644 --- a/internal/native_image/builder.bzl +++ b/internal/native_image/builder.bzl @@ -262,4 +262,13 @@ def assemble_native_build_options( # append extra arguments last for arg in ctx.attr.extra_args: - args.add(arg) + # Expand locations of targets in 'data' and make variables provided by 'toolchains'. + expanded_arg = ctx.expand_make_variables( + "extra_args", + ctx.expand_location(arg, ctx.attr.data), + {}, + ) + + # Skip over args that become empty after expansion but weren't before. + if expanded_arg or not arg: + args.add(expanded_arg)