diff --git a/src/tools/singlejar/BUILD b/src/tools/singlejar/BUILD index e60b5187b32ea1..625f006ce675fd 100644 --- a/src/tools/singlejar/BUILD +++ b/src/tools/singlejar/BUILD @@ -1,6 +1,5 @@ load("@rules_java//java:defs.bzl", "java_library") load("//src:release_archive.bzl", "release_archive") -load("//third_party/ijar:darwin_universal_binary.bzl", "darwin_universal_binary") # Description: # singlejar C++ implementation. @@ -65,7 +64,7 @@ release_archive( release_archive( name = "singlejar_deploy_zip", - srcs = [":singlejar_local_binary_for_deploy"], + srcs = [":singlejar_local"], package_dir = "java_tools/src/tools/singlejar", visibility = ["//src:__pkg__"], ) @@ -89,20 +88,6 @@ cc_binary( ], ) -alias( - name = "singlejar_local_binary_for_deploy", - actual = select({ - "//src/conditions:darwin": ":singlejar_local_darwin", - "//conditions:default": ":singlejar_local", - }), -) - -darwin_universal_binary( - name = "singlejar_local_darwin", - binary = ":singlejar_local", - output_name = "singlejar_local", -) - cc_binary( name = "singlejar_local", srcs = [ diff --git a/third_party/ijar/BUILD b/third_party/ijar/BUILD index 9a5fb22a4e958b..28f05bf44366da 100644 --- a/third_party/ijar/BUILD +++ b/third_party/ijar/BUILD @@ -1,5 +1,3 @@ -load(":darwin_universal_binary.bzl", "darwin_universal_binary") - package( default_visibility = [ "//src:__subpackages__", @@ -78,12 +76,6 @@ cc_binary( deps = [":zip"], ) -darwin_universal_binary( - name = "zipper_darwin", - binary = ":zipper", - output_name = "zipper", -) - cc_binary( name = "ijar", srcs = [ @@ -94,12 +86,6 @@ cc_binary( deps = [":zip"], ) -darwin_universal_binary( - name = "ijar_darwin", - binary = ":ijar", - output_name = "ijar", -) - filegroup( name = "srcs", srcs = glob(["**"]) + ["//third_party/ijar/test:srcs"], @@ -119,7 +105,6 @@ filegroup( "zlib_client.cc", "zlib_client.h", "BUILD", - "darwin_universal_binary.bzl", ] + select({ "//src:windows": [ "mapped_file_windows.cc", @@ -152,16 +137,10 @@ genrule( genrule( name = "ijar_deploy_zip", - srcs = select({ - "//src/conditions:darwin": [ - ":ijar_darwin", - ":zipper_darwin", - ], - "//conditions:default": [ - ":ijar", - ":zipper", - ], - }), + srcs = [ + ":ijar", + ":zipper", + ], outs = ["ijar_deploy.zip"], cmd = "$(location //src:zip_files) java_tools/ijar $@ $(SRCS)", tools = ["//src:zip_files"], @@ -179,8 +158,3 @@ genrule( tools = ["//src:zip_files"], visibility = ["//visibility:private"], ) - -exports_files( - ["darwin_universal_binary.bzl"], - visibility = ["//src/tools/singlejar:__pkg__"], -) diff --git a/third_party/ijar/darwin_universal_binary.bzl b/third_party/ijar/darwin_universal_binary.bzl deleted file mode 100644 index ba7359e88c1ece..00000000000000 --- a/third_party/ijar/darwin_universal_binary.bzl +++ /dev/null @@ -1,61 +0,0 @@ -""" Defines a rule to package multi-arch binaries for darwin in a single fat binary - -Uses the lipo tool as described here: https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary#Update-the-Architecture-List-of-Custom-Makefiles -""" - -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( - 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"], - exec_compatible_with = ["@platforms//os:macos"], -)