-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
We have developers that are often building locally on Mac laptops but don't have a full XCode installation. The current behavior of rules_graalvm
is that it will always invoke apple_support.run
when running on MacOS, which leads to an error if a full XCode installation is not available. By bypassing it, we're able to leverage toolchains_llvm
for successful MacOS builds without XCode
My team is currently using a local patch to skip the following conditional branch where apple_support.run
is called:
rules_graalvm/internal/native_image/rules.bzl
Lines 138 to 160 in 81fc9b2
if is_macos: | |
xcode_args = ctx.actions.args() | |
# Bazel passes DEVELOPER_DIR and SDKROOT to every locally executed action that sets the | |
# environment variables passed by apple_support.run. However, Graal sanitizes the | |
# environment and removes these variables if set directly. We need to convert them into | |
# -E options and rely on apple_support's argument replacement to pass them through to the | |
# compiler invoked by Graal. | |
# https://github.com/oracle/graal/blob/77a7f6a691024d22367ae33be4da0c15ceb6a246/substratevm/src/com.oracle.svm.driver/src/com/oracle/svm/driver/NativeImage.java#L1801-L1808 | |
xcode_args.add(apple_support.path_placeholders.xcode(), format = "-EDEVELOPER_DIR=%s") | |
xcode_args.add(apple_support.path_placeholders.sdkroot(), format = "-ESDKROOT=%s") | |
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig] | |
# native-image reads the MACOSX_DEPLOYMENT_TARGET env var to determine target macos version | |
run_params["env"]["MACOSX_DEPLOYMENT_TARGET"] = str(xcode_config.minimum_os_for_platform_type(apple_common.platform_type.macos)) | |
apple_support.run( | |
actions = graal_actions, | |
apple_fragment = ctx.fragments.apple, | |
xcode_config = xcode_config, | |
xcode_path_resolve_level = apple_support.xcode_path_resolve_level.args, | |
arguments = [args, xcode_args], | |
**run_params | |
) |
Would you consider a contribution that makes this use of apple_support.run
configurable?
Metadata
Metadata
Assignees
Labels
No labels