From 8ac371c81fc3e7190b358bddb255591466d6ff37 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 12 Jan 2024 11:52:20 -0800 Subject: [PATCH] Remove more bitcode support --- apple/internal/BUILD | 8 ---- apple/internal/bitcode_support.bzl | 38 --------------- apple/internal/partials/BUILD | 1 - apple/internal/partials/framework_import.bzl | 7 +-- apple/internal/partials/swift_dylibs.bzl | 50 ++++++++------------ 5 files changed, 20 insertions(+), 84 deletions(-) delete mode 100644 apple/internal/bitcode_support.bzl diff --git a/apple/internal/BUILD b/apple/internal/BUILD index 0349cc73eb..b9703f21a6 100644 --- a/apple/internal/BUILD +++ b/apple/internal/BUILD @@ -408,14 +408,6 @@ bzl_library( ], ) -bzl_library( - name = "bitcode_support", - srcs = ["bitcode_support.bzl"], - visibility = [ - "//apple:__subpackages__", - ], -) - bzl_library( name = "partials", srcs = ["partials.bzl"], diff --git a/apple/internal/bitcode_support.bzl b/apple/internal/bitcode_support.bzl deleted file mode 100644 index 4f09a5350f..0000000000 --- a/apple/internal/bitcode_support.bzl +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2020 The Bazel Authors. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Bitcode support.""" - -def _bitcode_mode_string(apple_fragment): - """Returns a string representing the current Bitcode mode.""" - - bitcode_mode = apple_fragment.bitcode_mode - if not bitcode_mode: - fail("Internal error: Can't figure out bitcode_mode from apple " + - "fragment") - - bitcode_mode_string = str(bitcode_mode) - bitcode_modes = ["embedded", "embedded_markers", "none"] - if bitcode_mode_string in bitcode_modes: - return bitcode_mode_string - - fail("Internal error: expected bitcode_mode to be one of: " + - "{}, but got '{}'".format( - bitcode_modes, - bitcode_mode_string, - )) - -bitcode_support = struct( - bitcode_mode_string = _bitcode_mode_string, -) diff --git a/apple/internal/partials/BUILD b/apple/internal/partials/BUILD index 2b41fda35e..7d766731e7 100644 --- a/apple/internal/partials/BUILD +++ b/apple/internal/partials/BUILD @@ -188,7 +188,6 @@ bzl_library( ], deps = [ "//apple:providers", - "//apple/internal:bitcode_support", "//apple/internal:codesigning_support", "//apple/internal:intermediates", "//apple/internal:processor", diff --git a/apple/internal/partials/framework_import.bzl b/apple/internal/partials/framework_import.bzl index f0f2bfb57e..4512e56536 100644 --- a/apple/internal/partials/framework_import.bzl +++ b/apple/internal/partials/framework_import.bzl @@ -22,10 +22,6 @@ load( "@build_bazel_rules_apple//apple:providers.bzl", "AppleFrameworkImportInfo", ) -load( - "@build_bazel_rules_apple//apple/internal:bitcode_support.bzl", - "bitcode_support", -) load( "@build_bazel_rules_apple//apple/internal:codesigning_support.bzl", "codesigning_support", @@ -154,8 +150,7 @@ def _framework_import_partial_impl( args.add_all(build_archs_found, before_each = "--slice") - if bitcode_support.bitcode_mode_string(platform_prerequisites.apple_fragment) == "none": - args.add("--strip_bitcode") + args.add("--strip_bitcode") args.add("--output_zip", framework_zip.path) diff --git a/apple/internal/partials/swift_dylibs.bzl b/apple/internal/partials/swift_dylibs.bzl index 9e489ec6b8..0c7becda67 100644 --- a/apple/internal/partials/swift_dylibs.bzl +++ b/apple/internal/partials/swift_dylibs.bzl @@ -18,10 +18,6 @@ load( "@build_bazel_apple_support//lib:apple_support.bzl", "apple_support", ) -load( - "@build_bazel_rules_apple//apple/internal:bitcode_support.bzl", - "bitcode_support", -) load( "@build_bazel_rules_apple//apple/internal:intermediates.bzl", "intermediates", @@ -156,8 +152,6 @@ def _swift_dylibs_partial_impl( transitive = transitive_binary_sets, ) - strip_bitcode = bitcode_support.bitcode_mode_string(platform_prerequisites.apple_fragment) == "none" - swift_support_requested = defines.bool_value( config_vars = platform_prerequisites.config_vars, define_name = "apple.package_swift_support", @@ -184,36 +178,30 @@ def _swift_dylibs_partial_impl( platform_name = platform_name, platform_prerequisites = platform_prerequisites, resolved_swift_stdlib_tool = apple_mac_toolchain_info.resolved_swift_stdlib_tool, - strip_bitcode = strip_bitcode, + strip_bitcode = True, ) bundle_files.append((processor.location.framework, None, depset([output_dir]))) if needs_swift_support: - if strip_bitcode: - # We're not allowed to modify stdlibs that are used for - # Swift Support, so we register another action for copying - # them without stripping bitcode. - swift_support_output_dir = intermediates.directory( - actions = actions, - target_name = label_name, - output_discriminator = output_discriminator, - dir_name = "swiftlibs_for_swiftsupport", - ) - _swift_dylib_action( - actions = actions, - binary_files = binaries_to_check, - output_dir = swift_support_output_dir, - platform_name = platform_name, - platform_prerequisites = platform_prerequisites, - resolved_swift_stdlib_tool = apple_mac_toolchain_info.resolved_swift_stdlib_tool, - strip_bitcode = False, - ) - else: - # When not building with bitcode, we can reuse Swift dylibs - # for bundling in both SwiftSupport and in the app bundle's - # "Frameworks" directory. - swift_support_output_dir = output_dir + # We're not allowed to modify stdlibs that are used for + # Swift Support, so we register another action for copying + # them without stripping bitcode. + swift_support_output_dir = intermediates.directory( + actions = actions, + target_name = label_name, + output_discriminator = output_discriminator, + dir_name = "swiftlibs_for_swiftsupport", + ) + _swift_dylib_action( + actions = actions, + binary_files = binaries_to_check, + output_dir = swift_support_output_dir, + platform_name = platform_name, + platform_prerequisites = platform_prerequisites, + resolved_swift_stdlib_tool = apple_mac_toolchain_info.resolved_swift_stdlib_tool, + strip_bitcode = False, + ) swift_support_file = (platform_name, swift_support_output_dir) transitive_swift_support_files.append(swift_support_file)