From 4d5dff9d8155f0d34b0138cb89d599c7fbf00208 Mon Sep 17 00:00:00 2001 From: sc1sm3 Date: Tue, 6 Nov 2018 21:55:35 +0100 Subject: [PATCH] Set CFBundleVersion from short git version hash --- Info.plist | 2 +- WiredClient.xcodeproj/project.pbxproj | 29 +++++++++++++++++++ .../xcschemes/xcschememanagement.plist | 12 ++++---- set_build_number.sh | 19 ++++++++++++ 4 files changed, 55 insertions(+), 7 deletions(-) create mode 100755 set_build_number.sh diff --git a/Info.plist b/Info.plist index 42c49861..70c23ba2 100644 --- a/Info.plist +++ b/Info.plist @@ -129,7 +129,7 @@ CFBundleVersion - 313 + Set by script! LSApplicationCategoryType public.app-category.lifestyle LSMinimumSystemVersion diff --git a/WiredClient.xcodeproj/project.pbxproj b/WiredClient.xcodeproj/project.pbxproj index 051c2427..103e4805 100644 --- a/WiredClient.xcodeproj/project.pbxproj +++ b/WiredClient.xcodeproj/project.pbxproj @@ -884,6 +884,7 @@ 77E36EEC0F82414F0065329A /* WCFilesSourceOutlineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WCFilesSourceOutlineView.h; path = Sources/WCFilesSourceOutlineView.h; sourceTree = ""; }; 77E36EED0F82414F0065329A /* WCFilesSourceOutlineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WCFilesSourceOutlineView.m; path = Sources/WCFilesSourceOutlineView.m; sourceTree = ""; }; 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 = ""; }; + 84C45C162192340500B83198 /* set_build_number.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = set_build_number.sh; sourceTree = ""; }; A509AD1105F7FBFF00E6AE2D /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; A51474A70F487ECD00DBE395 /* WCErrorQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WCErrorQueue.h; path = Sources/WCErrorQueue.h; sourceTree = ""; }; A51474A80F487ECD00DBE395 /* WCErrorQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WCErrorQueue.m; path = Sources/WCErrorQueue.m; sourceTree = ""; }; @@ -1585,6 +1586,14 @@ name = Resources; sourceTree = ""; }; + 84C45C0B219233C700B83198 /* Scripts */ = { + isa = PBXGroup; + children = ( + 84C45C162192340500B83198 /* set_build_number.sh */, + ); + name = Scripts; + sourceTree = ""; + }; A52B1C1206C4033B0033D317 /* Chat */ = { isa = PBXGroup; children = ( @@ -1789,6 +1798,7 @@ A52B1C4706C408210033D317 /* Wired Client */ = { isa = PBXGroup; children = ( + 84C45C0B219233C700B83198 /* Scripts */, 29B97315FDCFA39411CA2CEA /* Sources */, A5E8BABF08748D6D0010F2A4 /* Config */, 4CF094B51559D669005D77BB /* Templates */, @@ -2004,6 +2014,7 @@ 4C2BDA5417F909230069B38E /* Copy Emoticon Packs */, 41A4977D16E8C8CEE4C029C0 /* [CP] Embed Pods Frameworks */, 4E8A4810DCF1700E64BB092D /* [CP] Copy Pods Resources */, + 84C45C172192353600B83198 /* Set Build Number */, ); buildRules = ( ); @@ -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 */ diff --git a/WiredClient.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist b/WiredClient.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist index aa5be153..7b86906b 100644 --- a/WiredClient.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/WiredClient.xcodeproj/xcuserdata/admin.xcuserdatad/xcschemes/xcschememanagement.plist @@ -7,7 +7,7 @@ Basic.xcscheme_^#shared#^_ orderHint - 23 + 21 Distribution.xcscheme @@ -22,12 +22,12 @@ Localize Strings.xcscheme_^#shared#^_ orderHint - 24 + 26 Neo.xcscheme_^#shared#^_ orderHint - 25 + 22 PSMTabBarControl.xcscheme @@ -37,17 +37,17 @@ Vintage.xcscheme_^#shared#^_ orderHint - 26 + 23 Wired Client (Distribute Debug).xcscheme_^#shared#^_ orderHint - 21 + 25 Wired Client (Distribute).xcscheme_^#shared#^_ orderHint - 22 + 24 Wired Client.xcscheme diff --git a/set_build_number.sh b/set_build_number.sh new file mode 100755 index 00000000..d18b7fff --- /dev/null +++ b/set_build_number.sh @@ -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