From f55fc83ab28971b65809d8c437485e04de935a3f Mon Sep 17 00:00:00 2001 From: Luis Padron Date: Thu, 26 Sep 2024 01:46:13 -0400 Subject: [PATCH] Remove analysis failures for use_tree_artifacts_outputs flag. We started using `apple_*_xcframework_import` rules to bring in XCFrameworks and we are getting failures during a query. We don't actually use the version macOS framework in our build, it's just shipped along side the iOS framework. Because of the `fail` we need to remove usage of the `use_tree_artifacts_outputs` flag, which causes a big regression to our disk usage: - bin/Code/Apps/CashApp/CashApp_archive-root/Payload/Cash.app (732 MB) - bin/Code/Apps/CashApp/CashApp-intermediates/unprocessed_archive.zip (732 MB) - bin/Code/Apps/CashApp/CashApp.ipa (740 MB) With `use_tree_artifacts_outputs` flag enabled we only have: - bin/Code/Apps/CashApp/CashApp_archive-root/Payload/Cash.app (732 MB) We should see about better supporting this flag in the future, consider making it the default, or improve the disk usage without it. --- apple/internal/apple_framework_import.bzl | 22 +-------------------- apple/internal/apple_xcframework_import.bzl | 17 +--------------- 2 files changed, 2 insertions(+), 37 deletions(-) diff --git a/apple/internal/apple_framework_import.bzl b/apple/internal/apple_framework_import.bzl index 5adb42443e..c94be7c1d7 100644 --- a/apple/internal/apple_framework_import.bzl +++ b/apple/internal/apple_framework_import.bzl @@ -39,18 +39,10 @@ load( "@build_bazel_rules_apple//apple:utils.bzl", "group_files_by_directory", ) -load( - "@build_bazel_rules_apple//apple/internal:apple_toolchains.bzl", - "AppleXPlatToolsToolchainInfo", -) load( "@build_bazel_rules_apple//apple/internal:cc_toolchain_info_support.bzl", "cc_toolchain_info_support", ) -load( - "@build_bazel_rules_apple//apple/internal:experimental.bzl", - "is_experimental_tree_artifact_enabled", -) load( "@build_bazel_rules_apple//apple/internal:framework_import_support.bzl", "framework_import_support", @@ -205,7 +197,6 @@ def _debug_info_binaries( def _apple_dynamic_framework_import_impl(ctx): """Implementation for the apple_dynamic_framework_import rule.""" actions = ctx.actions - apple_xplat_toolchain_info = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo] cc_toolchain = find_cpp_toolchain(ctx) deps = ctx.attr.deps disabled_features = ctx.disabled_features @@ -215,19 +206,8 @@ def _apple_dynamic_framework_import_impl(ctx): # TODO(b/258492867): Add tree artifacts support when Bazel can handle remote actions with # symlinks. See https://github.com/bazelbuild/bazel/issues/16361. + target_triplet = cc_toolchain_info_support.get_apple_clang_triplet(cc_toolchain) - has_versioned_framework_files = framework_import_support.has_versioned_framework_files( - framework_imports, - ) - tree_artifact_enabled = ( - apple_xplat_toolchain_info.build_settings.use_tree_artifacts_outputs or - is_experimental_tree_artifact_enabled(config_vars = ctx.var) - ) - if target_triplet.os == "macos" and has_versioned_framework_files and tree_artifact_enabled: - fail("The apple_dynamic_framework_import rule does not yet support versioned " + - "frameworks with the experimental tree artifact feature/build setting. " + - "Please ensure that the `apple.experimental.tree_artifact_outputs` variable is not " + - "set to 1 on the command line or in your active build configuration.") providers = [] framework = framework_import_support.classify_framework_imports( diff --git a/apple/internal/apple_xcframework_import.bzl b/apple/internal/apple_xcframework_import.bzl index 076947c327..986395455f 100644 --- a/apple/internal/apple_xcframework_import.bzl +++ b/apple/internal/apple_xcframework_import.bzl @@ -27,10 +27,6 @@ load( "@build_bazel_rules_apple//apple/internal:cc_toolchain_info_support.bzl", "cc_toolchain_info_support", ) -load( - "@build_bazel_rules_apple//apple/internal:experimental.bzl", - "is_experimental_tree_artifact_enabled", -) load( "@build_bazel_rules_apple//apple/internal:framework_import_support.bzl", "framework_import_support", @@ -452,19 +448,8 @@ def _apple_dynamic_xcframework_import_impl(ctx): # TODO(b/258492867): Add tree artifacts support when Bazel can handle remote actions with # symlinks. See https://github.com/bazelbuild/bazel/issues/16361. + target_triplet = cc_toolchain_info_support.get_apple_clang_triplet(cc_toolchain) - has_versioned_framework_files = framework_import_support.has_versioned_framework_files( - xcframework_imports, - ) - tree_artifact_enabled = ( - apple_xplat_toolchain_info.build_settings.use_tree_artifacts_outputs or - is_experimental_tree_artifact_enabled(config_vars = ctx.var) - ) - if target_triplet.os == "macos" and has_versioned_framework_files and tree_artifact_enabled: - fail("The apple_dynamic_xcframework_import rule does not yet support versioned " + - "frameworks with the experimental tree artifact feature/build setting. " + - "Please ensure that the `apple.experimental.tree_artifact_outputs` variable is not " + - "set to 1 on the command line or in your active build configuration.") xcframework = _classify_xcframework_imports(ctx.var, xcframework_imports) if xcframework.bundle_type == _BUNDLE_TYPE.libraries: