Make the Apple Skylark rule be able to fetch environment data from the
xcode_config rule in addition to ctx.fragments.apple .
Subsequent Bazel versions won't support these methods on ctx.fragments.apple
and thus need to be updated.
Progress towards .
RELNOTES: None.
@@ -74,8 +74,10 @@ def xcrun_env(ctx):
"""Returns the environment dictionary necessary to use xcrunwrapper."""
platform = ctx.fragments.apple.single_arch_platform
- action_env = ctx.fragments.apple.target_apple_env(platform) \
- + ctx.fragments.apple.apple_host_system_env()
+ environment_supplier = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
+ if not hasattr(environment_supplier, "apple_host_system_env"):
+ environment_supplier = ctx.fragments.apple
+ action_env = environment_supplier.target_apple_env(platform) + environment_supplier.apple_host_system_env()
return action_env
