From 8cbbef1db4e4eb1b21e6a72e01d190139f868156 Mon Sep 17 00:00:00 2001 From: Tiago Quelhas Date: Thu, 28 Mar 2024 15:13:40 +0100 Subject: [PATCH] =?UTF-8?q?Remove=20`ctx.resolve=5Ftools`=20in=20favor=20o?= =?UTF-8?q?f=20`ctx.actions.run(executable=20=3D=20=E2=80=A6)`=20and=20`ct?= =?UTF-8?q?x.actions.run(tools=20=3D=20...)`.=20(#2438)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By passing the files_to_run for a tool into the `executable` or `tools` argument to `ctx.actions.run` or `ctx.actions.run_shell`, it's no longer necessary to pass the return values of `ctx.resolve_tools` into the `inputs` and `input_manifests` arguments. Each struct field of the AppleMacToolsToolchainInfo and AppleXPlatToolsToolchainInfo providers previously populated with the return values of `ctx.resolve_tools` is now populated with the files_to_run for the respective tool. The `resolved_` prefix is removed from field and variable names; in addition to it no longer making sense, this change provides proof that all usages have been audited. This lets us retire the `ctx.resolve_tools` API in a future Bazel version. --- apple/internal/apple_toolchains.bzl | 151 ++++++------------ apple/internal/apple_xcframework_import.bzl | 10 +- apple/internal/codesigning_support.bzl | 46 +++--- apple/internal/entitlements_support.bzl | 21 +-- apple/internal/environment_plist.bzl | 6 +- apple/internal/ios_rules.bzl | 12 +- apple/internal/macos_binary_support.bzl | 4 +- apple/internal/macos_rules.bzl | 26 +-- apple/internal/partials/clang_rt_dylibs.bzl | 7 +- .../internal/partials/codesigning_dossier.bzl | 21 +-- apple/internal/partials/debug_symbols.bzl | 22 +-- apple/internal/partials/framework_import.bzl | 20 +-- .../partials/main_thread_checker_dylibs.bzl | 13 +- apple/internal/partials/resources.bzl | 2 +- .../partials/support/resources_support.bzl | 28 ++-- apple/internal/partials/swift_dylibs.bzl | 13 +- apple/internal/processor.bzl | 28 ++-- apple/internal/resource_actions/actool.bzl | 28 ++-- apple/internal/resource_actions/datamodel.bzl | 41 +++-- apple/internal/resource_actions/ibtool.bzl | 47 +++--- apple/internal/resource_actions/intent.bzl | 12 +- apple/internal/resource_actions/mlmodel.bzl | 26 ++- apple/internal/resource_actions/plist.bzl | 21 ++- .../resource_rules/apple_core_data_model.bzl | 2 +- .../resource_rules/apple_core_ml_library.bzl | 2 +- .../resource_rules/apple_intent_library.bzl | 2 +- .../testing/apple_test_bundle_support.bzl | 2 +- apple/internal/tvos_rules.bzl | 8 +- apple/internal/visionos_rules.bzl | 8 +- apple/internal/watchos_rules.bzl | 10 +- apple/internal/xcframework_rules.bzl | 28 ++-- apple/versioning.bzl | 7 +- 32 files changed, 276 insertions(+), 398 deletions(-) diff --git a/apple/internal/apple_toolchains.bzl b/apple/internal/apple_toolchains.bzl index dfc6aa44e1..651f8d33ed 100644 --- a/apple/internal/apple_toolchains.bzl +++ b/apple/internal/apple_toolchains.bzl @@ -33,57 +33,57 @@ A `File` referencing a plist template for dSYM bundles. "process_and_sign_template": """\ A `File` referencing a template for a shell script to process and sign. """, - "resolved_alticonstool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to insert alternate icons entries in the app + "alticonstool": """\ +The files_to_run for a tool to insert alternate icons entries in the app bundle's `Info.plist`. """, - "resolved_bundletool_experimental": """\ -A `struct` from `ctx.resolve_tools` referencing an experimental tool to create an Apple bundle by + "bundletool_experimental": """\ +The files_to_run for an experimental tool to create an Apple bundle by combining the bundling, post-processing, and signing steps into a single action that eliminates the archiving step. """, - "resolved_clangrttool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to find all Clang runtime libs linked to a + "clangrttool": """\ +The files_to_run for a tool to find all Clang runtime libs linked to a binary. """, - "resolved_codesigningtool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to select the appropriate signing identity + "codesigningtool": """\ +The files_to_run for a tool to select the appropriate signing identity for Apple apps and Apple executable bundles. """, - "resolved_dossier_codesigningtool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to generate codesigning dossiers. + "dossier_codesigningtool": """\ +The files_to_run for a tool to generate codesigning dossiers. """, - "resolved_environment_plist_tool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool for collecting dev environment values. + "environment_plist_tool": """\ +The files_to_run for a tool for collecting dev environment values. """, - "resolved_imported_dynamic_framework_processor": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to process an imported dynamic framework + "imported_dynamic_framework_processor": """\ +The files_to_run for a tool to process an imported dynamic framework such that the given framework only contains the same slices as the app binary, every file belonging to the dynamic framework is copied to a temporary location, and the dynamic framework is codesigned and zipped as a cacheable artifact. """, - "resolved_main_thread_checker_tool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to find libMainThreadChecker.dylib linked to a + "main_thread_checker_tool": """\ +The files_to_run for a tool to find libMainThreadChecker.dylib linked to a binary. """, - "resolved_plisttool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to perform plist operations such as variable + "plisttool": """\ +The files_to_run for a tool to perform plist operations such as variable substitution, merging, and conversion of plist files to binary format. """, - "resolved_provisioning_profile_tool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool that extracts entitlements from a + "provisioning_profile_tool": """\ +The files_to_run for a tool that extracts entitlements from a provisioning profile. """, - "resolved_swift_stdlib_tool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool that copies and lipos Swift stdlibs required + "swift_stdlib_tool": """\ +The files_to_run for a tool that copies and lipos Swift stdlibs required for the target to run. """, - "resolved_xcframework_processor_tool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool that extracts and copies an XCFramework + "xcframework_processor_tool": """\ +The files_to_run for a tool that extracts and copies an XCFramework library for a target triplet. """, - "resolved_xctoolrunner": """\ -A `struct` from `ctx.resolve_tools` referencing a tool that acts as a wrapper for xcrun actions. + "xctoolrunner": """\ +The files_to_run for a tool that acts as a wrapper for xcrun actions. """, }, ) @@ -106,12 +106,12 @@ target name and values are retrieved from the BuildSettingInfo provider for each e.g. apple_xplat_tools_toolchaininfo.build_settings.signing_certificate_name """, - "resolved_bundletool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool to create an Apple bundle by taking a list of + "bundletool": """\ +A files_to_run for a tool to create an Apple bundle by taking a list of files/ZIPs and destinations paths to build the directory structure for those files. """, - "resolved_versiontool": """\ -A `struct` from `ctx.resolve_tools` referencing a tool that acts as a wrapper for xcrun actions. + "versiontool": """\ +A files_to_run for a tool that acts as a wrapper for xcrun actions. """, }, ) @@ -131,79 +131,24 @@ def _shared_attrs(): ), } -def _resolve_tools_for_executable(*, rule_ctx, attr_name): - """Helper macro to resolve executable runfile dependencies across the rule boundary.""" - - # TODO(b/111036105) Migrate away from this helper and its outputs once ctx.executable works - # across rule boundaries. - executable = getattr(rule_ctx.executable, attr_name) - target = getattr(rule_ctx.attr, attr_name) - files_to_run = target[DefaultInfo].files_to_run - inputs, input_manifests = rule_ctx.resolve_tools(tools = [target]) - return struct( - executable = executable, - files_to_run = files_to_run, - inputs = inputs, - input_manifests = input_manifests, - ) - def _apple_mac_tools_toolchain_impl(ctx): return [ AppleMacToolsToolchainInfo( dsym_info_plist_template = ctx.file.dsym_info_plist_template, process_and_sign_template = ctx.file.process_and_sign_template, - resolved_alticonstool = _resolve_tools_for_executable( - attr_name = "alticonstool", - rule_ctx = ctx, - ), - resolved_bundletool_experimental = _resolve_tools_for_executable( - attr_name = "bundletool_experimental", - rule_ctx = ctx, - ), - resolved_codesigningtool = _resolve_tools_for_executable( - attr_name = "codesigningtool", - rule_ctx = ctx, - ), - resolved_dossier_codesigningtool = _resolve_tools_for_executable( - attr_name = "dossier_codesigningtool", - rule_ctx = ctx, - ), - resolved_clangrttool = _resolve_tools_for_executable( - attr_name = "clangrttool", - rule_ctx = ctx, - ), - resolved_main_thread_checker_tool = _resolve_tools_for_executable( - attr_name = "main_thread_checker_tool", - rule_ctx = ctx, - ), - resolved_environment_plist_tool = _resolve_tools_for_executable( - attr_name = "environment_plist_tool", - rule_ctx = ctx, - ), - resolved_imported_dynamic_framework_processor = _resolve_tools_for_executable( - attr_name = "imported_dynamic_framework_processor", - rule_ctx = ctx, - ), - resolved_plisttool = _resolve_tools_for_executable( - attr_name = "plisttool", - rule_ctx = ctx, - ), - resolved_provisioning_profile_tool = _resolve_tools_for_executable( - attr_name = "provisioning_profile_tool", - rule_ctx = ctx, - ), - resolved_swift_stdlib_tool = _resolve_tools_for_executable( - attr_name = "swift_stdlib_tool", - rule_ctx = ctx, - ), - resolved_xcframework_processor_tool = _resolve_tools_for_executable( - attr_name = "xcframework_processor_tool", - rule_ctx = ctx, - ), - resolved_xctoolrunner = _resolve_tools_for_executable( - attr_name = "xctoolrunner", - rule_ctx = ctx, - ), + alticonstool = ctx.attr.alticonstool.files_to_run, + bundletool_experimental = ctx.attr.bundletool_experimental.files_to_run, + codesigningtool = ctx.attr.codesigningtool.files_to_run, + dossier_codesigningtool = ctx.attr.dossier_codesigningtool.files_to_run, + clangrttool = ctx.attr.clangrttool.files_to_run, + main_thread_checker_tool = ctx.attr.main_thread_checker_tool.files_to_run, + environment_plist_tool = ctx.attr.environment_plist_tool.files_to_run, + imported_dynamic_framework_processor = ctx.attr.imported_dynamic_framework_processor.files_to_run, + plisttool = ctx.attr.plisttool.files_to_run, + provisioning_profile_tool = ctx.attr.provisioning_profile_tool.files_to_run, + swift_stdlib_tool = ctx.attr.swift_stdlib_tool.files_to_run, + xcframework_processor_tool = ctx.attr.xcframework_processor_tool.files_to_run, + xctoolrunner = ctx.attr.xctoolrunner.files_to_run, ), DefaultInfo(), ] @@ -321,14 +266,8 @@ def _apple_xplat_tools_toolchain_impl(ctx): for build_setting in ctx.attr.build_settings } ), - resolved_bundletool = _resolve_tools_for_executable( - attr_name = "bundletool", - rule_ctx = ctx, - ), - resolved_versiontool = _resolve_tools_for_executable( - attr_name = "versiontool", - rule_ctx = ctx, - ), + bundletool = ctx.attr.bundletool.files_to_run, + versiontool = ctx.attr.versiontool.files_to_run, ), DefaultInfo(), ] diff --git a/apple/internal/apple_xcframework_import.bzl b/apple/internal/apple_xcframework_import.bzl index b9466c5593..e277994575 100644 --- a/apple/internal/apple_xcframework_import.bzl +++ b/apple/internal/apple_xcframework_import.bzl @@ -347,18 +347,14 @@ def _get_xcframework_library_with_xcframework_processor( ) outputs.append(swiftinterface_file) - xcframework_processor_tool = apple_mac_toolchain_info.resolved_xcframework_processor_tool + xcframework_processor_tool = apple_mac_toolchain_info.xcframework_processor_tool apple_support.run( actions = actions, apple_fragment = apple_fragment, arguments = [args], - executable = xcframework_processor_tool.files_to_run, - inputs = depset( - inputs, - transitive = [xcframework_processor_tool.inputs], - ), - input_manifests = xcframework_processor_tool.input_manifests, + executable = xcframework_processor_tool, + inputs = inputs, mnemonic = "ProcessXCFrameworkFiles", outputs = outputs, xcode_config = xcode_config, diff --git a/apple/internal/codesigning_support.bzl b/apple/internal/codesigning_support.bzl index b6806a1f03..e825f7e93b 100644 --- a/apple/internal/codesigning_support.bzl +++ b/apple/internal/codesigning_support.bzl @@ -480,28 +480,28 @@ def _codesigning_command( def _generate_codesigning_dossier_action( actions, label_name, - resolved_codesigning_dossier_tool, + dossier_codesigningtool, + embedded_dossiers, + entitlements, output_discriminator, output_dossier, platform_prerequisites, - embedded_dossiers = [], - entitlements = None, - provisioning_profile = None): + provisioning_profile): """Generates a codesigning dossier based on parameters. Args: actions: The actions provider from `ctx.actions`. + label_name: Name of the target being built. + dossier_codesigningtool: The files_to_run for the code signing tool. embedded_dossiers: An optional List of Structs generated from `embedded_codesigning_dossier` that should also be included in this dossier. entitlements: Optional file representing the entitlements to sign with. - label_name: Name of the target being built. output_discriminator: A string to differentiate between different target intermediate files or `None`. output_dossier: The `File` representing the output dossier file - the zipped dossier will be placed here. platform_prerequisites: Struct containing information on the platform being targeted. provisioning_profile: The provisioning profile file. May be `None`. - resolved_codesigning_dossier_tool: The `struct` from resolve_tools representing the code signing tool. """ input_files = [x.dossier_file for x in embedded_dossiers] @@ -571,14 +571,12 @@ def _generate_codesigning_dossier_action( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = args, - executable = resolved_codesigning_dossier_tool.files_to_run, + executable = dossier_codesigningtool, execution_requirements = execution_requirements, - inputs = depset(input_files, transitive = [resolved_codesigning_dossier_tool.inputs]), - input_manifests = resolved_codesigning_dossier_tool.input_manifests, + inputs = input_files, mnemonic = mnemonic, outputs = [output_dossier], progress_message = progress_message, - tools = [resolved_codesigning_dossier_tool.executable], xcode_config = platform_prerequisites.xcode_version_config, ) @@ -587,6 +585,7 @@ def _post_process_and_sign_archive_action( actions, archive_codesigning_path, codesign_inputs, + codesigningtool, codesignopts, entitlements = None, features, @@ -600,7 +599,6 @@ def _post_process_and_sign_archive_action( platform_prerequisites, process_and_sign_template, provisioning_profile, - resolved_codesigningtool, rule_descriptor, signed_frameworks): """Post-processes and signs an archived bundle. @@ -609,6 +607,7 @@ def _post_process_and_sign_archive_action( actions: The actions provider from `ctx.actions`. archive_codesigning_path: The codesigning path relative to the archive. codesign_inputs: Extra inputs needed for the `codesign` tool. + codesigningtool: The files_to_run for the code signing tool. codesignopts: Extra options to pass to the `codesign` tool. entitlements: Optional file representing the entitlements to sign with. features: List of features enabled by the user. Typically from `ctx.features`. @@ -625,7 +624,6 @@ def _post_process_and_sign_archive_action( platform_prerequisites: Struct containing information on the platform being targeted. process_and_sign_template: A template for a shell script to process and sign as a file. provisioning_profile: The provisioning profile file. May be `None`. - resolved_codesigningtool: The `struct` from resolve_tools representing the code signing tool. rule_descriptor: A rule descriptor for platform and product types from the rule context. signed_frameworks: Depset containing each framework that has already been signed. """ @@ -640,7 +638,7 @@ def _post_process_and_sign_archive_action( signing_command_lines = _codesigning_command( bundle_path = archive_codesigning_path, - codesigningtool = resolved_codesigningtool.executable, + codesigningtool = codesigningtool.executable, codesignopts = codesignopts, entitlements = entitlements, features = features, @@ -651,7 +649,7 @@ def _post_process_and_sign_archive_action( signed_frameworks = signed_frameworks, ) if signing_command_lines: - processing_tools.append(resolved_codesigningtool.executable) + processing_tools.append(codesigningtool) if entitlements: input_files.append(entitlements) if provisioning_profile: @@ -735,11 +733,7 @@ def _post_process_and_sign_archive_action( arguments = arguments, executable = process_and_sign_expanded_template, execution_requirements = execution_requirements, - inputs = depset( - input_files + codesign_inputs, - transitive = [resolved_codesigningtool.inputs], - ), - input_manifests = resolved_codesigningtool.input_manifests, + inputs = input_files + codesign_inputs, mnemonic = mnemonic, outputs = [output_archive], progress_message = progress_message, @@ -760,24 +754,24 @@ def _sign_binary_action( *, actions, codesign_inputs, + codesigningtool, codesignopts, input_binary, output_binary, platform_prerequisites, provisioning_profile, - resolved_codesigningtool, rule_descriptor): """Signs the input binary file, copying it into the given output binary file. Args: actions: The actions provider from `ctx.actions`. codesign_inputs: Extra inputs needed for the `codesign` tool. + codesigningtool: The files_to_run for the code signing tool. codesignopts: Extra options to pass to the `codesign` tool. input_binary: The `File` representing the binary to be signed. output_binary: The `File` representing signed binary. platform_prerequisites: Struct containing information on the platform being targeted. provisioning_profile: The provisioning profile file. May be `None`. - resolved_codesigningtool: The `struct` from resolve_tools representing the code signing tool. rule_descriptor: A rule descriptor for platform and product types from the rule context. """ _validate_provisioning_profile( @@ -791,7 +785,7 @@ def _sign_binary_action( # code signing commands on that copy in the same action. path_to_sign = _path_to_sign(path = output_binary.path) signing_commands = _signing_command_lines( - codesigningtool = resolved_codesigningtool.executable, + codesigningtool = codesigningtool.executable, entitlements_file = None, paths_to_sign = [path_to_sign], platform_prerequisites = platform_prerequisites, @@ -818,14 +812,10 @@ def _sign_binary_action( output_binary = output_binary.path, ) + "\n" + signing_commands, execution_requirements = execution_requirements, - inputs = depset( - [input_binary] + codesign_inputs, - transitive = [resolved_codesigningtool.inputs], - ), - input_manifests = resolved_codesigningtool.input_manifests, + inputs = [input_binary] + codesign_inputs, mnemonic = "SignBinary", outputs = [output_binary], - tools = [resolved_codesigningtool.executable], + tools = [codesigningtool], xcode_config = platform_prerequisites.xcode_version_config, ) diff --git a/apple/internal/entitlements_support.bzl b/apple/internal/entitlements_support.bzl index cffb359aee..cf3e7ef972 100644 --- a/apple/internal/entitlements_support.bzl +++ b/apple/internal/entitlements_support.bzl @@ -121,7 +121,7 @@ def _extract_signing_info( entitlements, platform_prerequisites, provisioning_profile, - resolved_provisioning_profile_tool, + provisioning_profile_tool, rule_label): """Inspects the current context and extracts the signing information. @@ -130,7 +130,8 @@ def _extract_signing_info( entitlements: The entitlements file to sign with. Can be `None` if one was not provided. platform_prerequisites: Struct containing information on the platform being targeted. provisioning_profile: File for the provisioning profile. - resolved_provisioning_profile_tool: A tool used to extract info from a provisioning profile. + provisioning_profile_tool: A files_to_run for a tool used to extract info from a provisioning + profile. rule_label: The label of the target being analyzed. Returns: @@ -175,15 +176,11 @@ def _extract_signing_info( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = [control_file.path], - executable = resolved_provisioning_profile_tool.files_to_run, + executable = provisioning_profile_tool, # Since the tools spawns openssl and/or security tool, it doesn't # support being sandboxed. execution_requirements = {"no-sandbox": "1"}, - inputs = depset( - [control_file, provisioning_profile], - transitive = [resolved_provisioning_profile_tool.inputs], - ), - input_manifests = resolved_provisioning_profile_tool.input_manifests, + inputs = [control_file, provisioning_profile], mnemonic = "ExtractFromProvisioningProfile", outputs = outputs, xcode_config = platform_prerequisites.xcode_version_config, @@ -253,9 +250,7 @@ def _process_entitlements( entitlements = entitlements_file, platform_prerequisites = platform_prerequisites, provisioning_profile = provisioning_profile, - resolved_provisioning_profile_tool = ( - apple_mac_toolchain_info.resolved_provisioning_profile_tool - ), + provisioning_profile_tool = apple_mac_toolchain_info.provisioning_profile_tool, rule_label = rule_label, ) plists = [] @@ -315,7 +310,7 @@ def _process_entitlements( mnemonic = "ProcessEntitlementsFiles", outputs = [final_entitlements], platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, ) if platform_prerequisites.platform.is_device: @@ -354,7 +349,7 @@ def _process_entitlements( mnemonic = "ProcessSimulatorEntitlementsFile", outputs = [simulator_entitlements], platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, ) return struct( diff --git a/apple/internal/environment_plist.bzl b/apple/internal/environment_plist.bzl index 0bc1c5500f..bcff459671 100644 --- a/apple/internal/environment_plist.bzl +++ b/apple/internal/environment_plist.bzl @@ -62,7 +62,7 @@ def _environment_plist_impl(ctx): uses_swift = False, xcode_version_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig], ) - resolved_environment_plist_tool = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo].resolved_environment_plist_tool + environment_plist_tool = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo].environment_plist_tool platform = platform_prerequisites.platform sdk_version = platform_prerequisites.sdk_version apple_support.run( @@ -74,9 +74,7 @@ def _environment_plist_impl(ctx): "--output", ctx.outputs.plist.path, ], - executable = resolved_environment_plist_tool.executable, - inputs = resolved_environment_plist_tool.inputs, - input_manifests = resolved_environment_plist_tool.input_manifests, + executable = environment_plist_tool, outputs = [ctx.outputs.plist], xcode_config = platform_prerequisites.xcode_version_config, ) diff --git a/apple/internal/ios_rules.bzl b/apple/internal/ios_rules.bzl index 7a5c8e9057..a2b16a8f74 100644 --- a/apple/internal/ios_rules.bzl +++ b/apple/internal/ios_rules.bzl @@ -343,7 +343,7 @@ def _ios_application_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -686,7 +686,7 @@ def _ios_app_clip_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -992,7 +992,7 @@ def _ios_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1290,7 +1290,7 @@ def _ios_extension_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1572,7 +1572,7 @@ def _ios_dynamic_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -2216,7 +2216,7 @@ def _ios_imessage_extension_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), diff --git a/apple/internal/macos_binary_support.bzl b/apple/internal/macos_binary_support.bzl index fd2f2c1cba..24ab2f3d82 100644 --- a/apple/internal/macos_binary_support.bzl +++ b/apple/internal/macos_binary_support.bzl @@ -152,7 +152,7 @@ def _macos_binary_infoplist_impl(ctx): output_pkginfo = None, output_plist = merged_infoplist, platform_prerequisites = platform_prerequisites, - resolved_plisttool = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo].resolved_plisttool, + plisttool = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo].plisttool, rule_descriptor = rule_descriptor, rule_label = rule_label, version = ctx.attr.version, @@ -246,7 +246,7 @@ def _macos_command_line_launchdplist_impl(ctx): output_discriminator = None, output_plist = merged_launchdplist, platform_prerequisites = platform_prerequisites, - resolved_plisttool = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo].resolved_plisttool, + plisttool = ctx.attr._mac_toolchain[AppleMacToolsToolchainInfo].plisttool, rule_label = rule_label, ) diff --git a/apple/internal/macos_rules.bzl b/apple/internal/macos_rules.bzl index be06aea35e..bd8fdc7b6d 100644 --- a/apple/internal/macos_rules.bzl +++ b/apple/internal/macos_rules.bzl @@ -318,7 +318,7 @@ def _macos_application_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -620,7 +620,7 @@ def _macos_bundle_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -882,7 +882,7 @@ def _macos_extension_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1142,7 +1142,7 @@ def _macos_quick_look_plugin_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1392,7 +1392,7 @@ def _macos_kernel_extension_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1632,7 +1632,7 @@ def _macos_spotlight_importer_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1871,7 +1871,7 @@ def _macos_xpc_service_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -2020,7 +2020,7 @@ def _macos_command_line_application_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ) @@ -2047,12 +2047,12 @@ def _macos_command_line_application_impl(ctx): codesigning_support.sign_binary_action( actions = actions, codesign_inputs = ctx.files.codesign_inputs, + codesigningtool = apple_mac_toolchain_info.codesigningtool, codesignopts = codesigning_support.codesignopts_from_rule_ctx(ctx), input_binary = binary_artifact, output_binary = output_file, platform_prerequisites = platform_prerequisites, provisioning_profile = provisioning_profile, - resolved_codesigningtool = apple_mac_toolchain_info.resolved_codesigningtool, rule_descriptor = rule_descriptor, ) @@ -2162,7 +2162,7 @@ def _macos_dylib_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ) @@ -2190,12 +2190,12 @@ def _macos_dylib_impl(ctx): codesigning_support.sign_binary_action( actions = actions, codesign_inputs = ctx.files.codesign_inputs, + codesigningtool = apple_mac_toolchain_info.codesigningtool, codesignopts = codesigning_support.codesignopts_from_rule_ctx(ctx), input_binary = binary_artifact, output_binary = output_file, platform_prerequisites = platform_prerequisites, provisioning_profile = provisioning_profile, - resolved_codesigningtool = apple_mac_toolchain_info.resolved_codesigningtool, rule_descriptor = rule_descriptor, ) @@ -2911,7 +2911,7 @@ def _macos_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -3189,7 +3189,7 @@ def _macos_dynamic_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), diff --git a/apple/internal/partials/clang_rt_dylibs.bzl b/apple/internal/partials/clang_rt_dylibs.bzl index 4ad689bf6f..a7a22b8635 100644 --- a/apple/internal/partials/clang_rt_dylibs.bzl +++ b/apple/internal/partials/clang_rt_dylibs.bzl @@ -55,7 +55,7 @@ def _clang_rt_dylibs_partial_impl( file_name = "clang_rt.zip", ) - resolved_clangrttool = apple_mac_toolchain_info.resolved_clangrttool + clangrttool = apple_mac_toolchain_info.clangrttool apple_support.run( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, @@ -63,11 +63,10 @@ def _clang_rt_dylibs_partial_impl( binary_artifact.path, clang_rt_zip.path, ], - executable = resolved_clangrttool.files_to_run, + executable = clangrttool, # This action needs to read the contents of the Xcode bundle. execution_requirements = {"no-sandbox": "1"}, - inputs = depset([binary_artifact] + dylibs, transitive = [resolved_clangrttool.inputs]), - input_manifests = resolved_clangrttool.input_manifests, + inputs = [binary_artifact] + dylibs, outputs = [clang_rt_zip], mnemonic = "ClangRuntimeLibsCopy", xcode_config = platform_prerequisites.xcode_version_config, diff --git a/apple/internal/partials/codesigning_dossier.bzl b/apple/internal/partials/codesigning_dossier.bzl index cf49df1f24..6c810ecf5b 100644 --- a/apple/internal/partials/codesigning_dossier.bzl +++ b/apple/internal/partials/codesigning_dossier.bzl @@ -155,17 +155,18 @@ def _embedded_codesign_dossiers_from_dossier_infos( def _create_combined_zip_artifact( *, actions, + bundletool, dossier_merge_zip, input_archive, label_name, output_combined_zip, output_discriminator, - platform_prerequisites, - resolved_bundletool): + platform_prerequisites): """Generates a zip file with the IPA contents in one subdirectory and the dossier in another. Args: actions: The actions provider from `ctx.actions`. + bundletool: A files_to_run for the bundle tool. dossier_merge_zip: A File referencing the generated code sign dossier zip. input_archive: A File referencing the rule's output archive (IPA or zipped app). label_name: Name of the target being built. @@ -173,7 +174,6 @@ def _create_combined_zip_artifact( output_discriminator: A string to differentiate between different target intermediate files or `None`. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_bundletool: A struct referencing the resolved bundle tool. """ bundletool_control_file = intermediates.file( actions = actions, @@ -226,15 +226,8 @@ def _create_combined_zip_artifact( else: actions.run( arguments = [bundletool_control_file.path], - executable = resolved_bundletool.executable, - inputs = depset( - direct = [bundletool_control_file], - transitive = [ - resolved_bundletool.inputs, - depset([input_archive, dossier_merge_zip]), - ], - ), - input_manifests = resolved_bundletool.input_manifests, + executable = bundletool, + inputs = [bundletool_control_file, input_archive, dossier_merge_zip], **common_combined_dossier_zip_args ) @@ -284,7 +277,7 @@ def _codesigning_dossier_partial_impl( codesigning_support.generate_codesigning_dossier_action( actions = actions, label_name = label_name, - resolved_codesigning_dossier_tool = apple_mac_toolchain_info.resolved_dossier_codesigningtool, + dossier_codesigningtool = apple_mac_toolchain_info.dossier_codesigningtool, output_discriminator = output_discriminator, output_dossier = output_dossier, platform_prerequisites = platform_prerequisites, @@ -331,13 +324,13 @@ def _codesigning_dossier_partial_impl( _create_combined_zip_artifact( actions = actions, + bundletool = apple_xplat_toolchain_info.bundletool, dossier_merge_zip = output_dossier, input_archive = output_archive, label_name = label_name, output_combined_zip = output_combined_zip, output_discriminator = output_discriminator, platform_prerequisites = platform_prerequisites, - resolved_bundletool = apple_xplat_toolchain_info.resolved_bundletool, ) return struct( diff --git a/apple/internal/partials/debug_symbols.bzl b/apple/internal/partials/debug_symbols.bzl index 2965839833..2e851de7fe 100644 --- a/apple/internal/partials/debug_symbols.bzl +++ b/apple/internal/partials/debug_symbols.bzl @@ -174,7 +174,7 @@ def _generate_dsym_info_plist( dsym_info_plist_template, output_discriminator, platform_prerequisites, - resolved_plisttool, + plisttool, rule_label, version): """Generates an XML Info.plist appropriate for a dSYM bundle. @@ -186,7 +186,7 @@ def _generate_dsym_info_plist( output_discriminator: A string to differentiate between different target intermediate files or `None`. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_plisttool: A struct referencing the resolved plist tool. + plisttool: A files_to_run for the plist tool. rule_label: The label of the target being analyzed. version: A label referencing AppleBundleVersionInfo, if provided by the rule. @@ -238,7 +238,7 @@ def _generate_dsym_info_plist( mnemonic = "CompileDSYMInfoPlist", outputs = [dsym_plist], platform_prerequisites = platform_prerequisites, - resolved_plisttool = resolved_plisttool, + plisttool = plisttool, ) return dsym_plist @@ -253,7 +253,7 @@ def _bundle_dsym_files( label_name, output_discriminator, platform_prerequisites, - resolved_plisttool, + plisttool, rule_label, version): """Recreates the .dSYM bundle from the AppleDebugOutputs provider and dSYM binaries. @@ -279,7 +279,7 @@ def _bundle_dsym_files( output_discriminator: A string to differentiate between different target intermediate files or `None`. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_plisttool: A struct referencing the resolved plist tool. + plisttool: A files_to_run for the plist tool. rule_label: The label of the target being analyzed. version: A label referencing AppleBundleVersionInfo, if provided by the rule. @@ -326,7 +326,7 @@ def _bundle_dsym_files( dsym_info_plist_template = dsym_info_plist_template, output_discriminator = output_discriminator, platform_prerequisites = platform_prerequisites, - resolved_plisttool = resolved_plisttool, + plisttool = plisttool, rule_label = rule_label, version = version, ) @@ -368,7 +368,7 @@ def _debug_symbols_partial_impl( linkmaps = {}, output_discriminator = None, platform_prerequisites, - resolved_plisttool, + plisttool, rule_label, version): """Implementation for the debug symbols processing partial.""" @@ -413,7 +413,7 @@ def _debug_symbols_partial_impl( label_name = label_name, output_discriminator = output_discriminator, platform_prerequisites = platform_prerequisites, - resolved_plisttool = resolved_plisttool, + plisttool = plisttool, rule_label = rule_label, version = version, ) @@ -492,7 +492,7 @@ def debug_symbols_partial( linkmaps = {}, output_discriminator = None, platform_prerequisites, - resolved_plisttool, + plisttool, rule_label, version): """Constructor for the debug symbols processing partial. @@ -521,7 +521,7 @@ def debug_symbols_partial( output_discriminator: A string to differentiate between different target intermediate files or `None`. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_plisttool: A struct referencing the resolved plist tool. + plisttool: A files_to_run for the plist tool. rule_label: The label of the target being analyzed. version: A label referencing AppleBundleVersionInfo, if provided by the rule. @@ -542,7 +542,7 @@ def debug_symbols_partial( linkmaps = linkmaps, output_discriminator = output_discriminator, platform_prerequisites = platform_prerequisites, - resolved_plisttool = resolved_plisttool, + plisttool = plisttool, rule_label = rule_label, version = version, ) diff --git a/apple/internal/partials/framework_import.bzl b/apple/internal/partials/framework_import.bzl index 4512e56536..2159f608d7 100644 --- a/apple/internal/partials/framework_import.bzl +++ b/apple/internal/partials/framework_import.bzl @@ -174,8 +174,8 @@ def _framework_import_partial_impl( # code sign arguments are mutually exclusive groups. args.add("--disable_signing") - resolved_codesigningtool = apple_mac_toolchain_info.resolved_codesigningtool - resolved_imported_dynamic_framework_processor = apple_mac_toolchain_info.resolved_imported_dynamic_framework_processor + codesigningtool = apple_mac_toolchain_info.codesigningtool + imported_dynamic_framework_processor = apple_mac_toolchain_info.imported_dynamic_framework_processor execution_requirements = {} @@ -194,25 +194,15 @@ def _framework_import_partial_impl( # with different identities. execution_requirements["no-remote"] = "1" - transitive_inputs = [ - resolved_imported_dynamic_framework_processor.inputs, - resolved_codesigningtool.inputs, - ] - apple_support.run( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = [args], - executable = ( - resolved_imported_dynamic_framework_processor.files_to_run - ), - execution_requirements = execution_requirements, - inputs = depset(input_files, transitive = transitive_inputs), - input_manifests = resolved_imported_dynamic_framework_processor.input_manifests + - resolved_codesigningtool.input_manifests, + executable = imported_dynamic_framework_processor, + inputs = input_files, mnemonic = "ImportedDynamicFrameworkProcessor", outputs = [framework_zip], - tools = [resolved_codesigningtool.executable], + tools = [codesigningtool], xcode_config = platform_prerequisites.xcode_version_config, ) diff --git a/apple/internal/partials/main_thread_checker_dylibs.bzl b/apple/internal/partials/main_thread_checker_dylibs.bzl index b627cc3aaf..75df16d13a 100644 --- a/apple/internal/partials/main_thread_checker_dylibs.bzl +++ b/apple/internal/partials/main_thread_checker_dylibs.bzl @@ -51,8 +51,8 @@ def _run_main_thread_checker( binary_artifact, dylibs, main_thread_checker_dylib, - platform_prerequisites, - resolved_main_thread_checker_tool): + main_thread_checker_tool, + platform_prerequisites): apple_support.run( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, @@ -60,10 +60,9 @@ def _run_main_thread_checker( binary_artifact.path, main_thread_checker_dylib.path, ], - executable = resolved_main_thread_checker_tool.files_to_run, + executable = main_thread_checker_tool, execution_requirements = {"no-sandbox": "1"}, - inputs = depset([binary_artifact] + dylibs, transitive = [resolved_main_thread_checker_tool.inputs]), - input_manifests = resolved_main_thread_checker_tool.input_manifests, + inputs = [binary_artifact] + dylibs, outputs = [main_thread_checker_dylib], mnemonic = "MainThreadCheckerLibsCopy", xcode_config = platform_prerequisites.xcode_version_config, @@ -86,9 +85,9 @@ def _main_thread_checker_dylibs_partial_impl( return struct(bundle_files = bundle_files) main_thread_checker_dylib = _create_main_thread_checker_dylib(actions, label_name, output_discriminator) - resolved_main_thread_checker_tool = apple_mac_toolchain_info.resolved_main_thread_checker_tool + main_thread_checker_tool = apple_mac_toolchain_info.main_thread_checker_tool - _run_main_thread_checker(actions, binary_artifact, dylibs, main_thread_checker_dylib, platform_prerequisites, resolved_main_thread_checker_tool) + _run_main_thread_checker(actions, binary_artifact, dylibs, main_thread_checker_dylib, main_thread_checker_tool, platform_prerequisites) bundle_files.append( (processor.location.framework, None, depset([main_thread_checker_dylib])), diff --git a/apple/internal/partials/resources.bzl b/apple/internal/partials/resources.bzl index 39c483a7f3..909163b4c7 100644 --- a/apple/internal/partials/resources.bzl +++ b/apple/internal/partials/resources.bzl @@ -368,7 +368,7 @@ def _resources_partial_impl( out_infoplist = out_infoplist, output_discriminator = output_discriminator, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_descriptor = rule_descriptor, rule_label = rule_label, version = version, diff --git a/apple/internal/partials/support/resources_support.bzl b/apple/internal/partials/support/resources_support.bzl index 9cba4cb10c..339a0bfabf 100644 --- a/apple/internal/partials/support/resources_support.bzl +++ b/apple/internal/partials/support/resources_support.bzl @@ -64,8 +64,8 @@ def _compile_datamodels( output_discriminator, parent_dir, platform_prerequisites, - resolved_xctoolrunner, - swift_module): + swift_module, + xctoolrunner): "Compiles datamodels into mom files." output_files = [] module_name = swift_module or label_name @@ -97,7 +97,7 @@ def _compile_datamodels( module_name = module_name, output_file = output_file, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = resolved_xctoolrunner, + xctoolrunner = xctoolrunner, ) output_files.append( (processor.location.resource, datamodel_parent, depset(direct = [output_file])), @@ -113,7 +113,7 @@ def _compile_mappingmodels( output_discriminator, parent_dir, platform_prerequisites, - resolved_xctoolrunner): + xctoolrunner): """Compiles mapping models into cdm files.""" output_files = [] for mappingmodel_path, input_files in mappingmodel_groups.items(): @@ -131,7 +131,7 @@ def _compile_mappingmodels( mappingmodel_path = mappingmodel_path, output_file = output_file, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = resolved_xctoolrunner, + xctoolrunner = xctoolrunner, ) output_files.append( @@ -205,15 +205,15 @@ def _asset_catalogs( resource_actions.compile_asset_catalog( actions = actions, alternate_icons = alternate_icons, + alticonstool = apple_mac_toolchain_info.alticonstool, asset_files = asset_files, bundle_id = bundle_id, output_dir = assets_dir, output_plist = assets_plist, platform_prerequisites = platform_prerequisites, product_type = product_type, - resolved_alticonstool = apple_mac_toolchain_info.resolved_alticonstool, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, rule_label = rule_label, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) return struct( @@ -276,8 +276,8 @@ def _datamodels( output_discriminator = output_discriminator, parent_dir = parent_dir, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, swift_module = swift_module, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, )) output_files.extend(_compile_mappingmodels( actions = actions, @@ -286,7 +286,7 @@ def _datamodels( parent_dir = parent_dir, mappingmodel_groups = mappingmodel_groups, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, )) return struct(files = output_files) @@ -343,7 +343,7 @@ def _infoplists( output_discriminator = output_discriminator, output_plist = out_plist, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = rule_label, ) return struct( @@ -438,7 +438,7 @@ def _mlmodels( output_bundle = output_bundle, output_plist = output_plist, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) mlmodel_bundles.append( @@ -608,8 +608,8 @@ def _storyboards( input_file = storyboard, output_dir = storyboardc_dir, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, swift_module = swift_module, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) compiled_storyboardcs.append(storyboardc_dir) @@ -625,8 +625,8 @@ def _storyboards( actions = actions, output_dir = linked_storyboard_dir, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, storyboardc_dirs = compiled_storyboardcs, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) return struct( files = [ @@ -705,8 +705,8 @@ def _xibs( input_file = file, output_dir = out_dir, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, swift_module = swift_module, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) nib_files.append(out_dir) diff --git a/apple/internal/partials/swift_dylibs.bzl b/apple/internal/partials/swift_dylibs.bzl index 0c7becda67..c5a23ff4f9 100644 --- a/apple/internal/partials/swift_dylibs.bzl +++ b/apple/internal/partials/swift_dylibs.bzl @@ -82,8 +82,8 @@ def _swift_dylib_action( output_dir, platform_name, platform_prerequisites, - resolved_swift_stdlib_tool, - strip_bitcode): + strip_bitcode, + swift_stdlib_tool): """Registers a swift-stlib-tool action to gather Swift dylibs to bundle.""" swift_stdlib_tool_args = [ "--platform", @@ -104,9 +104,8 @@ def _swift_dylib_action( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = swift_stdlib_tool_args, - executable = resolved_swift_stdlib_tool.files_to_run, - inputs = depset(binary_files, transitive = [resolved_swift_stdlib_tool.inputs]), - input_manifests = resolved_swift_stdlib_tool.input_manifests, + executable = swift_stdlib_tool, + inputs = binary_files, mnemonic = "SwiftStdlibCopy", outputs = [output_dir], xcode_config = platform_prerequisites.xcode_version_config, @@ -177,8 +176,8 @@ def _swift_dylibs_partial_impl( output_dir = output_dir, platform_name = platform_name, platform_prerequisites = platform_prerequisites, - resolved_swift_stdlib_tool = apple_mac_toolchain_info.resolved_swift_stdlib_tool, strip_bitcode = True, + swift_stdlib_tool = apple_mac_toolchain_info.swift_stdlib_tool, ) bundle_files.append((processor.location.framework, None, depset([output_dir]))) @@ -199,8 +198,8 @@ def _swift_dylibs_partial_impl( 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_stdlib_tool = apple_mac_toolchain_info.swift_stdlib_tool, ) swift_support_file = (platform_name, swift_support_output_dir) diff --git a/apple/internal/processor.bzl b/apple/internal/processor.bzl index 4c770e8db2..ca47f4de63 100644 --- a/apple/internal/processor.bzl +++ b/apple/internal/processor.bzl @@ -413,13 +413,13 @@ def _bundle_partial_outputs_files( # Since the tree artifact bundler also runs the post processor and codesigning, this # action needs to run on a macOS machine. - resolved_bundletool = apple_mac_toolchain_info.resolved_bundletool_experimental + bundletool = apple_mac_toolchain_info.bundletool_experimental # Required to satisfy an implicit dependency, when the codesigning commands are executed by # the experimental bundle tool script. - resolved_codesigningtool = apple_mac_toolchain_info.resolved_codesigningtool + codesigningtool = apple_mac_toolchain_info.codesigningtool - bundling_tools = [resolved_bundletool.executable, resolved_codesigningtool.executable] + bundling_tools = [bundletool, codesigningtool] if post_processor: bundling_tools.append(post_processor) @@ -438,14 +438,9 @@ def _bundle_partial_outputs_files( apple_support.run( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, - executable = resolved_bundletool.executable, + executable = bundletool, execution_requirements = execution_requirements, - inputs = depset(bundletool_inputs + codesign_inputs, transitive = [ - resolved_bundletool.inputs, - resolved_codesigningtool.inputs, - ]), - input_manifests = resolved_bundletool.input_manifests + - resolved_codesigningtool.input_manifests, + inputs = bundletool_inputs + codesign_inputs, mnemonic = "BundleTreeApp", progress_message = "Bundling, processing and signing %s" % label_name, tools = bundling_tools, @@ -453,11 +448,10 @@ def _bundle_partial_outputs_files( **action_args ) else: - resolved_bundletool = apple_xplat_toolchain_info.resolved_bundletool + bundletool = apple_xplat_toolchain_info.bundletool actions.run( - executable = resolved_bundletool.executable, - inputs = depset(bundletool_inputs, transitive = [resolved_bundletool.inputs]), - input_manifests = resolved_bundletool.input_manifests, + executable = bundletool, + inputs = bundletool_inputs, mnemonic = "BundleApp", progress_message = "Bundling %s" % label_name, **action_args @@ -536,7 +530,7 @@ def _bundle_post_process_and_sign( # TODO(b/149874635): Don't pass frameworks_path unless the rule has it (*_application). codesigning_command = codesigning_support.codesigning_command( - codesigningtool = apple_mac_toolchain_info.resolved_codesigningtool.executable, + codesigningtool = apple_mac_toolchain_info.codesigningtool.executable, entitlements = entitlements, features = features, frameworks_path = archive_paths[_LOCATION_ENUM.framework], @@ -607,6 +601,7 @@ def _bundle_post_process_and_sign( actions = actions, archive_codesigning_path = archive_codesigning_path, codesign_inputs = codesign_inputs, + codesigningtool = apple_mac_toolchain_info.codesigningtool, codesignopts = codesignopts, entitlements = entitlements, features = features, @@ -620,7 +615,6 @@ def _bundle_post_process_and_sign( platform_prerequisites = platform_prerequisites, process_and_sign_template = process_and_sign_template, provisioning_profile = provisioning_profile, - resolved_codesigningtool = apple_mac_toolchain_info.resolved_codesigningtool, rule_descriptor = rule_descriptor, signed_frameworks = transitive_signed_frameworks, ) @@ -677,6 +671,7 @@ def _bundle_post_process_and_sign( actions = actions, archive_codesigning_path = embedding_archive_codesigning_path, codesign_inputs = codesign_inputs, + codesigningtool = apple_mac_toolchain_info.codesigningtool, codesignopts = codesignopts, entitlements = entitlements, features = features, @@ -690,7 +685,6 @@ def _bundle_post_process_and_sign( platform_prerequisites = platform_prerequisites, process_and_sign_template = process_and_sign_template, provisioning_profile = provisioning_profile, - resolved_codesigningtool = apple_mac_toolchain_info.resolved_codesigningtool, rule_descriptor = rule_descriptor, signed_frameworks = transitive_signed_frameworks, ) diff --git a/apple/internal/resource_actions/actool.bzl b/apple/internal/resource_actions/actool.bzl index 26e7c94c30..ef86f8aec8 100644 --- a/apple/internal/resource_actions/actool.bzl +++ b/apple/internal/resource_actions/actool.bzl @@ -24,7 +24,7 @@ load( ) load( "@build_bazel_rules_apple//apple/internal/utils:xctoolrunner.bzl", - "xctoolrunner", + xctoolrunner_support = "xctoolrunner", ) load( "@build_bazel_rules_apple//apple/internal:apple_product_type.bzl", @@ -187,15 +187,15 @@ def compile_asset_catalog( *, actions, alternate_icons, + alticonstool, asset_files, bundle_id, output_dir, output_plist, platform_prerequisites, product_type, - resolved_alticonstool, - resolved_xctoolrunner, - rule_label): + rule_label, + xctoolrunner): """Creates an action that compiles asset catalogs. This action populates a directory with compiled assets that must be merged @@ -206,6 +206,7 @@ def compile_asset_catalog( Args: actions: The actions provider from `ctx.actions`. alternate_icons: Alternate icons files, organized in .alticon directories. + alticonstool: A files_to_run for the alticonstool tool. asset_files: An iterable of files in all asset catalogs that should be packaged as part of this catalog. This should include transitive dependencies (i.e., assets not just from the application target, but @@ -217,9 +218,8 @@ def compile_asset_catalog( into Info.plist. May be None if the output plist is not desired. platform_prerequisites: Struct containing information on the platform being targeted. product_type: The product type identifier used to describe the current bundle type. - resolved_alticonstool: A struct referencing the resolved alticonstool tool. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. rule_label: The label of the target being analyzed. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ platform = platform_prerequisites.platform actool_platform = platform.name_in_plist.lower() @@ -227,7 +227,7 @@ def compile_asset_catalog( args = [ "actool", "--compile", - xctoolrunner.prefixed_path(output_dir.path), + xctoolrunner_support.prefixed_path(output_dir.path), "--platform", actool_platform, "--minimum-deployment-target", @@ -264,7 +264,7 @@ def compile_asset_catalog( actool_outputs.append(actool_output_plist) args.extend([ "--output-partial-info-plist", - xctoolrunner.prefixed_path(actool_output_plist.path), + xctoolrunner_support.prefixed_path(actool_output_plist.path), ]) xcassets = group_files_by_directory( @@ -273,16 +273,15 @@ def compile_asset_catalog( attr = "asset_catalogs", ).keys() - args.extend([xctoolrunner.prefixed_path(xcasset) for xcasset in xcassets]) + args.extend([xctoolrunner_support.prefixed_path(xcasset) for xcasset in xcassets]) apple_support.run( actions = actions, arguments = args, apple_fragment = platform_prerequisites.apple_fragment, - executable = resolved_xctoolrunner.files_to_run, + executable = xctoolrunner, execution_requirements = {"no-sandbox": "1"}, - inputs = depset(asset_files, transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + inputs = asset_files, mnemonic = "AssetCatalogCompile", outputs = actool_outputs, xcode_config = platform_prerequisites.xcode_version_config, @@ -299,9 +298,8 @@ def compile_asset_catalog( alticons_files = alternate_icons, device_families = platform_prerequisites.device_families, ), - executable = resolved_alticonstool.files_to_run, - inputs = depset([actool_output_plist] + alternate_icons, transitive = [resolved_alticonstool.inputs]), - input_manifests = resolved_alticonstool.input_manifests, + executable = alticonstool, + inputs = [actool_output_plist] + alternate_icons, mnemonic = "AlternateIconsInsert", outputs = alticons_outputs, xcode_config = platform_prerequisites.xcode_version_config, diff --git a/apple/internal/resource_actions/datamodel.bzl b/apple/internal/resource_actions/datamodel.bzl index da26409e9e..5ed8f0c943 100644 --- a/apple/internal/resource_actions/datamodel.bzl +++ b/apple/internal/resource_actions/datamodel.bzl @@ -20,7 +20,7 @@ load( ) load( "@build_bazel_rules_apple//apple/internal/utils:xctoolrunner.bzl", - "xctoolrunner", + xctoolrunner_support = "xctoolrunner", ) def compile_datamodels( @@ -31,7 +31,7 @@ def compile_datamodels( module_name, output_file, platform_prerequisites, - resolved_xctoolrunner): + xctoolrunner): """Creates an action that compiles datamodels. Args: @@ -41,7 +41,7 @@ def compile_datamodels( module_name: The module name to use when compiling the datamodels. output_file: The file reference to the compiled datamodel. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ platform = platform_prerequisites.platform platform_name = platform.name_in_plist.lower() @@ -53,17 +53,16 @@ def compile_datamodels( platform_prerequisites.minimum_os, "--module", module_name, - xctoolrunner.prefixed_path(datamodel_path), - xctoolrunner.prefixed_path(output_file.path), + xctoolrunner_support.prefixed_path(datamodel_path), + xctoolrunner_support.prefixed_path(output_file.path), ] apple_support.run( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = args, - executable = resolved_xctoolrunner.files_to_run, - inputs = depset(input_files, transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + executable = xctoolrunner, + inputs = input_files, mnemonic = "MomCompile", outputs = [output_file], xcode_config = platform_prerequisites.xcode_version_config, @@ -76,7 +75,7 @@ def compile_mappingmodel( mappingmodel_path, output_file, platform_prerequisites, - resolved_xctoolrunner): + xctoolrunner): """Creates an action that compiles CoreData mapping models. Args: @@ -85,21 +84,20 @@ def compile_mappingmodel( mappingmodel_path: The path to the directory containing the mapping model. output_file: The file reference to the compiled mapping model. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ args = [ "mapc", - xctoolrunner.prefixed_path(mappingmodel_path), - xctoolrunner.prefixed_path(output_file.path), + xctoolrunner_support.prefixed_path(mappingmodel_path), + xctoolrunner_support.prefixed_path(output_file.path), ] apple_support.run( actions = actions, arguments = args, apple_fragment = platform_prerequisites.apple_fragment, - executable = resolved_xctoolrunner.files_to_run, - inputs = depset(input_files, transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + executable = xctoolrunner, + inputs = input_files, mnemonic = "MappingModelCompile", outputs = [output_file], xcode_config = platform_prerequisites.xcode_version_config, @@ -112,7 +110,7 @@ def generate_datamodels( input_files, output_dir, platform_prerequisites, - resolved_xctoolrunner, + xctoolrunner, swift_version = None): """Creates an action that generates CoreData model class files. @@ -122,7 +120,7 @@ def generate_datamodels( input_files: The list of files to process for the given datamodel. output_dir: The output directory reference where generated datamodel classes will be. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. swift_version: (optional) Target Swift version for generated datamodel classes. """ platform = platform_prerequisites.platform @@ -137,8 +135,8 @@ def generate_datamodels( if swift_version: args.add("--swift-version", swift_version) - args.add(xctoolrunner.prefixed_path(datamodel_path)) - args.add(xctoolrunner.prefixed_path(output_dir.path)) + args.add(xctoolrunner_support.prefixed_path(datamodel_path)) + args.add(xctoolrunner_support.prefixed_path(output_dir.path)) args.add("--xctoolrunner_assert_nonempty_dir", output_dir.path) @@ -146,9 +144,8 @@ def generate_datamodels( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = [args], - executable = resolved_xctoolrunner.files_to_run, - inputs = depset(input_files, transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + executable = xctoolrunner, + inputs = input_files, mnemonic = "MomGenerate", outputs = [output_dir], xcode_config = platform_prerequisites.xcode_version_config, diff --git a/apple/internal/resource_actions/ibtool.bzl b/apple/internal/resource_actions/ibtool.bzl index a3756ecf7a..d72445c888 100644 --- a/apple/internal/resource_actions/ibtool.bzl +++ b/apple/internal/resource_actions/ibtool.bzl @@ -20,7 +20,7 @@ load( ) load( "@build_bazel_rules_apple//apple/internal/utils:xctoolrunner.bzl", - "xctoolrunner", + xctoolrunner_support = "xctoolrunner", ) load( "@bazel_skylib//lib:collections.bzl", @@ -59,8 +59,8 @@ def compile_storyboard( input_file, output_dir, platform_prerequisites, - resolved_xctoolrunner, - swift_module): + swift_module, + xctoolrunner): """Creates an action that compiles a storyboard. Args: @@ -68,15 +68,15 @@ def compile_storyboard( input_file: The storyboard to compile. output_dir: The directory where the compiled outputs should be placed. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. swift_module: The name of the Swift module to use when compiling the storyboard. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ args = [ "ibtool", "--compilation-directory", - xctoolrunner.prefixed_path(output_dir.dirname), + xctoolrunner_support.prefixed_path(output_dir.dirname), ] min_os = platform_prerequisites.minimum_os @@ -85,17 +85,16 @@ def compile_storyboard( args.extend([ "--module", swift_module, - xctoolrunner.prefixed_path(input_file.path), + xctoolrunner_support.prefixed_path(input_file.path), ]) apple_support.run( actions = actions, arguments = args, apple_fragment = platform_prerequisites.apple_fragment, - executable = resolved_xctoolrunner.files_to_run, + executable = xctoolrunner, execution_requirements = {"no-sandbox": "1"}, - inputs = depset([input_file], transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + inputs = [input_file], mnemonic = "StoryboardCompile", outputs = [output_dir], xcode_config = platform_prerequisites.xcode_version_config, @@ -106,8 +105,8 @@ def link_storyboards( actions, output_dir, platform_prerequisites, - resolved_xctoolrunner, - storyboardc_dirs): + storyboardc_dirs, + xctoolrunner): """Creates an action that links multiple compiled storyboards. Storyboards that reference each other must be linked, and this operation also @@ -118,9 +117,9 @@ def link_storyboards( actions: The actions provider from `ctx.actions`. output_dir: The directory where the linked outputs should be placed. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A reference to the executable wrapper for "xcrun" tools. storyboardc_dirs: A list of `File`s that represent directories containing the compiled storyboards. + xctoolrunner: A files_to_run for the wrapper for the "xcrun" tools. """ min_os = platform_prerequisites.minimum_os @@ -129,11 +128,11 @@ def link_storyboards( args = [ "ibtool", "--link", - xctoolrunner.prefixed_path(output_dir.path), + xctoolrunner_support.prefixed_path(output_dir.path), ] args.extend(_ibtool_arguments(min_os, families)) args.extend([ - xctoolrunner.prefixed_path(f.path) + xctoolrunner_support.prefixed_path(f.path) for f in storyboardc_dirs ]) @@ -141,10 +140,9 @@ def link_storyboards( actions = actions, arguments = args, apple_fragment = platform_prerequisites.apple_fragment, - executable = resolved_xctoolrunner.files_to_run, + executable = xctoolrunner, execution_requirements = {"no-sandbox": "1"}, - inputs = depset(storyboardc_dirs, transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + inputs = storyboardc_dirs, mnemonic = "StoryboardLink", outputs = [output_dir], xcode_config = platform_prerequisites.xcode_version_config, @@ -156,8 +154,8 @@ def compile_xib( input_file, output_dir, platform_prerequisites, - resolved_xctoolrunner, - swift_module): + swift_module, + xctoolrunner): """Creates an action that compiles a Xib file. Args: @@ -165,9 +163,9 @@ def compile_xib( input_file: The Xib file to compile. output_dir: The file reference for the output directory. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. swift_module: The name of the Swift module to use when compiling the Xib file. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ min_os = platform_prerequisites.minimum_os @@ -178,23 +176,22 @@ def compile_xib( args = [ "ibtool", "--compile", - xctoolrunner.prefixed_path(paths.join(output_dir.path, nib_name)), + xctoolrunner_support.prefixed_path(paths.join(output_dir.path, nib_name)), ] args.extend(_ibtool_arguments(min_os, families)) args.extend([ "--module", swift_module, - xctoolrunner.prefixed_path(input_file.path), + xctoolrunner_support.prefixed_path(input_file.path), ]) apple_support.run( actions = actions, arguments = args, apple_fragment = platform_prerequisites.apple_fragment, - executable = resolved_xctoolrunner.files_to_run, + executable = xctoolrunner, execution_requirements = {"no-sandbox": "1"}, - inputs = depset([input_file], transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + inputs = [input_file], mnemonic = "XibCompile", outputs = [output_dir], xcode_config = platform_prerequisites.xcode_version_config, diff --git a/apple/internal/resource_actions/intent.bzl b/apple/internal/resource_actions/intent.bzl index 0137fddd0f..9bf24b887c 100644 --- a/apple/internal/resource_actions/intent.bzl +++ b/apple/internal/resource_actions/intent.bzl @@ -20,7 +20,7 @@ load( ) load( "@build_bazel_rules_apple//apple/internal/utils:xctoolrunner.bzl", - "xctoolrunner", + xctoolrunner_support = "xctoolrunner", ) load( "@bazel_skylib//lib:versions.bzl", @@ -40,7 +40,7 @@ def generate_intent_classes_sources( swift_version, class_visibility, platform_prerequisites, - resolved_xctoolrunner): + xctoolrunner): """Creates an action that cgenerates intent classes from an intentdefinition file. Args: @@ -55,7 +55,7 @@ def generate_intent_classes_sources( swift_version: Version of Swift to use for the generated classes. class_visibility: Visibility attribute for the generated classes. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A reference to the executable wrapper for "xcrun" tools. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ is_swift = language == "Swift" @@ -64,7 +64,7 @@ def generate_intent_classes_sources( "intentbuilderc", "generate", "-input", - xctoolrunner.prefixed_path(input_file.path), + xctoolrunner_support.prefixed_path(input_file.path), "-language", language, "-classPrefix", @@ -103,8 +103,8 @@ def generate_intent_classes_sources( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = arguments, - executable = resolved_xctoolrunner.files_to_run, - inputs = depset([input_file], transitive = [resolved_xctoolrunner.inputs]), + executable = xctoolrunner, + inputs = [input_file], mnemonic = "IntentGenerate", outputs = outputs, xcode_config = platform_prerequisites.xcode_version_config, diff --git a/apple/internal/resource_actions/mlmodel.bzl b/apple/internal/resource_actions/mlmodel.bzl index 40238c7d0a..3230d7847f 100644 --- a/apple/internal/resource_actions/mlmodel.bzl +++ b/apple/internal/resource_actions/mlmodel.bzl @@ -20,7 +20,7 @@ load( ) load( "@build_bazel_rules_apple//apple/internal/utils:xctoolrunner.bzl", - "xctoolrunner", + xctoolrunner_support = "xctoolrunner", ) def compile_mlmodel( @@ -30,7 +30,7 @@ def compile_mlmodel( output_bundle, output_plist, platform_prerequisites, - resolved_xctoolrunner): + xctoolrunner): """Creates an action that compiles an mlmodel file into an mlmodelc bundle. Args: @@ -39,24 +39,23 @@ def compile_mlmodel( output_bundle: The directory reference for the output mlmodelc bundle. output_plist: The file reference for the output plist from coremlc that needs to be merged. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ args = [ "coremlc", "compile", - xctoolrunner.prefixed_path(input_file.path), + xctoolrunner_support.prefixed_path(input_file.path), output_bundle.dirname, "--output-partial-info-plist", - xctoolrunner.prefixed_path(output_plist.path), + xctoolrunner_support.prefixed_path(output_plist.path), ] apple_support.run( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = args, - executable = resolved_xctoolrunner.files_to_run, - inputs = depset([input_file], transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + executable = xctoolrunner, + inputs = [input_file], mnemonic = "MlmodelCompile", outputs = [output_bundle, output_plist], xcode_config = platform_prerequisites.xcode_version_config, @@ -71,7 +70,7 @@ def generate_mlmodel_sources( objc_output_hdr, language, platform_prerequisites, - resolved_xctoolrunner): + xctoolrunner): """Creates an action that generates sources for an mlmodel file. Args: @@ -82,7 +81,7 @@ def generate_mlmodel_sources( objc_output_hdr: The output header file when generating Obj-C. language: Language of generated classes ("Objective-C", "Swift"). platform_prerequisites: Struct containing information on the platform being targeted. - resolved_xctoolrunner: A struct referencing the resolved wrapper for "xcrun" tools. + xctoolrunner: A files_to_run for the wrapper around the "xcrun" tool. """ is_swift = language == "Swift" @@ -90,7 +89,7 @@ def generate_mlmodel_sources( arguments = [ "coremlc", "generate", - xctoolrunner.prefixed_path(input_file.path), + xctoolrunner_support.prefixed_path(input_file.path), ] outputs = [] @@ -110,9 +109,8 @@ def generate_mlmodel_sources( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = arguments, - executable = resolved_xctoolrunner.files_to_run, - inputs = depset([input_file], transitive = [resolved_xctoolrunner.inputs]), - input_manifests = resolved_xctoolrunner.input_manifests, + executable = xctoolrunner, + inputs = [input_file], mnemonic = "MlmodelGenerate", outputs = outputs, xcode_config = platform_prerequisites.xcode_version_config, diff --git a/apple/internal/resource_actions/plist.bzl b/apple/internal/resource_actions/plist.bzl index 6e1ec1c439..2095b23847 100644 --- a/apple/internal/resource_actions/plist.bzl +++ b/apple/internal/resource_actions/plist.bzl @@ -47,7 +47,7 @@ def plisttool_action( mnemonic = None, outputs, platform_prerequisites, - resolved_plisttool): + plisttool): """Registers an action that invokes `plisttool`. This function is a low-level helper that simply invokes `plisttool` with the given arguments. @@ -61,15 +61,14 @@ def plisttool_action( mnemonic: The mnemonic to display when the action executes. Defaults to None. outputs: Any `File`s that should be treated as outputs of the underlying action. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_plisttool: A struct referencing the resolved plist tool. + plisttool: A files_to_run for the plist tool. """ apple_support.run( actions = actions, apple_fragment = platform_prerequisites.apple_fragment, arguments = [control_file.path], - executable = resolved_plisttool.files_to_run, - inputs = depset(inputs + [control_file], transitive = [resolved_plisttool.inputs]), - input_manifests = resolved_plisttool.input_manifests, + executable = plisttool, + inputs = inputs + [control_file], mnemonic = mnemonic, outputs = outputs, xcode_config = platform_prerequisites.xcode_version_config, @@ -120,7 +119,7 @@ def merge_resource_infoplists( output_discriminator, output_plist, platform_prerequisites, - resolved_plisttool, + plisttool, rule_label): """Merges a list of plist files for resource bundles with substitutions. @@ -133,7 +132,7 @@ def merge_resource_infoplists( or `None`. output_plist: The file reference for the output plist. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_plisttool: A struct referencing the resolved plist tool. + plisttool: A files_to_run for the plist tool. rule_label: The label of the target being analyzed. """ product_name = paths.replace_extension(bundle_name_with_extension, "") @@ -179,7 +178,7 @@ def merge_resource_infoplists( mnemonic = "CompileInfoPlist", outputs = [output_plist], platform_prerequisites = platform_prerequisites, - resolved_plisttool = resolved_plisttool, + plisttool = plisttool, ) def merge_root_infoplists( @@ -200,7 +199,7 @@ def merge_root_infoplists( output_plist, output_pkginfo, platform_prerequisites, - resolved_plisttool, + plisttool, rule_descriptor, rule_label, version, @@ -237,7 +236,7 @@ def merge_root_infoplists( required. output_plist: The file reference for the merged output plist. platform_prerequisites: Struct containing information on the platform being targeted. - resolved_plisttool: A struct referencing the resolved plist tool. + plisttool: A files_to_run for the plist tool. rule_descriptor: A rule descriptor for platform and product types from the rule context. rule_label: The label of the target being analyzed. version: A label referencing AppleBundleVersionInfo, if provided by the rule. @@ -389,5 +388,5 @@ def merge_root_infoplists( mnemonic = "CompileRootInfoPlist", outputs = output_files, platform_prerequisites = platform_prerequisites, - resolved_plisttool = resolved_plisttool, + plisttool = plisttool, ) diff --git a/apple/internal/resource_rules/apple_core_data_model.bzl b/apple/internal/resource_rules/apple_core_data_model.bzl index 853713cb9c..97058e58fa 100644 --- a/apple/internal/resource_rules/apple_core_data_model.bzl +++ b/apple/internal/resource_rules/apple_core_data_model.bzl @@ -105,8 +105,8 @@ def _apple_core_data_model_impl(ctx): input_files = files.to_list(), output_dir = output_dir, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, swift_version = swift_version, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) output_files.append(output_dir) diff --git a/apple/internal/resource_rules/apple_core_ml_library.bzl b/apple/internal/resource_rules/apple_core_ml_library.bzl index 3b1d3fddf7..c680253c6a 100644 --- a/apple/internal/resource_rules/apple_core_ml_library.bzl +++ b/apple/internal/resource_rules/apple_core_ml_library.bzl @@ -114,7 +114,7 @@ def _apple_core_ml_library_impl(ctx): objc_output_src = objc_output_src, objc_output_hdr = objc_output_hdr, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) if is_swift: diff --git a/apple/internal/resource_rules/apple_intent_library.bzl b/apple/internal/resource_rules/apple_intent_library.bzl index f53a5b79d8..9eaf056f95 100644 --- a/apple/internal/resource_rules/apple_intent_library.bzl +++ b/apple/internal/resource_rules/apple_intent_library.bzl @@ -94,7 +94,7 @@ def _apple_intent_library_impl(ctx): swift_version = ctx.attr.swift_version, class_visibility = ctx.attr.class_visibility, platform_prerequisites = platform_prerequisites, - resolved_xctoolrunner = apple_mac_toolchain_info.resolved_xctoolrunner, + xctoolrunner = apple_mac_toolchain_info.xctoolrunner, ) if is_swift: diff --git a/apple/internal/testing/apple_test_bundle_support.bzl b/apple/internal/testing/apple_test_bundle_support.bzl index 411372a0ba..628439bd6d 100644 --- a/apple/internal/testing/apple_test_bundle_support.bzl +++ b/apple/internal/testing/apple_test_bundle_support.bzl @@ -467,7 +467,7 @@ def _apple_test_bundle_impl(*, ctx, product_type): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), diff --git a/apple/internal/tvos_rules.bzl b/apple/internal/tvos_rules.bzl index f759b16b75..c38d2ff92f 100644 --- a/apple/internal/tvos_rules.bzl +++ b/apple/internal/tvos_rules.bzl @@ -309,7 +309,7 @@ def _tvos_application_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -631,7 +631,7 @@ def _tvos_dynamic_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -921,7 +921,7 @@ def _tvos_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1201,7 +1201,7 @@ def _tvos_extension_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), diff --git a/apple/internal/visionos_rules.bzl b/apple/internal/visionos_rules.bzl index b6255607fb..8593b51ba2 100644 --- a/apple/internal/visionos_rules.bzl +++ b/apple/internal/visionos_rules.bzl @@ -313,7 +313,7 @@ Resolved Xcode is version {xcode_version}. label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -628,7 +628,7 @@ def _visionos_dynamic_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -915,7 +915,7 @@ def _visionos_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1191,7 +1191,7 @@ def _visionos_extension_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), diff --git a/apple/internal/watchos_rules.bzl b/apple/internal/watchos_rules.bzl index cf8871a4aa..6fc238996a 100644 --- a/apple/internal/watchos_rules.bzl +++ b/apple/internal/watchos_rules.bzl @@ -305,7 +305,7 @@ def _watchos_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -582,7 +582,7 @@ def _watchos_dynamic_framework_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -921,7 +921,7 @@ reproducible error case.".format( executable_name = executable_name, label_name = label.name, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1219,7 +1219,7 @@ def _watchos_extension_impl(ctx): label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -1684,7 +1684,7 @@ delegate is referenced in the single-target `watchos_application`'s `deps`. label_name = label.name, linkmaps = debug_outputs.linkmaps, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), diff --git a/apple/internal/xcframework_rules.bzl b/apple/internal/xcframework_rules.bzl index fe2845c96f..4d053c441c 100644 --- a/apple/internal/xcframework_rules.bzl +++ b/apple/internal/xcframework_rules.bzl @@ -331,7 +331,7 @@ def _create_xcframework_root_infoplist( actions, apple_fragment, available_libraries, - resolved_plisttool, + plisttool, rule_label, xcode_config): """Generates a root Info.plist for a given XCFramework. @@ -341,7 +341,7 @@ def _create_xcframework_root_infoplist( apple_fragment: An Apple fragment (ctx.fragments.apple). available_libraries: A dictionary containing keys representing how a given framework should be referenced in the root Info.plist of a given XCFramework bundle. - resolved_plisttool: A struct referencing the resolved plist tool. + plisttool: A files_to_run for the plist tool. rule_label: The label of the target being analyzed. xcode_config: The `apple_common.XcodeVersionConfig` provider from the context. @@ -380,9 +380,8 @@ def _create_xcframework_root_infoplist( actions = actions, apple_fragment = apple_fragment, arguments = [plisttool_control_file.path], - executable = resolved_plisttool.files_to_run, - inputs = depset([plisttool_control_file], transitive = [resolved_plisttool.inputs]), - input_manifests = resolved_plisttool.input_manifests, + executable = plisttool, + inputs = [plisttool_control_file], mnemonic = "CreateXCFrameworkRootInfoPlist", outputs = [root_info_plist], xcode_config = xcode_config, @@ -393,18 +392,19 @@ def _create_xcframework_bundle( *, actions, bundle_name, + bundletool, framework_archive_files, framework_archive_merge_files, framework_archive_merge_zips = [], label_name, output_archive, - resolved_bundletool, root_info_plist): """Generates the bundle archive for an XCFramework. Args: actions: The actions providerx from `ctx.actions`. bundle_name: The name of the XCFramework bundle. + bundletool: A files to run for the bundle tool. framework_archive_files: A list of depsets referencing files to be used as inputs to the bundling action. This should include every archive referenced as a "src" of framework_archive_merge_zips. @@ -419,7 +419,6 @@ def _create_xcframework_bundle( `bundle_path`. label_name: Name of the target being built. output_archive: The file representing the final bundled archive. - resolved_bundletool: A struct referencing the resolved bundle tool. root_info_plist: A `File` representing a fully formed root Info.plist for this XCFramework. """ bundletool_control_file = intermediates.file( @@ -443,12 +442,11 @@ def _create_xcframework_bundle( actions.run( arguments = [bundletool_control_file.path], - executable = resolved_bundletool.files_to_run, + executable = bundletool, inputs = depset( direct = [bundletool_control_file, root_info_plist], - transitive = [resolved_bundletool.inputs] + framework_archive_files, + transitive = framework_archive_files, ), - input_manifests = resolved_bundletool.input_manifests, mnemonic = "CreateXCFrameworkBundle", outputs = [output_archive], progress_message = "Bundling %s" % label_name, @@ -634,7 +632,7 @@ def _apple_xcframework_impl(ctx): linkmaps = link_output.linkmaps, output_discriminator = library_identifier, platform_prerequisites = platform_prerequisites, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, version = ctx.attr.version, ), @@ -742,7 +740,7 @@ def _apple_xcframework_impl(ctx): actions = actions, apple_fragment = ctx.fragments.apple, available_libraries = available_libraries, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig], ) @@ -750,12 +748,12 @@ def _apple_xcframework_impl(ctx): _create_xcframework_bundle( actions = actions, bundle_name = bundle_name, + bundletool = apple_xplat_toolchain_info.bundletool, framework_archive_files = framework_archive_files, framework_archive_merge_files = framework_archive_merge_files, framework_archive_merge_zips = framework_archive_merge_zips, label_name = label.name, output_archive = ctx.outputs.archive, - resolved_bundletool = apple_xplat_toolchain_info.resolved_bundletool, root_info_plist = root_info_plist, ) @@ -1092,7 +1090,7 @@ def _apple_static_xcframework_impl(ctx): actions = actions, apple_fragment = apple_fragment, available_libraries = available_libraries, - resolved_plisttool = apple_mac_toolchain_info.resolved_plisttool, + plisttool = apple_mac_toolchain_info.plisttool, rule_label = label, xcode_config = xcode_config, ) @@ -1100,11 +1098,11 @@ def _apple_static_xcframework_impl(ctx): _create_xcframework_bundle( actions = actions, bundle_name = bundle_name, + bundletool = apple_xplat_toolchain_info.bundletool, framework_archive_files = framework_archive_files, framework_archive_merge_files = framework_archive_merge_files, label_name = label.name, output_archive = outputs_archive, - resolved_bundletool = apple_xplat_toolchain_info.resolved_bundletool, root_info_plist = root_info_plist, ) diff --git a/apple/versioning.bzl b/apple/versioning.bzl index 8411abe043..09ff7c6afd 100644 --- a/apple/versioning.bzl +++ b/apple/versioning.bzl @@ -133,13 +133,12 @@ def _apple_bundle_version_impl(ctx): ) inputs.append(control_file) - resolved_versiontool = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo].resolved_versiontool + versiontool = ctx.attr._xplat_toolchain[AppleXPlatToolsToolchainInfo].versiontool ctx.actions.run( - executable = resolved_versiontool.executable, + executable = versiontool, arguments = [control_file.path, bundle_version_file.path], - inputs = depset(inputs, transitive = [resolved_versiontool.inputs]), - input_manifests = resolved_versiontool.input_manifests, + inputs = inputs, outputs = [bundle_version_file], mnemonic = "AppleBundleVersion", )