-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add darwin_arm64 java_tools #16960
Closed
Closed
Add darwin_arm64 java_tools #16960
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fc931ff
Make universal binary for darwin java_tools
hvadehra f459da5
Mark the universal binary rule to be exec_compatible_with macos
hvadehra c636f8a
Hide darwin_universal_binary.bzl in //src/tools/singlejar
hvadehra e8fb870
Revert whitespace change
hvadehra 5365d0d
Fix reference in third_party/ijar/BUILD
hvadehra e61054e
Fix reference in third_party/ijar/BUILD
hvadehra dc0c5ac
Invert dep direction, with darwin_universal_binary.bzl in third_party…
hvadehra b10f3ab
Merge branch 'master' into hvadehra-java_tools_darwin_arm64
hvadehra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
def _universal_split_transition_impl(ctx, attr): | ||
return { | ||
"x86_64" : { | ||
"//command_line_option:cpu": "darwin_x86_64", | ||
}, | ||
"arm64" : { | ||
"//command_line_option:cpu": "darwin_arm64", | ||
} | ||
} | ||
|
||
_universal_split_transition = transition( | ||
implementation = _universal_split_transition_impl, | ||
inputs = [], | ||
outputs = ["//command_line_option:cpu"], | ||
) | ||
|
||
def _impl(ctx): | ||
binaries = [ | ||
attr.files.to_list()[0] for attr in ctx.split_attr.binary.values() | ||
] | ||
out = ctx.actions.declare_file(ctx.label.name + "/" + ctx.attr.output_name) | ||
args = ctx.actions.args() | ||
args.add("-create") | ||
args.add_all(binaries) | ||
args.add("-output", out) | ||
apple_env = {} | ||
xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig] | ||
apple_env.update(apple_common.apple_host_system_env(xcode_config)) | ||
apple_env.update( | ||
apple_common.target_apple_env( | ||
xcode_config, | ||
ctx.fragments.apple.multi_arch_platform(apple_common.platform_type.macos), | ||
), | ||
) | ||
ctx.actions.run( | ||
executable = "/usr/bin/lipo", | ||
arguments = [args], | ||
inputs = binaries, | ||
outputs = [out], | ||
execution_requirements = xcode_config.execution_info(), | ||
env = apple_env, | ||
) | ||
return DefaultInfo(executable = out) | ||
|
||
darwin_universal_binary = rule( | ||
hvadehra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
implementation = _impl, | ||
attrs = { | ||
"output_name" : attr.string(), | ||
"binary": attr.label(cfg = _universal_split_transition), | ||
"_xcode_config": attr.label(default = "@bazel_tools//tools/osx:current_xcode_config"), | ||
"_allowlist_function_transition": attr.label(default = "@bazel_tools//tools/allowlists/function_transition_allowlist"), | ||
}, | ||
fragments = ["apple"], | ||
hvadehra marked this conversation as resolved.
Show resolved
Hide resolved
|
||
exec_compatible_with = ["@platforms//os:macos"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't support platformization, which we'll need to update when we turn it on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also set
--platforms
flag to match the cpu. This then won't cause problems when we flip--incompatible_enable_cc_toolchain_resolution