Skip to content

Commit a46ce2f

Browse files
nglevinswiple-rules-gardener
authored andcommitted
Implement support for .icon bundles for Xcode 26 in macOS. Cover the happy paths of watchOS and macOS icon bundles with tests.
PiperOrigin-RevId: 779317298
1 parent f83c6e8 commit a46ce2f

File tree

19 files changed

+148
-2
lines changed

19 files changed

+148
-2
lines changed

apple/internal/resource_actions/actool.bzl

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,15 @@ def compile_asset_catalog(
296296
"--compress-pngs",
297297
]
298298

299+
xcode_config = platform_prerequisites.xcode_version_config
300+
301+
if platform_prerequisites.platform_type == "macos" and (
302+
xcode_config.xcode_version() >= apple_common.dotted_version("26.0")
303+
):
304+
# Required for the Icon Composer .icon bundles to work as inputs, even though it's not
305+
# documented. Xcode 26 currently relies on this flag to be set.
306+
args.extend(["--lightweight-asset-runtime-mode", "enabled"])
307+
299308
args.extend(_actool_args_for_special_file_types(
300309
asset_files = asset_files,
301310
bundle_id = bundle_id,
@@ -338,5 +347,5 @@ def compile_asset_catalog(
338347
inputs = asset_files,
339348
mnemonic = "AssetCatalogCompile",
340349
outputs = outputs,
341-
xcode_config = platform_prerequisites.xcode_version_config,
350+
xcode_config = xcode_config,
342351
)

test/starlark_tests/macos_application_resources_tests.bzl

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,44 @@ def macos_application_resources_test_suite(name):
2828
name: the base name to be used in things created by this macro
2929
"""
3030

31+
# Tests the new icon composer bundles for Xcode 26.
32+
archive_contents_test(
33+
name = "{}_icon_composer_app_icons_plist_test".format(name),
34+
build_type = "device",
35+
target_under_test = "//test/starlark_tests/targets_under_test/macos:app_with_icon_bundle",
36+
contains = [
37+
"$RESOURCE_ROOT/app_icon.icns",
38+
"$RESOURCE_ROOT/Assets.car",
39+
],
40+
plist_test_file = "$CONTENT_ROOT/Info.plist",
41+
plist_test_values = {
42+
"CFBundleIconName": "app_icon",
43+
"CFBundleIconFile": "app_icon",
44+
},
45+
tags = [
46+
name,
47+
],
48+
)
49+
50+
# Tests the new icon composer bundles for Xcode 26, along with a set of asset catalog icons.
51+
archive_contents_test(
52+
name = "{}_icon_composer_and_asset_catalog_app_icons_plist_test".format(name),
53+
build_type = "device",
54+
target_under_test = "//test/starlark_tests/targets_under_test/macos:app_with_icon_bundle_and_xcassets_app_icons",
55+
contains = [
56+
"$RESOURCE_ROOT/app_icon.icns",
57+
"$RESOURCE_ROOT/Assets.car",
58+
],
59+
plist_test_file = "$CONTENT_ROOT/Info.plist",
60+
plist_test_values = {
61+
"CFBundleIconName": "app_icon",
62+
"CFBundleIconFile": "app_icon",
63+
},
64+
tags = [
65+
name,
66+
],
67+
)
68+
3169
# Tests that various nonlocalized resource types are bundled correctly with
3270
# the application (at the top-level, rather than inside an .lproj directory).
3371
archive_contents_test(

test/starlark_tests/resources/MacAppIcon.xcassets/MacAppIcon.appiconset/Contents.json renamed to test/starlark_tests/resources/MacAppIcon.xcassets/app_icon.appiconset/Contents.json

File renamed without changes.

test/starlark_tests/resources/MacAppIcon.xcassets/MacAppIcon.appiconset/MacAppIcon-128.png renamed to test/starlark_tests/resources/MacAppIcon.xcassets/app_icon.appiconset/MacAppIcon-128.png

File renamed without changes.
File renamed without changes.

test/starlark_tests/resources/MacAppIcon.xcassets/MacAppIcon.appiconset/MacAppIcon-16.png renamed to test/starlark_tests/resources/MacAppIcon.xcassets/app_icon.appiconset/MacAppIcon-16.png

File renamed without changes.
File renamed without changes.

test/starlark_tests/resources/MacAppIcon.xcassets/MacAppIcon.appiconset/MacAppIcon-256.png renamed to test/starlark_tests/resources/MacAppIcon.xcassets/app_icon.appiconset/MacAppIcon-256.png

File renamed without changes.
File renamed without changes.

test/starlark_tests/resources/MacAppIcon.xcassets/MacAppIcon.appiconset/MacAppIcon-32.png renamed to test/starlark_tests/resources/MacAppIcon.xcassets/app_icon.appiconset/MacAppIcon-32.png

File renamed without changes.

0 commit comments

Comments
 (0)