From 38f3321e9a973b9376605502f6d8b15a56edf096 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 25 Oct 2018 10:18:09 -0400 Subject: [PATCH 1/3] Improve startup logging. --- Signal.xcodeproj/project.pbxproj | 2 +- Signal/Signal-Info.plist | 12 +++++++++++- Signal/src/AppDelegate.m | 21 +++++++++++++-------- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 711a3ed0d..48efb5548 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2933,7 +2933,7 @@ ); 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# Remove existing .plist entry, if any.\n/usr/libexec/PlistBuddy -c \"Delete WebRTCCommit\" Signal/Signal-Info.plist || true\n# Add new .plist entry.\n/usr/libexec/PlistBuddy -c \"add WebRTCCommit string '$_git_commit'\" Signal/Signal-Info.plist\n"; + 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# Remove existing .plist entry, if any.\n/usr/libexec/PlistBuddy -c \"Delete WebRTCCommit\" Signal/Signal-Info.plist || true\n# Add new .plist entry.\n/usr/libexec/PlistBuddy -c \"add WebRTCCommit string '$_git_commit'\" Signal/Signal-Info.plist\n\n/usr/libexec/PlistBuddy -c \"Delete BuildXCodeVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildXCodeVersion string '${XCODE_VERSION_MAJOR}.${XCODE_VERSION_MINOR}'\" Signal/Signal-Info.plist\n\n_osx_version=`defaults read loginwindow SystemVersionStampAsString`\n/usr/libexec/PlistBuddy -c \"Delete BuildOSXVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildOSXVersion string '$_osx_version'\" Signal/Signal-Info.plist\n\n_cocoapods_version=`pod --version`\n/usr/libexec/PlistBuddy -c \"Delete BuildCocoapodsVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildCocoapodsVersion string '$_cocoapods_version'\" Signal/Signal-Info.plist\n\n_carthage_version=`carthage version`\n/usr/libexec/PlistBuddy -c \"Delete BuildCarthageVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildCarthageVersion string '$_carthage_version'\" Signal/Signal-Info.plist\n\n"; }; 451DE9EE1DC1546A00810E42 /* [Carthage] Copy Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 115b1d823..2c24f5f0a 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -2,6 +2,14 @@ + BuildCarthageVersion + 0.31.0 + BuildCocoapodsVersion + 1.5.3 + BuildOSXVersion + 10.13.6 + BuildXCodeVersion + 0900.0940 CFBundleDevelopmentRegion en CFBundleDisplayName @@ -136,6 +144,8 @@ UIViewControllerBasedStatusBarAppearance WebRTCCommit - af8b6b232df749574744cd5d092227f8559969f9 M69 + ca71024b4993ba95e3e6b8d0758004cffc54ddaf M70 + XCodeVersion + 0900.0940 diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 8c475d095..afdb2237b 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -49,7 +49,7 @@ #import #import #import -#import +#import @import WebRTC; @import Intents; @@ -468,15 +468,20 @@ static NSTimeInterval launchStartedAt; OWSLogInfo(@"Language Code: %@", languageCode); } - size_t size; - sysctlbyname("hw.machine", NULL, &size, NULL, 0); - char *machine = malloc(size); - sysctlbyname("hw.machine", machine, &size, NULL, 0); - NSString *platform = [NSString stringWithUTF8String:machine]; - free(machine); + struct utsname systemInfo; + uname(&systemInfo); + + OWSLogInfo(@"Device Model: %@ (%@)", + UIDevice.currentDevice.model, + [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]); - OWSLogInfo(@"iPhone Version: %@", platform); OWSLogInfo(@"WebRTC Commit: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"WebRTCCommit"]); + OWSLogInfo(@"Build XCode Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildXCodeVersion"]); + OWSLogInfo(@"Build OS X Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildOSXVersion"]); + OWSLogInfo( + @"Build Cocoapods Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildCocoapodsVersion"]); + OWSLogInfo( + @"Build Carthage Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildCarthageVersion"]); } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken From ed4fa2e8cb18444b454980ccf9682b6b90b3bb5f Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Thu, 25 Oct 2018 16:08:02 -0400 Subject: [PATCH 2/3] Respond to CR. --- Signal.xcodeproj/project.pbxproj | 2 +- Signal/Signal-Info.plist | 27 +++++++++++++++------------ Signal/src/AppDelegate.m | 15 ++++++++------- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index 48efb5548..f2a896ce8 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2933,7 +2933,7 @@ ); 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# Remove existing .plist entry, if any.\n/usr/libexec/PlistBuddy -c \"Delete WebRTCCommit\" Signal/Signal-Info.plist || true\n# Add new .plist entry.\n/usr/libexec/PlistBuddy -c \"add WebRTCCommit string '$_git_commit'\" Signal/Signal-Info.plist\n\n/usr/libexec/PlistBuddy -c \"Delete BuildXCodeVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildXCodeVersion string '${XCODE_VERSION_MAJOR}.${XCODE_VERSION_MINOR}'\" Signal/Signal-Info.plist\n\n_osx_version=`defaults read loginwindow SystemVersionStampAsString`\n/usr/libexec/PlistBuddy -c \"Delete BuildOSXVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildOSXVersion string '$_osx_version'\" Signal/Signal-Info.plist\n\n_cocoapods_version=`pod --version`\n/usr/libexec/PlistBuddy -c \"Delete BuildCocoapodsVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildCocoapodsVersion string '$_cocoapods_version'\" Signal/Signal-Info.plist\n\n_carthage_version=`carthage version`\n/usr/libexec/PlistBuddy -c \"Delete BuildCarthageVersion\" Signal/Signal-Info.plist || true\n/usr/libexec/PlistBuddy -c \"add BuildCarthageVersion string '$_carthage_version'\" Signal/Signal-Info.plist\n\n"; + 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/usr/libexec/PlistBuddy -c \"add :BuildDetails:XCodeVersion string '${XCODE_VERSION_MAJOR}.${XCODE_VERSION_MINOR}'\" 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\n# Use UTC\n_build_datetime=`date -u`\n/usr/libexec/PlistBuddy -c \"add :BuildDetails:DateTime string '$_build_datetime'\" Signal/Signal-Info.plist\n"; }; 451DE9EE1DC1546A00810E42 /* [Carthage] Copy Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index 2c24f5f0a..bcd4285b5 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -2,14 +2,21 @@ - BuildCarthageVersion - 0.31.0 - BuildCocoapodsVersion - 1.5.3 - BuildOSXVersion - 10.13.6 - BuildXCodeVersion - 0900.0940 + BuildDetails + + CarthageVersion + 0.31.0 + CocoapodsVersion + 1.5.3 + DateTime + Thu Oct 25 20:07:42 UTC 2018 + OSXVersion + 10.13.6 + WebRTCCommit + ca71024b4993ba95e3e6b8d0758004cffc54ddaf M70 + XCodeVersion + 0900.0940 + CFBundleDevelopmentRegion en CFBundleDisplayName @@ -143,9 +150,5 @@ UIViewControllerBasedStatusBarAppearance - WebRTCCommit - ca71024b4993ba95e3e6b8d0758004cffc54ddaf M70 - XCodeVersion - 0900.0940 diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index afdb2237b..53a1a184a 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -475,13 +475,14 @@ static NSTimeInterval launchStartedAt; UIDevice.currentDevice.model, [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]); - OWSLogInfo(@"WebRTC Commit: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"WebRTCCommit"]); - OWSLogInfo(@"Build XCode Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildXCodeVersion"]); - OWSLogInfo(@"Build OS X Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildOSXVersion"]); - OWSLogInfo( - @"Build Cocoapods Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildCocoapodsVersion"]); - OWSLogInfo( - @"Build Carthage Version: %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildCarthageVersion"]); + NSDictionary *buildDetails = + [[NSBundle mainBundle] objectForInfoDictionaryKey:@"BuildDetails"]; + OWSLogInfo(@"WebRTC Commit: %@", buildDetails[@"WebRTCCommit"]); + OWSLogInfo(@"Build XCode Version: %@", buildDetails[@"XCodeVersion"]); + OWSLogInfo(@"Build OS X Version: %@", buildDetails[@"OSXVersion"]); + OWSLogInfo(@"Build Cocoapods Version: %@", buildDetails[@"CocoapodsVersion"]); + OWSLogInfo(@"Build Carthage Version: %@", buildDetails[@"CarthageVersion"]); + OWSLogInfo(@"Build Date/Time: %@", buildDetails[@"DateTime"]); } - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken From bf1f9e706a81708c2b42c14c510e1b1ee8691caa Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Fri, 26 Oct 2018 15:17:37 -0400 Subject: [PATCH 3/3] Exclude date/time and Xcode version info in debug builds to avoid churn. --- Signal.xcodeproj/project.pbxproj | 4 ++-- Signal.xcodeproj/xcshareddata/xcschemes/Signal.xcscheme | 4 ++-- Signal/Signal-Info.plist | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Signal.xcodeproj/project.pbxproj b/Signal.xcodeproj/project.pbxproj index f2a896ce8..83be1b97b 100644 --- a/Signal.xcodeproj/project.pbxproj +++ b/Signal.xcodeproj/project.pbxproj @@ -2594,12 +2594,12 @@ 45AE48531E073428004D96C2 /* Swift Lint */, D221A085169C9E5E00537ABF /* Sources */, D221A086169C9E5E00537ABF /* Frameworks */, + 34C239432180B01B00B6108F /* ShellScript */, D221A087169C9E5E00537ABF /* Resources */, 59C9DBA462715B5C999FFB02 /* [CP] Embed Pods Frameworks */, 451DE9EE1DC1546A00810E42 /* [Carthage] Copy Frameworks */, 453518771FC635DD00210559 /* Embed App Extensions */, 4535189F1FC63DBF00210559 /* Embed Frameworks */, - 34C239432180B01B00B6108F /* ShellScript */, ); buildRules = ( ); @@ -2933,7 +2933,7 @@ ); 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/usr/libexec/PlistBuddy -c \"add :BuildDetails:XCodeVersion string '${XCODE_VERSION_MAJOR}.${XCODE_VERSION_MINOR}'\" 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\n# Use UTC\n_build_datetime=`date -u`\n/usr/libexec/PlistBuddy -c \"add :BuildDetails:DateTime string '$_build_datetime'\" Signal/Signal-Info.plist\n"; + 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"; }; 451DE9EE1DC1546A00810E42 /* [Carthage] Copy Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/Signal.xcodeproj/xcshareddata/xcschemes/Signal.xcscheme b/Signal.xcodeproj/xcshareddata/xcschemes/Signal.xcscheme index 0fa087f1d..f5fde70a8 100644 --- a/Signal.xcodeproj/xcshareddata/xcschemes/Signal.xcscheme +++ b/Signal.xcodeproj/xcshareddata/xcschemes/Signal.xcscheme @@ -56,7 +56,7 @@ skipped = "NO"> @@ -106,7 +106,7 @@ skipped = "NO"> diff --git a/Signal/Signal-Info.plist b/Signal/Signal-Info.plist index bcd4285b5..e360bd822 100644 --- a/Signal/Signal-Info.plist +++ b/Signal/Signal-Info.plist @@ -8,14 +8,10 @@ 0.31.0 CocoapodsVersion 1.5.3 - DateTime - Thu Oct 25 20:07:42 UTC 2018 OSXVersion 10.13.6 WebRTCCommit ca71024b4993ba95e3e6b8d0758004cffc54ddaf M70 - XCodeVersion - 0900.0940 CFBundleDevelopmentRegion en