From 6adba3ba33ec834b9671d03ab823225639724f99 Mon Sep 17 00:00:00 2001 From: Googler Date: Wed, 29 Jun 2016 17:25:27 +0000 Subject: Rollback of commit 368cc56fb2baa3e21be4acdd2410a4ce8245de93. *** Reason for rollback *** Broke builds that use apple_genrule. *** Original change description *** Move platform environment from xcrun_action to apple_action. This change ensures that scripts that don't need to be wrapped with xcrun_action (like actoolwrapper, ibtoolwrapper, and friends, because they internally invoke xcrunwrapper) also have the Xcode version and platform envvars set. RELNOTES: -- MOS_MIGRATED_REVID=126205606 --- tools/build_defs/apple/shared.bzl | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'tools/build_defs/apple') diff --git a/tools/build_defs/apple/shared.bzl b/tools/build_defs/apple/shared.bzl index 6118fd7926..976911b177 100644 --- a/tools/build_defs/apple/shared.bzl +++ b/tools/build_defs/apple/shared.bzl @@ -47,11 +47,6 @@ def module_cache_path(ctx): def apple_action(ctx, **kw): """Creates an action that only runs on MacOS/Darwin. - This function also passes to the action the necessary environment variables - that control the Xcode version and platform to build for. - - Rules that use this action must require the "apple" configuration fragment. - Call it similar to how you would call ctx.action: apple_action(ctx, outputs=[...], inputs=[...],...) """ @@ -59,22 +54,21 @@ def apple_action(ctx, **kw): execution_requirements += DARWIN_EXECUTION_REQUIREMENTS kw['execution_requirements'] = execution_requirements - platform = ctx.fragments.apple.ios_cpu_platform() - action_env = ctx.fragments.apple.target_apple_env(platform) \ - + ctx.fragments.apple.apple_host_system_env() - kw['env'] = kw.get('env', {}) + action_env - ctx.action(**kw) def xcrun_action(ctx, **kw): """Creates an apple action that executes xcrunwrapper. - Rules that use this action must require the "apple" configuration fragment. - args: ctx: The context of the rule that owns this action. This method takes the same keyword arguments as ctx.action, however you don't need to specify the executable. """ + platform = ctx.fragments.apple.ios_cpu_platform() + action_env = ctx.fragments.apple.target_apple_env(platform) \ + + ctx.fragments.apple.apple_host_system_env() + env = kw.get('env', {}) + kw['env'] = env + action_env + apple_action(ctx, executable=ctx.executable._xcrunwrapper, **kw) -- cgit v1.2.3