Skip to content

Commit

Permalink
Auto-generate the CFBundleIcons crap
Browse files Browse the repository at this point in the history
This was much harder than it should have been. But now all you need to
do to add an icon is add it to the project and edit Icons.plist.

https://medium.com/twitch-news/ios-versioning-89e02f0a5146
  • Loading branch information
tbodt committed Aug 21, 2020
1 parent 1fafb9b commit 9a146c2
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 98 deletions.
46 changes: 23 additions & 23 deletions app/Icons/Icons.plist
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,48 @@
<dict>
<key></key>
<dict>
<key>description</key>
<string>Default</string>
<key>author</key>
<string>@tbodt</string>
<key>link</key>
<string>https://twitter.com/tblodt</string>
</dict>
<key>ihash1</key>
<dict>
<key>description</key>
<string>i#</string>
<key>author</key>
<string>@01010101lzy</string>
<key>link</key>
<string>https://github.com/tbodt/ish/issues/578#issuecomment-562960935</string>
<string>@tbodt</string>
<key>description</key>
<string>Default</string>
</dict>
<key>uninspired</key>
<dict>
<key>description</key>
<string>uninspired</string>
<key>link</key>
<string>https://github.com/ish-app/ish/issues/578#issuecomment-562906800</string>
<key>author</key>
<string>@saagarjha</string>
<key>description</key>
<string>uninspired</string>
</dict>
<key>ihash1</key>
<dict>
<key>link</key>
<string>https://github.com/tbodt/ish/issues/578#issuecomment-562906800</string>
<string>https://github.com/ish-app/ish/issues/578#issuecomment-562960935</string>
<key>author</key>
<string>@01010101lzy</string>
<key>description</key>
<string>i#</string>
</dict>
<key>pydann2</key>
<dict>
<key>description</key>
<string>&gt;| Light</string>
<key>link</key>
<string>https://github.com/ish-app/ish/issues/578#issuecomment-562897067</string>
<key>author</key>
<string>@PyDann</string>
<key>link</key>
<string>https://github.com/tbodt/ish/issues/578#issuecomment-562897067</string>
<key>description</key>
<string>&gt;| Light</string>
</dict>
<key>pydann1</key>
<dict>
<key>description</key>
<string>&gt;| Dark</string>
<key>link</key>
<string>https://github.com/ish-app/ish/issues/578#issuecomment-562897067</string>
<key>author</key>
<string>@PyDann</string>
<key>link</key>
<string>https://github.com/tbodt/ish/issues/578#issuecomment-562897067</string>
<key>description</key>
<string>&gt;| Dark</string>
</dict>
</dict>
</plist>
77 changes: 2 additions & 75 deletions app/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fuc</key>
<string>ICON_STUFF</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>ihash1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>ihash1</string>
</array>
</dict>
<key>pydann1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>pydann1</string>
</array>
</dict>
<key>pydann2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>pydann2</string>
</array>
</dict>
<key>uninspired</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>uninspired</string>
</array>
</dict>
</dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>icon</string>
</array>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundleAlternateIcons</key>
<dict>
<key>ihash1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>ihash1</string>
</array>
</dict>
<key>pydann1</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>pydann1</string>
</array>
</dict>
<key>pydann2</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>pydann2</string>
</array>
</dict>
<key>uninspired</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>uninspired</string>
</array>
</dict>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
Expand Down
84 changes: 84 additions & 0 deletions iSH.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
objectVersion = 47;
objects = {

/* Begin PBXAggregateTarget section */
BB4A922324ED9402002F5A96 /* iSH pre */ = {
isa = PBXAggregateTarget;
buildConfigurationList = BB4A922424ED9402002F5A96 /* Build configuration list for PBXAggregateTarget "iSH pre" */;
buildPhases = (
BB4A922A24ED9421002F5A96 /* Add icons to Info.plist */,
);
dependencies = (
);
name = "iSH pre";
productName = "iSH pre";
};
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
408A263A236440F8008A4E81 /* iOSFS.m in Sources */ = {isa = PBXBuildFile; fileRef = 408A2639236440F8008A4E81 /* iOSFS.m */; };
650B337422EA235C00B4C03E /* PasteboardDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 650B337322EA235C00B4C03E /* PasteboardDevice.m */; };
Expand Down Expand Up @@ -104,6 +118,13 @@
remoteGlobalIDString = BB13F7D0200ACCA2003D1C4D;
remoteInfo = Ninja;
};
BB4A922724ED940C002F5A96 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BB792B461F96D8E000FFB7A4 /* Project object */;
proxyType = 1;
remoteGlobalIDString = BB4A922324ED9402002F5A96;
remoteInfo = "iSH pre";
};
BB88F49D2154760800A341FD /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = BB792B461F96D8E000FFB7A4 /* Project object */;
Expand Down Expand Up @@ -888,6 +909,7 @@
buildRules = (
);
dependencies = (
BB4A922824ED940C002F5A96 /* PBXTargetDependency */,
BB10E5CB248DBAB7009C7A74 /* PBXTargetDependency */,
BB13F7E7200AD874003D1C4D /* PBXTargetDependency */,
BB88F49E2154760800A341FD /* PBXTargetDependency */,
Expand Down Expand Up @@ -938,6 +960,11 @@
DevelopmentTeam = CK5SXRTBR7;
ProvisioningStyle = Automatic;
};
BB4A922324ED9402002F5A96 = {
CreatedOnToolsVersion = 11.5;
DevelopmentTeam = CK5SXRTBR7;
ProvisioningStyle = Automatic;
};
BB792B4F1F96D90D00FFB7A4 = {
CreatedOnToolsVersion = 9.0;
DevelopmentTeam = CK5SXRTBR7;
Expand Down Expand Up @@ -984,6 +1011,7 @@
BB13F7CA200ACC31003D1C4D /* Meson */,
BB13F7D0200ACCA2003D1C4D /* Ninja */,
BB13F7DB200AD81D003D1C4D /* libish */,
BB4A922324ED9402002F5A96 /* iSH pre */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -1063,6 +1091,26 @@
shellScript = "cd $SRCROOT/deps/libapps\n./hterm/bin/mkdist\n";
showEnvVarsInLog = 0;
};
BB4A922A24ED9421002F5A96 /* Add icons to Info.plist */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"$(SRCROOT)/app/Icons/Icons.plist",
);
name = "Add icons to Info.plist";
outputFileListPaths = (
);
outputPaths = (
"$(BUILT_PRODUCTS_DIR)/infoplisticons.h",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "python3 - \"${SRCROOT}/app/Icons/Icons.plist\" \"${BUILT_PRODUCTS_DIR}/infoplisticons.h\" <<END\nimport plistlib\nimport sys\nprint(sys.argv)\nwith open(sys.argv[1], 'rb') as plist:\n icons = plistlib.load(plist)\nalt_icons = '<key>CFBundleAlternateIcons</key><dict>'\nfor icon in icons.keys():\n if icon == '': continue\n alt_icons += '''<key>{0}</key>\n<dict>\n<key>CFBundleIconFiles</key>\n<array><string>{0}</string></array>\n</dict>'''.format(icon)\nalt_icons += '</dict>'\nicon_stuff = '''</string>\n<key>CFBundleIcons</key><dict>{0}</dict>\n<key>CFBundleIcons~ipad</key><dict>{0}</dict>\n<key>kxcode</key><string>'''.format(alt_icons)\nicon_define = '#define ICON_STUFF ' + icon_stuff.replace('\\n', '')\nwith open(sys.argv[2], 'w') as output:\n output.write(icon_define)\nEND\ntouch \"${SRCROOT}/app/Info.plist\"\n";
};
BBF1248B1FA7BF530088FB50 /* Download Alpine */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -1152,6 +1200,11 @@
target = BB13F7D0200ACCA2003D1C4D /* Ninja */;
targetProxy = BB13F7E8200AD967003D1C4D /* PBXContainerItemProxy */;
};
BB4A922824ED940C002F5A96 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BB4A922324ED9402002F5A96 /* iSH pre */;
targetProxy = BB4A922724ED940C002F5A96 /* PBXContainerItemProxy */;
};
BB88F49E2154760800A341FD /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = BB88F48F2154760800A341FD /* iSHFileProvider */;
Expand Down Expand Up @@ -1385,6 +1438,24 @@
};
name = Release;
};
BB4A922524ED9402002F5A96 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = CK5SXRTBR7;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
BB4A922624ED9402002F5A96 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = CK5SXRTBR7;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
BB792B4A1F96D8E000FFB7A4 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = BB9C7B88240A343400F5D4F0 /* iSH.xcconfig */;
Expand Down Expand Up @@ -1526,6 +1597,8 @@
"$(SRCROOT)/deps/libarchive/libarchive",
);
INFOPLIST_FILE = app/Info.plist;
INFOPLIST_PREFIX_HEADER = "$(BUILT_PRODUCTS_DIR)/infoplisticons.h";
INFOPLIST_PREPROCESS = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1589,6 +1662,8 @@
"$(SRCROOT)/deps/libarchive/libarchive",
);
INFOPLIST_FILE = app/Info.plist;
INFOPLIST_PREFIX_HEADER = "$(BUILT_PRODUCTS_DIR)/infoplisticons.h";
INFOPLIST_PREPROCESS = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER)";
Expand Down Expand Up @@ -1711,6 +1786,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BB4A922424ED9402002F5A96 /* Build configuration list for PBXAggregateTarget "iSH pre" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BB4A922524ED9402002F5A96 /* Debug */,
BB4A922624ED9402002F5A96 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
BB792B491F96D8E000FFB7A4 /* Build configuration list for PBXProject "iSH" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>

0 comments on commit 9a146c2

Please sign in to comment.