Skip to content

[6.2]Add support for compiling Icon Composer icons with actool #624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ import Foundation
// TODO Should we make this a property of the product type?
guard context.productType?.identifier == "com.apple.product-type.app-extension.messages-sticker-pack" else { return [] }

let catalogFileTypes = ["folder.assetcatalog", "folder.stickers"].map { context.lookupFileType(identifier: $0)! }
let fileTypes = ["folder.assetcatalog", "folder.stickers", "folder.iconcomposer.icon"]
let catalogFileTypes = fileTypes.map { context.lookupFileType(identifier: $0)! }
let stringsFileType = context.lookupFileType(identifier: "text.plist.strings")!

let catalogPaths = target.files.compactMap { ftb in catalogFileTypes.contains { ftb.fileType.conformsTo($0) } ? ftb.absolutePath : nil }
Expand Down
3 changes: 2 additions & 1 deletion Sources/SWBApplePlatform/AssetCatalogCompiler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ public final class ActoolCompilerSpec : GenericCompilerSpec, SpecIdentifierType,
specialArgs += ["--platform", platformName]

// File types
let catalogFileTypes = ["folder.assetcatalog", "folder.stickers"].map { cbc.producer.lookupFileType(identifier: $0)! }
let fileTypes = ["folder.assetcatalog", "folder.stickers", "folder.iconcomposer.icon"]
let catalogFileTypes = fileTypes.map { cbc.producer.lookupFileType(identifier: $0)! }
let stringsFileType = cbc.producer.lookupFileType(identifier: "text.plist.strings")!

// Construct the command line using this custom lookup function.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
folder.assetcatalog,
folder.imagecatalog,
folder.stickers,
folder.iconcomposer.icon,
);
DeeplyStatInputDirectories = YES;
InputFileGroupings = (
Expand Down
3 changes: 2 additions & 1 deletion Sources/SWBCore/Specs/CoreBuildSystem.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
{
Name = "EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES";
Type = stringlist;
DefaultValue = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
DefaultValue = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
},
{
Name = "PRECOMP_DESTINATION_DIR";
Expand Down Expand Up @@ -1194,6 +1194,7 @@ When `GENERATE_INFOPLIST_FILE` is enabled, sets the value of the [CFBundleIdenti
Name = "EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES";
Type = StringList;
Category = "Search Paths";
DefaultValue = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
DefaultValue = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
},
{
Expand Down
2 changes: 1 addition & 1 deletion Sources/SWBCore/Specs/NativeBuildSystem.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ When `GENERATE_INFOPLIST_FILE` is enabled, sets the value of the [CFBundleExecut
},
{ Name = EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES;
Type = StringList;
DefaultValue = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
DefaultValue = "*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj";
Category = "Search Paths";
},
{ Name = RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS;
Expand Down
2 changes: 1 addition & 1 deletion Sources/SWBCore/Specs/en.lproj/CoreBuildSystem.strings
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ For backwards compatibility reasons, this setting is enabled by default. Disabli
"[INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES]-description" = "This is a list of `fnmatch()`-style patterns of file or directory names to include when performing a recursive search. By default, this is empty and is only customized when you want to provide exceptions to the list of filename patterns provided in `EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES`.";

"[EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES]-name" = "Sub-Directories to Exclude in Recursive Searches";
"[EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES]-description" = "This is a list of `fnmatch()`-style patterns of file or directory names to exclude when performing a recursive search. By default, this is set to `*.nib *.lproj *.framework *.gch *.xcode* *.xcassets (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj`. Normally, if you override this value you should include the default values via the `$(inherited)` macro.";
"[EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES]-description" = "This is a list of `fnmatch()`-style patterns of file or directory names to exclude when performing a recursive search. By default, this is set to `*.nib *.lproj *.framework *.gch *.xcode* *.xcassets *.icon (*) .DS_Store CVS .svn .git .hg *.pbproj *.pbxproj`. Normally, if you override this value you should include the default values via the `$(inherited)` macro.";

"[USE_HEADERMAP]-name" = "Use Header Maps";
"[USE_HEADERMAP]-description" = "Enable the use of *Header Maps*, which provide the compiler with a mapping from textual header names to their locations, bypassing the normal compiler header search path mechanisms. This allows source code to include headers from various locations in the file system without needing to update the header search path build settings.";
Expand Down
2 changes: 2 additions & 0 deletions Sources/SWBProjectModel/IDE/IDESwiftPackageExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ extension PIF.FileReference : PIFRepresentable {
// FIXME: This is probably now more important because of resources support.
case "xcassets":
return "folder.assetcatalog"
case "icon":
return "folder.iconcomposer.icon"
case "xcstrings":
return "text.json.xcstrings"
case "storyboard":
Expand Down
2 changes: 2 additions & 0 deletions Sources/SWBTestSupport/TestWorkspaces.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ package final class TestFile: TestInternalStructureItem, CustomStringConvertible
return "file.uicatalog"
case ".xcassets":
return "folder.assetcatalog"
case ".icon":
return "folder.iconcomposer.icon"
case ".xcdatamodeld":
return "wrapper.xcdatamodel"
case ".xcfilelist":
Expand Down
10 changes: 10 additions & 0 deletions Sources/SWBUniversalPlatform/Specs/StandardFileTypes.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,16 @@
UTI = "com.apple.dt.stickers";
},

{
// Icon Composer icons are not really wrappers according to launch services, but we treat them like wrappers in Xcode as we want them to be opaque
Type = FileType;
Identifier = folder.iconcomposer.icon;
BasedOn = folder.abstractassetcatalog;
Extensions = (icon);
IsTransparent = NO;
UTI = "com.apple.iconcomposer.icon";
},

// Archive file types
{
Type = FileType;
Expand Down
2 changes: 2 additions & 0 deletions Sources/SwiftBuild/ProjectModel/References.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ extension ProjectModel.FileReference: Codable {
// FIXME: This is probably now more important because of resources support.
case "xcassets":
return "folder.assetcatalog"
case "icon":
return "folder.iconcomposer.icon"
case "xcstrings":
return "text.json.xcstrings"
case "storyboard":
Expand Down
Loading
Loading