Skip to content

Commit

Permalink
Set CFBundleVersion from short git version hash
Browse files Browse the repository at this point in the history
  • Loading branch information
sc1sm3 committed Nov 6, 2018
1 parent 25c5359 commit 4d5dff9
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>313</string>
<string>Set by script!</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.lifestyle</string>
<key>LSMinimumSystemVersion</key>
Expand Down
29 changes: 29 additions & 0 deletions WiredClient.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@
77E36EEC0F82414F0065329A /* WCFilesSourceOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WCFilesSourceOutlineView.h; path = Sources/WCFilesSourceOutlineView.h; sourceTree = "<group>"; };
77E36EED0F82414F0065329A /* WCFilesSourceOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WCFilesSourceOutlineView.m; path = Sources/WCFilesSourceOutlineView.m; sourceTree = "<group>"; };
8412F05D439B9F0793485926 /* Pods-Wired Client.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Wired Client.release.xcconfig"; path = "Pods/Target Support Files/Pods-Wired Client/Pods-Wired Client.release.xcconfig"; sourceTree = "<group>"; };
84C45C162192340500B83198 /* set_build_number.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = set_build_number.sh; sourceTree = "<group>"; };
A509AD1105F7FBFF00E6AE2D /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
A51474A70F487ECD00DBE395 /* WCErrorQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WCErrorQueue.h; path = Sources/WCErrorQueue.h; sourceTree = "<group>"; };
A51474A80F487ECD00DBE395 /* WCErrorQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WCErrorQueue.m; path = Sources/WCErrorQueue.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1585,6 +1586,14 @@
name = Resources;
sourceTree = "<group>";
};
84C45C0B219233C700B83198 /* Scripts */ = {
isa = PBXGroup;
children = (
84C45C162192340500B83198 /* set_build_number.sh */,
);
name = Scripts;
sourceTree = "<group>";
};
A52B1C1206C4033B0033D317 /* Chat */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1789,6 +1798,7 @@
A52B1C4706C408210033D317 /* Wired Client */ = {
isa = PBXGroup;
children = (
84C45C0B219233C700B83198 /* Scripts */,
29B97315FDCFA39411CA2CEA /* Sources */,
A5E8BABF08748D6D0010F2A4 /* Config */,
4CF094B51559D669005D77BB /* Templates */,
Expand Down Expand Up @@ -2004,6 +2014,7 @@
4C2BDA5417F909230069B38E /* Copy Emoticon Packs */,
41A4977D16E8C8CEE4C029C0 /* [CP] Embed Pods Frameworks */,
4E8A4810DCF1700E64BB092D /* [CP] Copy Pods Resources */,
84C45C172192353600B83198 /* Set Build Number */,
);
buildRules = (
);
Expand Down Expand Up @@ -2451,6 +2462,24 @@
shellScript = "sh \"$SRCROOT/../../wired_client_localize.sh\" || exit 1";
showEnvVarsInLog = 0;
};
84C45C172192353600B83198 /* Set Build Number */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Set Build Number";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "$SRCROOT/set_build_number.sh\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>Basic.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>23</integer>
<integer>21</integer>
</dict>
<key>Distribution.xcscheme</key>
<dict>
Expand All @@ -22,12 +22,12 @@
<key>Localize Strings.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>24</integer>
<integer>26</integer>
</dict>
<key>Neo.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>25</integer>
<integer>22</integer>
</dict>
<key>PSMTabBarControl.xcscheme</key>
<dict>
Expand All @@ -37,17 +37,17 @@
<key>Vintage.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>26</integer>
<integer>23</integer>
</dict>
<key>Wired Client (Distribute Debug).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>21</integer>
<integer>25</integer>
</dict>
<key>Wired Client (Distribute).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>22</integer>
<integer>24</integer>
</dict>
<key>Wired Client.xcscheme</key>
<dict>
Expand Down
19 changes: 19 additions & 0 deletions set_build_number.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# set_build_number.sh
# WiredClient
#
# Created by Pushit on 2018-11-06.
#

git=$(sh /etc/profile; which git)
git_hash=$("$git" rev-parse --short HEAD)

target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"

for plist in "$target_plist" "$dsym_plist"; do
if [ -f "$plist" ]; then
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $git_hash" "$plist"
fi
done

0 comments on commit 4d5dff9

Please sign in to comment.