Skip to content

Commit 89b1094

Browse files
stravinskiikeith
authored andcommitted
Use cc_toolchain_info_support for Apple framework import rules
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)
1 parent f5cad48 commit 89b1094

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

apple/internal/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ bzl_library(
5151
"//apple:__subpackages__",
5252
],
5353
deps = [
54+
":cc_toolchain_info_support",
5455
":framework_import_support",
5556
":resources",
5657
":rule_factory",

apple/internal/apple_framework_import.bzl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ load(
3838
"@build_bazel_rules_apple//apple:providers.bzl",
3939
"AppleFrameworkImportInfo",
4040
)
41+
load(
42+
"@build_bazel_rules_apple//apple/internal:cc_toolchain_info_support.bzl",
43+
"cc_toolchain_info_support",
44+
)
4145
load(
4246
"@build_bazel_rules_apple//apple/internal:resources.bzl",
4347
"resources",
@@ -346,9 +350,9 @@ def _apple_dynamic_framework_import_impl(ctx):
346350
)
347351

348352
# Create AppleFrameworkImportInfo provider.
349-
cpu = cc_toolchain.target_gnu_system_name.split("-")[0]
353+
target_triplet = cc_toolchain_info_support.get_apple_clang_triplet(cc_toolchain)
350354
providers.append(framework_import_support.framework_import_info_with_dependencies(
351-
build_archs = [cpu],
355+
build_archs = [target_triplet.architecture],
352356
deps = deps,
353357
debug_info_binaries = debug_info_binaries,
354358
dsyms = dsym_imports,
@@ -439,9 +443,9 @@ def _common_static_framework_import_impl(ctx, is_xcframework):
439443
)
440444

441445
# Create AppleFrameworkImportInfo provider.
442-
cpu = cc_toolchain.target_gnu_system_name.split("-")[0]
446+
target_triplet = cc_toolchain_info_support.get_apple_clang_triplet(cc_toolchain)
443447
providers.append(framework_import_support.framework_import_info_with_dependencies(
444-
build_archs = [cpu],
448+
build_archs = [target_triplet.architecture],
445449
deps = deps,
446450
debug_info_binaries = [],
447451
dsyms = [],
@@ -466,7 +470,7 @@ def _common_static_framework_import_impl(ctx, is_xcframework):
466470
if _is_debugging(compilation_mode):
467471
swiftmodule = _swiftmodule_for_cpu(
468472
framework_imports_by_category.swift_module_imports,
469-
cpu,
473+
target_triplet.architecture,
470474
)
471475
if swiftmodule:
472476
additional_objc_provider_fields.update(_ensure_swiftmodule_is_embedded(swiftmodule))

0 commit comments

Comments
 (0)