Skip to content

Commit

Permalink
Use cc_toolchain_info_support for Apple framework import rules
Browse files Browse the repository at this point in the history
For consistency, use cc_toolchain_info_support to parse cc_toolchain
target triplet to retrieve the effective architecture.

PiperOrigin-RevId: 458522032
(cherry picked from commit 3baf00d)
  • Loading branch information
stravinskii authored and keith committed Jul 9, 2022
1 parent f5cad48 commit 89b1094
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions apple/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ bzl_library(
"//apple:__subpackages__",
],
deps = [
":cc_toolchain_info_support",
":framework_import_support",
":resources",
":rule_factory",
Expand Down
14 changes: 9 additions & 5 deletions apple/internal/apple_framework_import.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ load(
"@build_bazel_rules_apple//apple:providers.bzl",
"AppleFrameworkImportInfo",
)
load(
"@build_bazel_rules_apple//apple/internal:cc_toolchain_info_support.bzl",
"cc_toolchain_info_support",
)
load(
"@build_bazel_rules_apple//apple/internal:resources.bzl",
"resources",
Expand Down Expand Up @@ -346,9 +350,9 @@ def _apple_dynamic_framework_import_impl(ctx):
)

# Create AppleFrameworkImportInfo provider.
cpu = cc_toolchain.target_gnu_system_name.split("-")[0]
target_triplet = cc_toolchain_info_support.get_apple_clang_triplet(cc_toolchain)
providers.append(framework_import_support.framework_import_info_with_dependencies(
build_archs = [cpu],
build_archs = [target_triplet.architecture],
deps = deps,
debug_info_binaries = debug_info_binaries,
dsyms = dsym_imports,
Expand Down Expand Up @@ -439,9 +443,9 @@ def _common_static_framework_import_impl(ctx, is_xcframework):
)

# Create AppleFrameworkImportInfo provider.
cpu = cc_toolchain.target_gnu_system_name.split("-")[0]
target_triplet = cc_toolchain_info_support.get_apple_clang_triplet(cc_toolchain)
providers.append(framework_import_support.framework_import_info_with_dependencies(
build_archs = [cpu],
build_archs = [target_triplet.architecture],
deps = deps,
debug_info_binaries = [],
dsyms = [],
Expand All @@ -466,7 +470,7 @@ def _common_static_framework_import_impl(ctx, is_xcframework):
if _is_debugging(compilation_mode):
swiftmodule = _swiftmodule_for_cpu(
framework_imports_by_category.swift_module_imports,
cpu,
target_triplet.architecture,
)
if swiftmodule:
additional_objc_provider_fields.update(_ensure_swiftmodule_is_embedded(swiftmodule))
Expand Down

0 comments on commit 89b1094

Please sign in to comment.