Skip to content

Commit

Permalink
Add watchos_device_arm64(e) CPUs (#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
keith committed Feb 23, 2024
1 parent b3a8926 commit fdb07d0
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apple/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load(":cc_toolchain_forwarder.bzl", "cc_toolchain_forwarder")
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load(":cc_toolchain_forwarder.bzl", "cc_toolchain_forwarder")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -27,6 +27,7 @@ licenses(["notice"])
"watchos_arm64_32",
"watchos_x86_64",
"watchos_device_arm64",
"watchos_device_arm64e",
]
]

Expand Down
8 changes: 8 additions & 0 deletions platform_mappings
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ platforms:
--apple_platform_type=watchos
--cpu=watchos_arm64_32

@build_bazel_apple_support//platforms:watchos_device_arm64
--apple_platform_type=watchos
--cpu=watchos_device_arm64

@build_bazel_apple_support//platforms:watchos_device_arm64e
--apple_platform_type=watchos
--cpu=watchos_device_arm64e

flags:
--cpu=darwin_x86_64
--apple_platform_type=macos
Expand Down
2 changes: 1 addition & 1 deletion test/apple_shell_testutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function current_archs() {
value="$(echo "$option" | cut -d= -f2)"
else
# Eliminate `sim_` prefixes from `cpu`s as it is not part of the arch.
value="$(echo "$option" | cut -d= -f2 | sed 's/sim_//g')"
value="$(echo "$option" | cut -d= -f2 | sed -e 's/sim_//g' -e 's/device_//g')"
fi
echo "$value" | tr "," "\n"
return
Expand Down
18 changes: 18 additions & 0 deletions test/starlark_tests/apple_dynamic_xcframework_import_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,24 @@ def apple_dynamic_xcframework_import_test_suite(name):
cpus = {"watchos_cpus": ["arm64_32"]},
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform WATCHOS"],
)
archive_contents_test(
name = "{}_links_watchos_device_arm64_macho_load_cmd_for_device_test".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/watchos:app_with_imported_xcframework",
binary_test_file = "$BUNDLE_ROOT/Frameworks/generated_dynamic_watchos_xcframework.framework/generated_dynamic_watchos_xcframework",
binary_test_architecture = "arm64",
cpus = {"watchos_cpus": ["device_arm64"]},
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform WATCHOS"],
)
archive_contents_test(
name = "{}_links_watchos_device_arm64e_macho_load_cmd_for_device_test".format(name),
build_type = "device",
target_under_test = "//test/starlark_tests/targets_under_test/watchos:app_with_imported_xcframework",
binary_test_file = "$BUNDLE_ROOT/Frameworks/generated_dynamic_watchos_xcframework.framework/generated_dynamic_watchos_xcframework",
binary_test_architecture = "arm64e",
cpus = {"watchos_cpus": ["device_arm64e"]},
macho_load_commands_contain = ["cmd LC_BUILD_VERSION", "platform WATCHOS"],
)

# Verify tvos_application bundles XCFramework library for device and simulator architectures.
archive_contents_test(
Expand Down
4 changes: 3 additions & 1 deletion test/starlark_tests/targets_under_test/watchos/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1120,8 +1120,10 @@ generate_dynamic_xcframework(
},
platforms = {
"watchos": [
"armv7k",
"arm64",
"arm64_32",
"arm64e",
"armv7k",
],
"watchos_simulator": [
"x86_64",
Expand Down

0 comments on commit fdb07d0

Please sign in to comment.