From 4b5c4fae1110f60433d8b194eb83504b9e9f48cd Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 26 Nov 2018 17:25:44 -0700 Subject: [PATCH 1/6] extract script to external file for more readable version control --- Scripts/update_plist_info.sh | 32 ++++++++++++++++++++++++++++++++ Signal.xcodeproj/project.pbxproj | 7 ++++--- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100755 Scripts/update_plist_info.sh diff --git a/Scripts/update_plist_info.sh b/Scripts/update_plist_info.sh new file mode 100755 index 000000000..20ca9b4c8 --- /dev/null +++ b/Scripts/update_plist_info.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Capture hash & comment from last WebRTC git commit. +cd $PROJECT_DIR/ThirdParty/WebRTC/ +_git_commit=`git log --pretty=oneline | head -1` +cd $PROJECT_DIR + +# Remove existing .plist entry, if any. +/usr/libexec/PlistBuddy -c "Delete BuildDetails" Signal/Signal-Info.plist || true +# Add new .plist entry. +/usr/libexec/PlistBuddy -c "add BuildDetails dict" Signal/Signal-Info.plist + +/usr/libexec/PlistBuddy -c "add :BuildDetails:WebRTCCommit string '$_git_commit'" Signal/Signal-Info.plist + +_osx_version=`defaults read loginwindow SystemVersionStampAsString` +/usr/libexec/PlistBuddy -c "add :BuildDetails:OSXVersion string '$_osx_version'" Signal/Signal-Info.plist + +_cocoapods_version=`pod --version` +/usr/libexec/PlistBuddy -c "add :BuildDetails:CocoapodsVersion string '$_cocoapods_version'" Signal/Signal-Info.plist + +_carthage_version=`carthage version` +/usr/libexec/PlistBuddy -c "add :BuildDetails:CarthageVersion string '$_carthage_version'" Signal/Signal-Info.plist + +echo "CONFIGURATION: ${CONFIGURATION}" +if [ "${CONFIGURATION}" = "App Store Release" ]; then + /usr/libexec/PlistBuddy -c "add :BuildDetails:XCodeVersion string '${XCODE_VERSION_MAJOR}.${XCODE_VERSION_MINOR}'" Signal/Signal-Info.plist + + # Use UTC + _build_datetime=`date -u` + /usr/libexec/PlistBuddy -c "add :BuildDetails:DateTime string '$_build_datetime'" Signal/Signal-Info.plist +fi + diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 22a328f57..1c2041c5c 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2687,7 +2687,7 @@ 45AE48531E073428004D96C2 /* Swift Lint */, D221A085169C9E5E00537ABF /* Sources */, D221A086169C9E5E00537ABF /* Frameworks */, - 34C239432180B01B00B6108F /* ShellScript */, + 34C239432180B01B00B6108F /* Run Script: update_list_info */, D221A087169C9E5E00537ABF /* Resources */, 59C9DBA462715B5C999FFB02 /* [CP] Embed Pods Frameworks */, 451DE9EE1DC1546A00810E42 /* [Carthage] Copy Frameworks */, @@ -3025,18 +3025,19 @@ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; - 34C239432180B01B00B6108F /* ShellScript */ = { + 34C239432180B01B00B6108F /* Run Script: update_list_info */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); + name = "Run Script: update_list_info"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Capture hash & comment from last WebRTC git commit.\ncd $PROJECT_DIR/ThirdParty/WebRTC/\n_git_commit=`git log --pretty=oneline | head -1`\ncd $PROJECT_DIR\n\n# Remove existing .plist entry, if any.\n/usr/libexec/PlistBuddy -c \"Delete BuildDetails\" Signal/Signal-Info.plist || true\n# Add new .plist entry.\n/usr/libexec/PlistBuddy -c \"add BuildDetails dict\" Signal/Signal-Info.plist\n\n/usr/libexec/PlistBuddy -c \"add :BuildDetails:WebRTCCommit string '$_git_commit'\" Signal/Signal-Info.plist\n\n_osx_version=`defaults read loginwindow SystemVersionStampAsString`\n/usr/libexec/PlistBuddy -c \"add :BuildDetails:OSXVersion string '$_osx_version'\" Signal/Signal-Info.plist\n\n_cocoapods_version=`pod --version`\n/usr/libexec/PlistBuddy -c \"add :BuildDetails:CocoapodsVersion string '$_cocoapods_version'\" Signal/Signal-Info.plist\n\n_carthage_version=`carthage version`\n/usr/libexec/PlistBuddy -c \"add :BuildDetails:CarthageVersion string '$_carthage_version'\" Signal/Signal-Info.plist\n\necho \"CONFIGURATION: ${CONFIGURATION}\"\nif [ \"${CONFIGURATION}\" = \"App Store Release\" ]; then\n /usr/libexec/PlistBuddy -c \"add :BuildDetails:XCodeVersion string '${XCODE_VERSION_MAJOR}.${XCODE_VERSION_MINOR}'\" Signal/Signal-Info.plist\n\n # Use UTC\n _build_datetime=`date -u`\n /usr/libexec/PlistBuddy -c \"add :BuildDetails:DateTime string '$_build_datetime'\" Signal/Signal-Info.plist\nfi\n"; + shellScript = "$PROJECT_DIR/Scripts/update_plist_info.sh\n"; }; 451DE9EE1DC1546A00810E42 /* [Carthage] Copy Frameworks */ = { isa = PBXShellScriptBuildPhase; From 5213fbe210254b1fc2e809007a04de710e9e1b2e Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 26 Nov 2018 17:52:50 -0700 Subject: [PATCH 2/6] make runnable from command line --- Scripts/update_plist_info.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Scripts/update_plist_info.sh b/Scripts/update_plist_info.sh index 20ca9b4c8..e64dda58a 100755 --- a/Scripts/update_plist_info.sh +++ b/Scripts/update_plist_info.sh @@ -1,5 +1,11 @@ #!/bin/sh +# PROJECT_DIR will be set when run from xcode, else we infer it +if [ "${PROJECT_DIR}" = "" ]; then + PROJECT_DIR=`git rev-parse --show-toplevel` + echo "inferred ${PROJECT_DIR}" +fi + # Capture hash & comment from last WebRTC git commit. cd $PROJECT_DIR/ThirdParty/WebRTC/ _git_commit=`git log --pretty=oneline | head -1` From 63553a782baee892e3d2c5fb1a823572863f4b28 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 26 Nov 2018 17:53:07 -0700 Subject: [PATCH 3/6] fail on any error --- Scripts/update_plist_info.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Scripts/update_plist_info.sh b/Scripts/update_plist_info.sh index e64dda58a..4c2f412b9 100755 --- a/Scripts/update_plist_info.sh +++ b/Scripts/update_plist_info.sh @@ -1,5 +1,7 @@ #!/bin/sh +set -e + # PROJECT_DIR will be set when run from xcode, else we infer it if [ "${PROJECT_DIR}" = "" ]; then PROJECT_DIR=`git rev-parse --show-toplevel` From db6357c53c829fe42f98bf2488810cfc4256cd61 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 26 Nov 2018 17:53:29 -0700 Subject: [PATCH 4/6] use bundle to report accurate cocoapods --- Scripts/update_plist_info.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Scripts/update_plist_info.sh b/Scripts/update_plist_info.sh index 4c2f412b9..b00ef4549 100755 --- a/Scripts/update_plist_info.sh +++ b/Scripts/update_plist_info.sh @@ -2,6 +2,9 @@ set -e +# ensure rbenv/bundler is in our path +PATH=$PATH:~/.rbenv/shims + # PROJECT_DIR will be set when run from xcode, else we infer it if [ "${PROJECT_DIR}" = "" ]; then PROJECT_DIR=`git rev-parse --show-toplevel` @@ -23,7 +26,7 @@ cd $PROJECT_DIR _osx_version=`defaults read loginwindow SystemVersionStampAsString` /usr/libexec/PlistBuddy -c "add :BuildDetails:OSXVersion string '$_osx_version'" Signal/Signal-Info.plist -_cocoapods_version=`pod --version` +_cocoapods_version=`bundle exec pod --version` /usr/libexec/PlistBuddy -c "add :BuildDetails:CocoapodsVersion string '$_cocoapods_version'" Signal/Signal-Info.plist _carthage_version=`carthage version` From d0a5bcd5cd3a8ba1737849b791471c59d75e9b49 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 28 Nov 2018 17:13:53 -0700 Subject: [PATCH 5/6] remove gem version logging from, since the canonical version is in the Gemfile.lock --- Scripts/update_plist_info.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Scripts/update_plist_info.sh b/Scripts/update_plist_info.sh index b00ef4549..830facd05 100755 --- a/Scripts/update_plist_info.sh +++ b/Scripts/update_plist_info.sh @@ -2,9 +2,6 @@ set -e -# ensure rbenv/bundler is in our path -PATH=$PATH:~/.rbenv/shims - # PROJECT_DIR will be set when run from xcode, else we infer it if [ "${PROJECT_DIR}" = "" ]; then PROJECT_DIR=`git rev-parse --show-toplevel` @@ -26,9 +23,6 @@ cd $PROJECT_DIR _osx_version=`defaults read loginwindow SystemVersionStampAsString` /usr/libexec/PlistBuddy -c "add :BuildDetails:OSXVersion string '$_osx_version'" Signal/Signal-Info.plist -_cocoapods_version=`bundle exec pod --version` -/usr/libexec/PlistBuddy -c "add :BuildDetails:CocoapodsVersion string '$_cocoapods_version'" Signal/Signal-Info.plist - _carthage_version=`carthage version` /usr/libexec/PlistBuddy -c "add :BuildDetails:CarthageVersion string '$_carthage_version'" Signal/Signal-Info.plist From d66221d46e3d63ac1dc221e9071a835f6708ef67 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 28 Nov 2018 17:14:26 -0700 Subject: [PATCH 6/6] update BuildDetails --- Signal/Signal-Info.plist | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index f3828dc8f..cb400c45e 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -5,11 +5,9 @@ BuildDetails CarthageVersion - 0.31.1 - CocoapodsVersion - 1.5.3 + 0.31.2 OSXVersion - 10.13.6 + 10.14.1 WebRTCCommit ca71024b4993ba95e3e6b8d0758004cffc54ddaf M70