├── .gitignore ├── BuildTimeLogger.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── BuildTimeLogger ├── BuildHistoryDatabase.swift ├── BuildHistoryEntry.swift ├── BuildTimeLogger-Bridging-Header.h ├── BuildTimeLoggerApp.swift ├── DataParser.swift ├── DerivedDataManager.swift ├── DevToolsInfo.swift ├── File.swift ├── HardwareInfo.swift ├── NSData+GZIP.h ├── NSData+GZIP.m ├── NetworkManager.swift ├── NotificationManager.swift ├── Result.swift ├── ResultProtocol.swift ├── SystemInfo.swift ├── SystemInfoManager.swift ├── TimeFormatter.swift ├── UserSettings.swift ├── XcodeDatabase+BuildHistoryEntry.swift ├── XcodeDatabase.swift ├── XcodeDatabaseManager.swift └── main.swift ├── LICENSE ├── README.md ├── notification.png ├── usage.png └── usage_remote.png /.gitignore: -------------------------------------------------------------------------------- 1 | BuildTimeLogger.xcodeproj/project.xcworkspace/contents.xcworkspacedata 2 | BuildTimeLogger.xcodeproj/project.xcworkspace/xcuserdata/marcin.religa.xcuserdatad/UserInterfaceState.xcuserstate 3 | BuildTimeLogger.xcodeproj/xcuserdata/marcin.religa.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist 4 | BuildTimeLogger.xcodeproj/xcuserdata/marcin.religa.xcuserdatad/xcschemes/BuildTimeLogger.xcscheme 5 | BuildTimeLogger.xcodeproj/xcuserdata/marcin.religa.xcuserdatad/xcschemes/xcschememanagement.plist 6 | -------------------------------------------------------------------------------- /BuildTimeLogger.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | DA29A7651E808BC10071865D /* HardwareInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA29A7641E808BC10071865D /* HardwareInfo.swift */; }; 11 | DA29A7671E808BDB0071865D /* SystemInfoManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA29A7661E808BDB0071865D /* SystemInfoManager.swift */; }; 12 | DA29A7691E80901E0071865D /* DevToolsInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA29A7681E80901E0071865D /* DevToolsInfo.swift */; }; 13 | DA29A76B1E80912F0071865D /* SystemInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA29A76A1E80912F0071865D /* SystemInfo.swift */; }; 14 | DA362A931E5E076900660B80 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA362A921E5E076900660B80 /* main.swift */; }; 15 | DA362A9A1E5E07EB00660B80 /* XcodeDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA362A991E5E07EB00660B80 /* XcodeDatabase.swift */; }; 16 | DA362A9F1E5E08B400660B80 /* NSData+GZIP.m in Sources */ = {isa = PBXBuildFile; fileRef = DA362A9E1E5E08B400660B80 /* NSData+GZIP.m */; }; 17 | DA362AA11E5E403700660B80 /* DerivedDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA362AA01E5E403600660B80 /* DerivedDataManager.swift */; }; 18 | DA362AA31E5E40DB00660B80 /* UserSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA362AA21E5E40DB00660B80 /* UserSettings.swift */; }; 19 | DA362AA51E5E410300660B80 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA362AA41E5E410300660B80 /* File.swift */; }; 20 | DA5B62581E67402B009DC651 /* BuildHistoryEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5B62571E67402B009DC651 /* BuildHistoryEntry.swift */; }; 21 | DA5B625A1E67406E009DC651 /* BuildTimeLoggerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5B62591E67406E009DC651 /* BuildTimeLoggerApp.swift */; }; 22 | DA5B625C1E67409A009DC651 /* BuildHistoryDatabase.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5B625B1E67409A009DC651 /* BuildHistoryDatabase.swift */; }; 23 | DA5B625E1E6740E5009DC651 /* XcodeDatabase+BuildHistoryEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA5B625D1E6740E5009DC651 /* XcodeDatabase+BuildHistoryEntry.swift */; }; 24 | DACC7AE31E70289000D43CB7 /* NotificationManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACC7AE21E70289000D43CB7 /* NotificationManager.swift */; }; 25 | DACC7B391E70538D00D43CB7 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACC7B371E70538D00D43CB7 /* Result.swift */; }; 26 | DACC7B3A1E70538D00D43CB7 /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACC7B381E70538D00D43CB7 /* ResultProtocol.swift */; }; 27 | DACC7B3C1E70571A00D43CB7 /* DataParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACC7B3B1E70571A00D43CB7 /* DataParser.swift */; }; 28 | DACC7B3F1E70582E00D43CB7 /* TimeFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACC7B3E1E70582E00D43CB7 /* TimeFormatter.swift */; }; 29 | DACC7B411E705A9400D43CB7 /* XcodeDatabaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DACC7B401E705A9400D43CB7 /* XcodeDatabaseManager.swift */; }; 30 | DAD7141D1E6F207200F71993 /* NetworkManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD7141C1E6F207200F71993 /* NetworkManager.swift */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXCopyFilesBuildPhase section */ 34 | DA362A8D1E5E076900660B80 /* CopyFiles */ = { 35 | isa = PBXCopyFilesBuildPhase; 36 | buildActionMask = 2147483647; 37 | dstPath = /usr/share/man/man1/; 38 | dstSubfolderSpec = 0; 39 | files = ( 40 | ); 41 | runOnlyForDeploymentPostprocessing = 1; 42 | }; 43 | /* End PBXCopyFilesBuildPhase section */ 44 | 45 | /* Begin PBXFileReference section */ 46 | DA29A7641E808BC10071865D /* HardwareInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HardwareInfo.swift; sourceTree = ""; }; 47 | DA29A7661E808BDB0071865D /* SystemInfoManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemInfoManager.swift; sourceTree = ""; }; 48 | DA29A7681E80901E0071865D /* DevToolsInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DevToolsInfo.swift; sourceTree = ""; }; 49 | DA29A76A1E80912F0071865D /* SystemInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SystemInfo.swift; sourceTree = ""; }; 50 | DA362A8F1E5E076900660B80 /* BuildTimeLogger */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BuildTimeLogger; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | DA362A921E5E076900660B80 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 52 | DA362A991E5E07EB00660B80 /* XcodeDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XcodeDatabase.swift; sourceTree = ""; }; 53 | DA362A9B1E5E089600660B80 /* BuildTimeLogger-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BuildTimeLogger-Bridging-Header.h"; sourceTree = ""; }; 54 | DA362A9D1E5E08B400660B80 /* NSData+GZIP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+GZIP.h"; sourceTree = ""; }; 55 | DA362A9E1E5E08B400660B80 /* NSData+GZIP.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+GZIP.m"; sourceTree = ""; }; 56 | DA362AA01E5E403600660B80 /* DerivedDataManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DerivedDataManager.swift; sourceTree = ""; }; 57 | DA362AA21E5E40DB00660B80 /* UserSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserSettings.swift; sourceTree = ""; }; 58 | DA362AA41E5E410300660B80 /* File.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = ""; }; 59 | DA5B62571E67402B009DC651 /* BuildHistoryEntry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildHistoryEntry.swift; sourceTree = ""; }; 60 | DA5B62591E67406E009DC651 /* BuildTimeLoggerApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildTimeLoggerApp.swift; sourceTree = ""; }; 61 | DA5B625B1E67409A009DC651 /* BuildHistoryDatabase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BuildHistoryDatabase.swift; sourceTree = ""; }; 62 | DA5B625D1E6740E5009DC651 /* XcodeDatabase+BuildHistoryEntry.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XcodeDatabase+BuildHistoryEntry.swift"; sourceTree = ""; }; 63 | DACC7AE21E70289000D43CB7 /* NotificationManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationManager.swift; sourceTree = ""; }; 64 | DACC7B371E70538D00D43CB7 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = ""; }; 65 | DACC7B381E70538D00D43CB7 /* ResultProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultProtocol.swift; sourceTree = ""; }; 66 | DACC7B3B1E70571A00D43CB7 /* DataParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataParser.swift; sourceTree = ""; }; 67 | DACC7B3E1E70582E00D43CB7 /* TimeFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimeFormatter.swift; sourceTree = ""; }; 68 | DACC7B401E705A9400D43CB7 /* XcodeDatabaseManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = XcodeDatabaseManager.swift; sourceTree = ""; }; 69 | DAD7141C1E6F207200F71993 /* NetworkManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkManager.swift; sourceTree = ""; }; 70 | /* End PBXFileReference section */ 71 | 72 | /* Begin PBXFrameworksBuildPhase section */ 73 | DA362A8C1E5E076900660B80 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | DA362A861E5E076900660B80 = { 84 | isa = PBXGroup; 85 | children = ( 86 | DA362A911E5E076900660B80 /* BuildTimeLogger */, 87 | DA362A901E5E076900660B80 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | DA362A901E5E076900660B80 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | DA362A8F1E5E076900660B80 /* BuildTimeLogger */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | DA362A911E5E076900660B80 /* BuildTimeLogger */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | DACC7B3D1E70582400D43CB7 /* Helpers */, 103 | DACC7B331E70535900D43CB7 /* Libraries */, 104 | DA5B625F1E674121009DC651 /* Managers */, 105 | DA5B62561E67400F009DC651 /* Models */, 106 | DA362A921E5E076900660B80 /* main.swift */, 107 | DA362A9B1E5E089600660B80 /* BuildTimeLogger-Bridging-Header.h */, 108 | DA5B62591E67406E009DC651 /* BuildTimeLoggerApp.swift */, 109 | DA5B625D1E6740E5009DC651 /* XcodeDatabase+BuildHistoryEntry.swift */, 110 | ); 111 | path = BuildTimeLogger; 112 | sourceTree = ""; 113 | }; 114 | DA5B62551E673FC1009DC651 /* GZIP */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | DA362A9D1E5E08B400660B80 /* NSData+GZIP.h */, 118 | DA362A9E1E5E08B400660B80 /* NSData+GZIP.m */, 119 | ); 120 | name = GZIP; 121 | sourceTree = ""; 122 | }; 123 | DA5B62561E67400F009DC651 /* Models */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | DA362AA41E5E410300660B80 /* File.swift */, 127 | DA5B62571E67402B009DC651 /* BuildHistoryEntry.swift */, 128 | DA362A991E5E07EB00660B80 /* XcodeDatabase.swift */, 129 | DA29A7641E808BC10071865D /* HardwareInfo.swift */, 130 | DA29A7681E80901E0071865D /* DevToolsInfo.swift */, 131 | DA29A76A1E80912F0071865D /* SystemInfo.swift */, 132 | ); 133 | name = Models; 134 | sourceTree = ""; 135 | }; 136 | DA5B625F1E674121009DC651 /* Managers */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | DA362AA01E5E403600660B80 /* DerivedDataManager.swift */, 140 | DA362AA21E5E40DB00660B80 /* UserSettings.swift */, 141 | DA5B625B1E67409A009DC651 /* BuildHistoryDatabase.swift */, 142 | DAD7141C1E6F207200F71993 /* NetworkManager.swift */, 143 | DACC7AE21E70289000D43CB7 /* NotificationManager.swift */, 144 | DACC7B3B1E70571A00D43CB7 /* DataParser.swift */, 145 | DACC7B401E705A9400D43CB7 /* XcodeDatabaseManager.swift */, 146 | DA29A7661E808BDB0071865D /* SystemInfoManager.swift */, 147 | ); 148 | name = Managers; 149 | sourceTree = ""; 150 | }; 151 | DACC7B331E70535900D43CB7 /* Libraries */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | DACC7B361E70537200D43CB7 /* ResultType */, 155 | DA5B62551E673FC1009DC651 /* GZIP */, 156 | ); 157 | name = Libraries; 158 | sourceTree = ""; 159 | }; 160 | DACC7B361E70537200D43CB7 /* ResultType */ = { 161 | isa = PBXGroup; 162 | children = ( 163 | DACC7B371E70538D00D43CB7 /* Result.swift */, 164 | DACC7B381E70538D00D43CB7 /* ResultProtocol.swift */, 165 | ); 166 | name = ResultType; 167 | sourceTree = ""; 168 | }; 169 | DACC7B3D1E70582400D43CB7 /* Helpers */ = { 170 | isa = PBXGroup; 171 | children = ( 172 | DACC7B3E1E70582E00D43CB7 /* TimeFormatter.swift */, 173 | ); 174 | name = Helpers; 175 | sourceTree = ""; 176 | }; 177 | /* End PBXGroup section */ 178 | 179 | /* Begin PBXNativeTarget section */ 180 | DA362A8E1E5E076900660B80 /* BuildTimeLogger */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = DA362A961E5E076900660B80 /* Build configuration list for PBXNativeTarget "BuildTimeLogger" */; 183 | buildPhases = ( 184 | DA362A8B1E5E076900660B80 /* Sources */, 185 | DA362A8C1E5E076900660B80 /* Frameworks */, 186 | DA362A8D1E5E076900660B80 /* CopyFiles */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | ); 192 | name = BuildTimeLogger; 193 | productName = BuildTimeLogger; 194 | productReference = DA362A8F1E5E076900660B80 /* BuildTimeLogger */; 195 | productType = "com.apple.product-type.tool"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | DA362A871E5E076900660B80 /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastSwiftUpdateCheck = 0820; 204 | LastUpgradeCheck = 1000; 205 | ORGANIZATIONNAME = "Marcin Religa"; 206 | TargetAttributes = { 207 | DA362A8E1E5E076900660B80 = { 208 | CreatedOnToolsVersion = 8.2; 209 | LastSwiftMigration = 1000; 210 | ProvisioningStyle = Automatic; 211 | }; 212 | }; 213 | }; 214 | buildConfigurationList = DA362A8A1E5E076900660B80 /* Build configuration list for PBXProject "BuildTimeLogger" */; 215 | compatibilityVersion = "Xcode 3.2"; 216 | developmentRegion = English; 217 | hasScannedForEncodings = 0; 218 | knownRegions = ( 219 | en, 220 | ); 221 | mainGroup = DA362A861E5E076900660B80; 222 | productRefGroup = DA362A901E5E076900660B80 /* Products */; 223 | projectDirPath = ""; 224 | projectRoot = ""; 225 | targets = ( 226 | DA362A8E1E5E076900660B80 /* BuildTimeLogger */, 227 | ); 228 | }; 229 | /* End PBXProject section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | DA362A8B1E5E076900660B80 /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | DACC7B411E705A9400D43CB7 /* XcodeDatabaseManager.swift in Sources */, 237 | DA362A9A1E5E07EB00660B80 /* XcodeDatabase.swift in Sources */, 238 | DACC7B3F1E70582E00D43CB7 /* TimeFormatter.swift in Sources */, 239 | DACC7B391E70538D00D43CB7 /* Result.swift in Sources */, 240 | DA5B62581E67402B009DC651 /* BuildHistoryEntry.swift in Sources */, 241 | DA29A7691E80901E0071865D /* DevToolsInfo.swift in Sources */, 242 | DA362AA51E5E410300660B80 /* File.swift in Sources */, 243 | DACC7B3A1E70538D00D43CB7 /* ResultProtocol.swift in Sources */, 244 | DA5B625A1E67406E009DC651 /* BuildTimeLoggerApp.swift in Sources */, 245 | DAD7141D1E6F207200F71993 /* NetworkManager.swift in Sources */, 246 | DA29A76B1E80912F0071865D /* SystemInfo.swift in Sources */, 247 | DA5B625C1E67409A009DC651 /* BuildHistoryDatabase.swift in Sources */, 248 | DA29A7651E808BC10071865D /* HardwareInfo.swift in Sources */, 249 | DACC7AE31E70289000D43CB7 /* NotificationManager.swift in Sources */, 250 | DA362A9F1E5E08B400660B80 /* NSData+GZIP.m in Sources */, 251 | DA362A931E5E076900660B80 /* main.swift in Sources */, 252 | DACC7B3C1E70571A00D43CB7 /* DataParser.swift in Sources */, 253 | DA29A7671E808BDB0071865D /* SystemInfoManager.swift in Sources */, 254 | DA362AA31E5E40DB00660B80 /* UserSettings.swift in Sources */, 255 | DA362AA11E5E403700660B80 /* DerivedDataManager.swift in Sources */, 256 | DA5B625E1E6740E5009DC651 /* XcodeDatabase+BuildHistoryEntry.swift in Sources */, 257 | ); 258 | runOnlyForDeploymentPostprocessing = 0; 259 | }; 260 | /* End PBXSourcesBuildPhase section */ 261 | 262 | /* Begin XCBuildConfiguration section */ 263 | DA362A941E5E076900660B80 /* Debug */ = { 264 | isa = XCBuildConfiguration; 265 | buildSettings = { 266 | ALWAYS_SEARCH_USER_PATHS = NO; 267 | CLANG_ANALYZER_NONNULL = YES; 268 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 269 | CLANG_CXX_LIBRARY = "libc++"; 270 | CLANG_ENABLE_MODULES = YES; 271 | CLANG_ENABLE_OBJC_ARC = YES; 272 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 273 | CLANG_WARN_BOOL_CONVERSION = YES; 274 | CLANG_WARN_COMMA = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 277 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 278 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 285 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 286 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 287 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 288 | CLANG_WARN_STRICT_PROTOTYPES = YES; 289 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 290 | CLANG_WARN_UNREACHABLE_CODE = YES; 291 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 292 | CODE_SIGN_IDENTITY = "-"; 293 | COPY_PHASE_STRIP = NO; 294 | DEBUG_INFORMATION_FORMAT = dwarf; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | ENABLE_TESTABILITY = YES; 297 | GCC_C_LANGUAGE_STANDARD = gnu99; 298 | GCC_DYNAMIC_NO_PIC = NO; 299 | GCC_NO_COMMON_BLOCKS = YES; 300 | GCC_OPTIMIZATION_LEVEL = 0; 301 | GCC_PREPROCESSOR_DEFINITIONS = ( 302 | "DEBUG=1", 303 | "$(inherited)", 304 | ); 305 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 306 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 307 | GCC_WARN_UNDECLARED_SELECTOR = YES; 308 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 309 | GCC_WARN_UNUSED_FUNCTION = YES; 310 | GCC_WARN_UNUSED_VARIABLE = YES; 311 | MACOSX_DEPLOYMENT_TARGET = 10.12; 312 | MTL_ENABLE_DEBUG_INFO = YES; 313 | ONLY_ACTIVE_ARCH = YES; 314 | SDKROOT = macosx; 315 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 316 | }; 317 | name = Debug; 318 | }; 319 | DA362A951E5E076900660B80 /* Release */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ALWAYS_SEARCH_USER_PATHS = NO; 323 | CLANG_ANALYZER_NONNULL = YES; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 325 | CLANG_CXX_LIBRARY = "libc++"; 326 | CLANG_ENABLE_MODULES = YES; 327 | CLANG_ENABLE_OBJC_ARC = YES; 328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 329 | CLANG_WARN_BOOL_CONVERSION = YES; 330 | CLANG_WARN_COMMA = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 335 | CLANG_WARN_EMPTY_BODY = YES; 336 | CLANG_WARN_ENUM_CONVERSION = YES; 337 | CLANG_WARN_INFINITE_RECURSION = YES; 338 | CLANG_WARN_INT_CONVERSION = YES; 339 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 340 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 341 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 343 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 344 | CLANG_WARN_STRICT_PROTOTYPES = YES; 345 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | CODE_SIGN_IDENTITY = "-"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 351 | ENABLE_NS_ASSERTIONS = NO; 352 | ENABLE_STRICT_OBJC_MSGSEND = YES; 353 | GCC_C_LANGUAGE_STANDARD = gnu99; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 356 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 357 | GCC_WARN_UNDECLARED_SELECTOR = YES; 358 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 359 | GCC_WARN_UNUSED_FUNCTION = YES; 360 | GCC_WARN_UNUSED_VARIABLE = YES; 361 | MACOSX_DEPLOYMENT_TARGET = 10.12; 362 | MTL_ENABLE_DEBUG_INFO = NO; 363 | SDKROOT = macosx; 364 | SWIFT_COMPILATION_MODE = wholemodule; 365 | }; 366 | name = Release; 367 | }; 368 | DA362A971E5E076900660B80 /* Debug */ = { 369 | isa = XCBuildConfiguration; 370 | buildSettings = { 371 | CLANG_ENABLE_MODULES = YES; 372 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 373 | PRODUCT_NAME = "$(TARGET_NAME)"; 374 | SWIFT_OBJC_BRIDGING_HEADER = "BuildTimeLogger/BuildTimeLogger-Bridging-Header.h"; 375 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 376 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 377 | SWIFT_VERSION = 4.2; 378 | }; 379 | name = Debug; 380 | }; 381 | DA362A981E5E076900660B80 /* Release */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | CLANG_ENABLE_MODULES = YES; 385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | SWIFT_OBJC_BRIDGING_HEADER = "BuildTimeLogger/BuildTimeLogger-Bridging-Header.h"; 388 | SWIFT_SWIFT3_OBJC_INFERENCE = Default; 389 | SWIFT_VERSION = 4.2; 390 | }; 391 | name = Release; 392 | }; 393 | /* End XCBuildConfiguration section */ 394 | 395 | /* Begin XCConfigurationList section */ 396 | DA362A8A1E5E076900660B80 /* Build configuration list for PBXProject "BuildTimeLogger" */ = { 397 | isa = XCConfigurationList; 398 | buildConfigurations = ( 399 | DA362A941E5E076900660B80 /* Debug */, 400 | DA362A951E5E076900660B80 /* Release */, 401 | ); 402 | defaultConfigurationIsVisible = 0; 403 | defaultConfigurationName = Release; 404 | }; 405 | DA362A961E5E076900660B80 /* Build configuration list for PBXNativeTarget "BuildTimeLogger" */ = { 406 | isa = XCConfigurationList; 407 | buildConfigurations = ( 408 | DA362A971E5E076900660B80 /* Debug */, 409 | DA362A981E5E076900660B80 /* Release */, 410 | ); 411 | defaultConfigurationIsVisible = 0; 412 | defaultConfigurationName = Release; 413 | }; 414 | /* End XCConfigurationList section */ 415 | }; 416 | rootObject = DA362A871E5E076900660B80 /* Project object */; 417 | } 418 | -------------------------------------------------------------------------------- /BuildTimeLogger.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /BuildTimeLogger/BuildHistoryDatabase.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BuildHistoryDatabase.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 01/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum BuildHistoryDatabaseKey: String { 12 | case buildHistory 13 | } 14 | 15 | struct BuildHistoryDatabase { 16 | func save(history: [BuildHistoryEntry]) { 17 | let historySerialized = history.map({ $0.serialized }) 18 | UserDefaults.standard.set(historySerialized, forKey: BuildHistoryDatabaseKey.buildHistory.rawValue) 19 | } 20 | 21 | func read() -> [BuildHistoryEntry]? { 22 | guard let buildHistorySerialized = UserDefaults.standard.object(forKey: BuildHistoryDatabaseKey.buildHistory.rawValue) as? [[String: Any]] else { 23 | return nil 24 | } 25 | 26 | let buildHistory: [BuildHistoryEntry] = buildHistorySerialized.compactMap({ 27 | if let buildTime = $0[BuildHistoryEntryKey.buildTime.rawValue] as? Int, 28 | let schemeName = $0[BuildHistoryEntryKey.schemeName.rawValue] as? String, 29 | let timestamp = $0[BuildHistoryEntryKey.timestamp.rawValue] as? TimeInterval { 30 | 31 | // TODO: Old entries in user defaults don't have username, so this stays as not required here. 32 | let username = $0[BuildHistoryEntryKey.username.rawValue] as? String ?? "unknown" 33 | return BuildHistoryEntry(buildTime: buildTime, schemeName: schemeName, date: Date(timeIntervalSince1970: timestamp), username: username) 34 | } 35 | 36 | return nil 37 | }) 38 | 39 | return buildHistory 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /BuildTimeLogger/BuildHistoryEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BuildHistoryEntry.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 01/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum BuildHistoryEntryKey: String { 12 | case buildTime 13 | case schemeName 14 | case timestamp 15 | case username 16 | } 17 | 18 | struct BuildHistoryEntry { 19 | let buildTime: Int 20 | let schemeName: String 21 | let date: Date 22 | let username: String 23 | 24 | var serialized: [String: Any] { 25 | return [ 26 | BuildHistoryEntryKey.buildTime.rawValue: buildTime, 27 | BuildHistoryEntryKey.schemeName.rawValue: schemeName, 28 | BuildHistoryEntryKey.timestamp.rawValue: date.timeIntervalSince1970, 29 | BuildHistoryEntryKey.username.rawValue: username 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /BuildTimeLogger/BuildTimeLogger-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // BuildTimeLogger-Bridging-Header.h 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 22/02/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | #ifndef BuildTimeLogger_Bridging_Header_h 10 | #define BuildTimeLogger_Bridging_Header_h 11 | 12 | // 13 | // Use this file to import your target's public headers that you would like to expose to Swift. 14 | // 15 | 16 | #import "NSData+GZIP.h" 17 | 18 | #endif /* BuildTimeLogger_Bridging_Header_h */ 19 | -------------------------------------------------------------------------------- /BuildTimeLogger/BuildTimeLoggerApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BuildTimeLoggerApp.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 01/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | final class BuildTimeLoggerApp { 12 | private let buildHistoryDatabase: BuildHistoryDatabase 13 | private let notificationManager: NotificationManager 14 | private let dataParser: DataParser 15 | private let xcodeDatabaseManager: XcodeDatabaseManager 16 | private let systemInfoManager: SystemInfoManager 17 | 18 | private var buildHistory: [BuildHistoryEntry]? 19 | 20 | init(buildHistoryDatabase: BuildHistoryDatabase = BuildHistoryDatabase(), 21 | notificationManager: NotificationManager = NotificationManager(), 22 | dataParser: DataParser = DataParser(), 23 | xcodeDatabaseManager: XcodeDatabaseManager = XcodeDatabaseManager(), 24 | systemInfoManager: SystemInfoManager = SystemInfoManager()) { 25 | self.buildHistoryDatabase = buildHistoryDatabase 26 | self.notificationManager = notificationManager 27 | self.dataParser = dataParser 28 | self.xcodeDatabaseManager = xcodeDatabaseManager 29 | self.systemInfoManager = systemInfoManager 30 | } 31 | 32 | func run() { 33 | switch CommandLine.arguments.count { 34 | case 2: 35 | print("Updating local build history...") 36 | updateBuildHistory() 37 | showNotification() 38 | 39 | guard let buildHistory = buildHistory, let latestBuildData = buildHistory.last else { 40 | return 41 | } 42 | 43 | print("Storing data remotely...") 44 | if let remoteStorageURL = URL(string: CommandLine.arguments[1]) { 45 | storeDataRemotely(buildData: latestBuildData, atURL: remoteStorageURL) 46 | } 47 | case 3: 48 | print("Fetching remote data...") 49 | if let remoteStorageURL = URL(string: CommandLine.arguments[1]) { 50 | fetchRemoteData(atURL: remoteStorageURL) 51 | } 52 | default: 53 | print("Updating local build history...") 54 | updateBuildHistory() 55 | showNotification() 56 | } 57 | } 58 | 59 | private func fetchRemoteData(atURL url: URL) { 60 | let networkManager = NetworkManager(remoteStorageURL: url) 61 | networkManager.fetchData { [weak self] result in 62 | switch result { 63 | case .success(let data): 64 | self?.dataParser.parse(data: data) 65 | case .failure: 66 | print("error") 67 | } 68 | } 69 | } 70 | 71 | private func storeDataRemotely(buildData: BuildHistoryEntry, atURL url: URL) { 72 | let systemInfo = systemInfoManager.read() 73 | let networkManager = NetworkManager(remoteStorageURL: url) 74 | networkManager.sendData(username: buildData.username, timestamp: Int(NSDate().timeIntervalSince1970), buildTime: buildData.buildTime, schemeName: buildData.schemeName, systemInfo: systemInfo) 75 | } 76 | 77 | private func showNotification() { 78 | guard let buildHistory = buildHistory, let latestBuildData = buildHistory.last else { 79 | return 80 | } 81 | 82 | let buildEntriesFromToday = dataParser.buildEntriesFromToday(in: buildHistory) 83 | let totalTime = dataParser.totalBuildTime(for: buildEntriesFromToday) 84 | 85 | let latestBuildTimeFormatted = TimeFormatter.format(time: latestBuildData.buildTime) 86 | let totalBuildsTimeTodayFormatted = TimeFormatter.format(time: totalTime) 87 | 88 | let numberOfBuildsToday = buildEntriesFromToday.count 89 | let averageBuildtimeToday = TimeFormatter.format(time: totalTime / numberOfBuildsToday) 90 | 91 | notificationManager.showNotification(message: "current \(latestBuildTimeFormatted)\ntotal today \(totalBuildsTimeTodayFormatted) / avg \(averageBuildtimeToday) / \(numberOfBuildsToday) builds") 92 | } 93 | 94 | private func updateBuildHistory() { 95 | guard let latestBuildData = xcodeDatabaseManager.latestBuildData else { 96 | return 97 | } 98 | 99 | let updatedBuildHistoryData: [BuildHistoryEntry] 100 | 101 | if var buildHistoryData = buildHistoryDatabase.read() { 102 | buildHistoryData.append(latestBuildData.buildHistoryEntry) 103 | updatedBuildHistoryData = buildHistoryData 104 | } else { 105 | updatedBuildHistoryData = [latestBuildData.buildHistoryEntry] 106 | } 107 | 108 | buildHistoryDatabase.save(history: updatedBuildHistoryData) 109 | buildHistory = updatedBuildHistoryData 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /BuildTimeLogger/DataParser.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DataParser.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 08/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct DataParser { 12 | func parse(data: Data) { 13 | guard let responseJSON = parseResponse(data: data) else { 14 | return 15 | } 16 | 17 | let buildHistory = parse(json: responseJSON) 18 | 19 | let allUsernames = Set(buildHistory.flatMap({ $0.username })) 20 | 21 | for username in allUsernames { 22 | let entries = buildHistory.filter({ $0.username == String(username) }) 23 | 24 | let buildTimeTotalToday = totalBuildTime(for: buildEntriesFromToday(in: entries)) 25 | let buildTimeTotal = totalBuildTime(for: entries) 26 | 27 | let buildTimeTotalTodayFormatted = TimeFormatter.format(time: buildTimeTotalToday) 28 | let buildTimeTotalFormatted = TimeFormatter.format(time: buildTimeTotal) 29 | 30 | print("username: \(username)\nbuild time today: \(buildTimeTotalTodayFormatted)\ntotal build time: \(buildTimeTotalFormatted)\n") 31 | } 32 | } 33 | 34 | func buildEntriesFromToday(in buildHistoryData: [BuildHistoryEntry]) -> [BuildHistoryEntry] { 35 | return buildHistoryData.filter({ 36 | Calendar.current.isDateInToday($0.date) 37 | }) 38 | } 39 | 40 | func totalBuildTime(for buildHistoryData: [BuildHistoryEntry]) -> Int { 41 | return buildHistoryData.reduce(0, { 42 | return $0 + $1.buildTime 43 | }) 44 | } 45 | 46 | private func parseResponse(data: Data) -> [String: Any]? { 47 | do { 48 | let json = try JSONSerialization.jsonObject(with: data, options: []) 49 | 50 | if let responseData = json as? [String: Any] { 51 | return responseData 52 | } 53 | } catch { 54 | print("JSON parsing error") 55 | } 56 | 57 | return nil 58 | } 59 | 60 | private func parse(json: [String: Any]) -> [BuildHistoryEntry] { 61 | return json.compactMap({ 62 | guard let record = $0.value as? [String: String] else { 63 | return nil 64 | } 65 | 66 | guard let username = record[BuildHistoryEntryKey.username.rawValue], 67 | let timestampStr = record[BuildHistoryEntryKey.timestamp.rawValue], 68 | let timestamp = TimeInterval(timestampStr), 69 | let buildTimeStr = record[BuildHistoryEntryKey.buildTime.rawValue], 70 | let buildTime = Int(buildTimeStr) else { 71 | return nil 72 | } 73 | 74 | // TODO: This needs to stay non required here for now, as it's a newly added param and doesn't exist in older records. 75 | let schemeName = record[BuildHistoryEntryKey.schemeName.rawValue] ?? "" 76 | return BuildHistoryEntry(buildTime: buildTime, schemeName: schemeName, date: Date(timeIntervalSince1970: timestamp), username: username) 77 | }) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /BuildTimeLogger/DerivedDataManager.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2016 Robert Gummesson 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // 24 | // DerivedDataManager.swift 25 | // BuildTimeAnalyzer 26 | // 27 | 28 | import Foundation 29 | 30 | class DerivedDataManager { 31 | 32 | static func derivedData() -> [File] { 33 | let url = URL(fileURLWithPath: UserSettings.derivedDataLocation) 34 | 35 | let folders = DerivedDataManager.listFolders(at: url) 36 | let fileManager = FileManager.default 37 | 38 | return folders.compactMap{ (url) -> File? in 39 | if url.lastPathComponent != "ModuleCache", 40 | let properties = try? fileManager.attributesOfItem(atPath: url.path), 41 | let modificationDate = properties[FileAttributeKey.modificationDate] as? Date { 42 | return File(date: modificationDate, url: url) 43 | } 44 | return nil 45 | }.sorted{ $0.date > $1.date } 46 | } 47 | 48 | static func listFolders(at url: URL) -> [URL] { 49 | let fileManager = FileManager.default 50 | let keys = [URLResourceKey.nameKey, URLResourceKey.isDirectoryKey] 51 | let options: FileManager.DirectoryEnumerationOptions = [.skipsHiddenFiles, .skipsPackageDescendants, .skipsSubdirectoryDescendants] 52 | 53 | guard let enumerator = fileManager.enumerator(at: url, includingPropertiesForKeys: keys, options: options, errorHandler: nil) else { return [] } 54 | 55 | return enumerator.map{ $0 as! URL } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /BuildTimeLogger/DevToolsInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DevToolsInfo.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 20/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum DevToolsInfoKey: String { 12 | case devToolsVersion 13 | } 14 | 15 | struct DevToolsInfo { 16 | let version: String 17 | } 18 | -------------------------------------------------------------------------------- /BuildTimeLogger/File.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2016 Robert Gummesson 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // 24 | // File.swift 25 | // BuildTimeAnalyzer 26 | // 27 | 28 | import Foundation 29 | 30 | struct File { 31 | let date: Date 32 | let url: URL 33 | } 34 | -------------------------------------------------------------------------------- /BuildTimeLogger/HardwareInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // HardwareInfo.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 20/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum HardwareInfoKey: String { 12 | case cpuType 13 | case cpuSpeed 14 | case machineModel 15 | case physicalMemory 16 | case numberOfProcessors 17 | } 18 | 19 | struct HardwareInfo { 20 | let cpuType: String 21 | let cpuSpeed: String 22 | let machineModel: String 23 | let physicalMemory: String 24 | let numberOfProcessors: Int 25 | } 26 | -------------------------------------------------------------------------------- /BuildTimeLogger/NSData+GZIP.h: -------------------------------------------------------------------------------- 1 | // 2 | // GZIP.h 3 | // 4 | // Version 1.1.1 5 | // 6 | // Created by Nick Lockwood on 03/06/2012. 7 | // Copyright (C) 2012 Charcoal Design 8 | // 9 | // Distributed under the permissive zlib License 10 | // Get the latest version from here: 11 | // 12 | // https://github.com/nicklockwood/GZIP 13 | // 14 | // This software is provided 'as-is', without any express or implied 15 | // warranty. In no event will the authors be held liable for any damages 16 | // arising from the use of this software. 17 | // 18 | // Permission is granted to anyone to use this software for any purpose, 19 | // including commercial applications, and to alter it and redistribute it 20 | // freely, subject to the following restrictions: 21 | // 22 | // 1. The origin of this software must not be misrepresented; you must not 23 | // claim that you wrote the original software. If you use this software 24 | // in a product, an acknowledgment in the product documentation would be 25 | // appreciated but is not required. 26 | // 27 | // 2. Altered source versions must be plainly marked as such, and must not be 28 | // misrepresented as being the original software. 29 | // 30 | // 3. This notice may not be removed or altered from any source distribution. 31 | // 32 | 33 | 34 | #import 35 | 36 | @interface NSData (GZIP) 37 | 38 | - (nullable NSData *)gzippedDataWithCompressionLevel:(float)level; 39 | - (nullable NSData *)gzippedData; 40 | - (nullable NSData *)gunzippedData; 41 | - (BOOL)isGzippedData; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /BuildTimeLogger/NSData+GZIP.m: -------------------------------------------------------------------------------- 1 | // 2 | // GZIP.m 3 | // 4 | // Version 1.1.1 5 | // 6 | // Created by Nick Lockwood on 03/06/2012. 7 | // Copyright (C) 2012 Charcoal Design 8 | // 9 | // Distributed under the permissive zlib License 10 | // Get the latest version from here: 11 | // 12 | // https://github.com/nicklockwood/GZIP 13 | // 14 | // This software is provided 'as-is', without any express or implied 15 | // warranty. In no event will the authors be held liable for any damages 16 | // arising from the use of this software. 17 | // 18 | // Permission is granted to anyone to use this software for any purpose, 19 | // including commercial applications, and to alter it and redistribute it 20 | // freely, subject to the following restrictions: 21 | // 22 | // 1. The origin of this software must not be misrepresented; you must not 23 | // claim that you wrote the original software. If you use this software 24 | // in a product, an acknowledgment in the product documentation would be 25 | // appreciated but is not required. 26 | // 27 | // 2. Altered source versions must be plainly marked as such, and must not be 28 | // misrepresented as being the original software. 29 | // 30 | // 3. This notice may not be removed or altered from any source distribution. 31 | // 32 | 33 | 34 | #import "NSData+GZIP.h" 35 | #import 36 | #import 37 | 38 | 39 | #pragma clang diagnostic ignored "-Wcast-qual" 40 | 41 | 42 | @implementation NSData (GZIP) 43 | 44 | static void *libzOpen() 45 | { 46 | static void *libz; 47 | static dispatch_once_t onceToken; 48 | dispatch_once(&onceToken, ^{ 49 | libz = dlopen("/usr/lib/libz.dylib", RTLD_LAZY); 50 | }); 51 | return libz; 52 | } 53 | 54 | - (NSData *)gzippedDataWithCompressionLevel:(float)level 55 | { 56 | if (self.length == 0 || [self isGzippedData]) 57 | { 58 | return self; 59 | } 60 | 61 | void *libz = libzOpen(); 62 | int (*deflateInit2_)(z_streamp, int, int, int, int, int, const char *, int) = 63 | (int (*)(z_streamp, int, int, int, int, int, const char *, int))dlsym(libz, "deflateInit2_"); 64 | int (*deflate)(z_streamp, int) = (int (*)(z_streamp, int))dlsym(libz, "deflate"); 65 | int (*deflateEnd)(z_streamp) = (int (*)(z_streamp))dlsym(libz, "deflateEnd"); 66 | 67 | z_stream stream; 68 | stream.zalloc = Z_NULL; 69 | stream.zfree = Z_NULL; 70 | stream.opaque = Z_NULL; 71 | stream.avail_in = (uint)self.length; 72 | stream.next_in = (Bytef *)(void *)self.bytes; 73 | stream.total_out = 0; 74 | stream.avail_out = 0; 75 | 76 | static const NSUInteger ChunkSize = 16384; 77 | 78 | NSMutableData *output = nil; 79 | int compression = (level < 0.0f)? Z_DEFAULT_COMPRESSION: (int)(roundf(level * 9)); 80 | if (deflateInit2(&stream, compression, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY) == Z_OK) 81 | { 82 | output = [NSMutableData dataWithLength:ChunkSize]; 83 | while (stream.avail_out == 0) 84 | { 85 | if (stream.total_out >= output.length) 86 | { 87 | output.length += ChunkSize; 88 | } 89 | stream.next_out = (uint8_t *)output.mutableBytes + stream.total_out; 90 | stream.avail_out = (uInt)(output.length - stream.total_out); 91 | deflate(&stream, Z_FINISH); 92 | } 93 | deflateEnd(&stream); 94 | output.length = stream.total_out; 95 | } 96 | 97 | return output; 98 | } 99 | 100 | - (NSData *)gzippedData 101 | { 102 | return [self gzippedDataWithCompressionLevel:-1.0f]; 103 | } 104 | 105 | - (NSData *)gunzippedData 106 | { 107 | if (self.length == 0 || ![self isGzippedData]) 108 | { 109 | return self; 110 | } 111 | 112 | void *libz = libzOpen(); 113 | int (*inflateInit2_)(z_streamp, int, const char *, int) = 114 | (int (*)(z_streamp, int, const char *, int))dlsym(libz, "inflateInit2_"); 115 | int (*inflate)(z_streamp, int) = (int (*)(z_streamp, int))dlsym(libz, "inflate"); 116 | int (*inflateEnd)(z_streamp) = (int (*)(z_streamp))dlsym(libz, "inflateEnd"); 117 | 118 | z_stream stream; 119 | stream.zalloc = Z_NULL; 120 | stream.zfree = Z_NULL; 121 | stream.avail_in = (uint)self.length; 122 | stream.next_in = (Bytef *)self.bytes; 123 | stream.total_out = 0; 124 | stream.avail_out = 0; 125 | 126 | NSMutableData *output = nil; 127 | if (inflateInit2(&stream, 47) == Z_OK) 128 | { 129 | int status = Z_OK; 130 | output = [NSMutableData dataWithCapacity:self.length * 2]; 131 | while (status == Z_OK) 132 | { 133 | if (stream.total_out >= output.length) 134 | { 135 | output.length += self.length / 2; 136 | } 137 | stream.next_out = (uint8_t *)output.mutableBytes + stream.total_out; 138 | stream.avail_out = (uInt)(output.length - stream.total_out); 139 | status = inflate (&stream, Z_SYNC_FLUSH); 140 | } 141 | if (inflateEnd(&stream) == Z_OK) 142 | { 143 | if (status == Z_STREAM_END) 144 | { 145 | output.length = stream.total_out; 146 | } 147 | } 148 | } 149 | 150 | return output; 151 | } 152 | 153 | - (BOOL)isGzippedData 154 | { 155 | const UInt8 *bytes = (const UInt8 *)self.bytes; 156 | return (self.length >= 2 && bytes[0] == 0x1f && bytes[1] == 0x8b); 157 | } 158 | 159 | @end 160 | -------------------------------------------------------------------------------- /BuildTimeLogger/NetworkManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NetworkManager.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 07/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum NetworkError: Error { 12 | case didFailToFetchData 13 | } 14 | 15 | final class NetworkManager { 16 | private let remoteStorageURL: URL 17 | 18 | init(remoteStorageURL: URL) { 19 | self.remoteStorageURL = remoteStorageURL 20 | } 21 | 22 | // TODO: use single BuildHistoryEntry object as an argument. 23 | func sendData(username: String, timestamp: Int, buildTime: Int, schemeName: String, systemInfo: SystemInfo?) { 24 | let semaphore = DispatchSemaphore(value: 0) 25 | 26 | var request = URLRequest(url: remoteStorageURL) 27 | request.httpMethod = "POST" 28 | var data: [String: Any] = [ 29 | BuildHistoryEntryKey.username.rawValue: username, 30 | BuildHistoryEntryKey.timestamp.rawValue: timestamp, 31 | BuildHistoryEntryKey.buildTime.rawValue: buildTime, 32 | BuildHistoryEntryKey.schemeName.rawValue: schemeName 33 | ] 34 | 35 | if let systemInfo = systemInfo { 36 | data[HardwareInfoKey.cpuType.rawValue] = systemInfo.hardware.cpuType 37 | data[HardwareInfoKey.cpuSpeed.rawValue] = systemInfo.hardware.cpuSpeed 38 | data[HardwareInfoKey.machineModel.rawValue] = systemInfo.hardware.machineModel 39 | data[HardwareInfoKey.physicalMemory.rawValue] = systemInfo.hardware.physicalMemory 40 | data[HardwareInfoKey.numberOfProcessors.rawValue] = systemInfo.hardware.numberOfProcessors 41 | data[DevToolsInfoKey.devToolsVersion.rawValue] = systemInfo.devTools.version 42 | } 43 | 44 | let postString = formatPOSTString(data: data) 45 | request.httpBody = postString.data(using: .utf8) 46 | let task = URLSession.shared.dataTask(with: request) { data, response, error in 47 | if let error = error { 48 | print("error: \(error)") 49 | } 50 | 51 | semaphore.signal() 52 | } 53 | task.resume() 54 | semaphore.wait(); 55 | } 56 | 57 | func fetchData(completion: @escaping (Result) -> Void) { 58 | let semaphore = DispatchSemaphore(value: 0) 59 | 60 | var request = URLRequest(url: remoteStorageURL) 61 | request.httpMethod = "GET" 62 | let task = URLSession.shared.dataTask(with: request) { data, response, error in 63 | guard let data = data, error == nil else { 64 | completion(.failure(NetworkError.didFailToFetchData)) 65 | return 66 | } 67 | 68 | completion(.success(data)) 69 | semaphore.signal() 70 | } 71 | task.resume() 72 | semaphore.wait(); 73 | } 74 | 75 | private func formatPOSTString(data: [String: Any]) -> String { 76 | var resultArr: [String] = [] 77 | 78 | for (key, value) in data { 79 | resultArr.append("\"\(key)\": \"\(value)\"") 80 | } 81 | 82 | return "{ " + resultArr.joined(separator: ", ") + " }" 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /BuildTimeLogger/NotificationManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationManager.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 08/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct NotificationManager { 12 | func showNotification(message: String) { 13 | // Apparetly can't display notification from console app using NSUserNotificationCenter, so using command line instead. 14 | Process.launchedProcess(launchPath: "/usr/bin/osascript", arguments: ["-e", "display notification \"\(message)\" with title \"Build time logger\""]) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BuildTimeLogger/Result.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Rob Rix. All rights reserved. 2 | 3 | /// An enum representing either a failure with an explanatory error, or a success with a result value. 4 | public enum Result: ResultProtocol, CustomStringConvertible, CustomDebugStringConvertible { 5 | case success(T) 6 | case failure(Error) 7 | 8 | // MARK: Constructors 9 | 10 | /// Constructs a success wrapping a `value`. 11 | public init(value: T) { 12 | self = .success(value) 13 | } 14 | 15 | /// Constructs a failure wrapping an `error`. 16 | public init(error: Error) { 17 | self = .failure(error) 18 | } 19 | 20 | /// Constructs a result from an `Optional`, failing with `Error` if `nil`. 21 | public init(_ value: T?, failWith: @autoclosure () -> Error) { 22 | self = value.map(Result.success) ?? .failure(failWith()) 23 | } 24 | 25 | /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. 26 | public init(_ f: @autoclosure () throws -> T) { 27 | self.init(attempt: f) 28 | } 29 | 30 | /// Constructs a result from a function that uses `throw`, failing with `Error` if throws. 31 | public init(attempt f: () throws -> T) { 32 | do { 33 | self = .success(try f()) 34 | } catch { 35 | self = .failure(error as! Error) 36 | } 37 | } 38 | 39 | // MARK: Deconstruction 40 | 41 | /// Returns the value from `success` Results or `throw`s the error. 42 | public func dematerialize() throws -> T { 43 | switch self { 44 | case let .success(value): 45 | return value 46 | case let .failure(error): 47 | throw error 48 | } 49 | } 50 | 51 | /// Case analysis for Result. 52 | /// 53 | /// Returns the value produced by applying `ifFailure` to `failure` Results, or `ifSuccess` to `success` Results. 54 | public func analysis(ifSuccess: (T) -> Result, ifFailure: (Error) -> Result) -> Result { 55 | switch self { 56 | case let .success(value): 57 | return ifSuccess(value) 58 | case let .failure(value): 59 | return ifFailure(value) 60 | } 61 | } 62 | 63 | // MARK: Errors 64 | 65 | /// The domain for errors constructed by Result. 66 | public static var errorDomain: String { return "com.antitypical.Result" } 67 | 68 | /// The userInfo key for source functions in errors constructed by Result. 69 | public static var functionKey: String { return "\(errorDomain).function" } 70 | 71 | /// The userInfo key for source file paths in errors constructed by Result. 72 | public static var fileKey: String { return "\(errorDomain).file" } 73 | 74 | /// The userInfo key for source file line numbers in errors constructed by Result. 75 | public static var lineKey: String { return "\(errorDomain).line" } 76 | 77 | /// Constructs an error. 78 | public static func error(_ message: String? = nil, function: String = #function, file: String = #file, line: Int = #line) -> NSError { 79 | var userInfo: [String: Any] = [ 80 | functionKey: function, 81 | fileKey: file, 82 | lineKey: line, 83 | ] 84 | 85 | if let message = message { 86 | userInfo[NSLocalizedDescriptionKey] = message 87 | } 88 | 89 | return NSError(domain: errorDomain, code: 0, userInfo: userInfo) 90 | } 91 | 92 | 93 | // MARK: CustomStringConvertible 94 | 95 | public var description: String { 96 | return analysis( 97 | ifSuccess: { ".success(\($0))" }, 98 | ifFailure: { ".failure(\($0))" }) 99 | } 100 | 101 | 102 | // MARK: CustomDebugStringConvertible 103 | 104 | public var debugDescription: String { 105 | return description 106 | } 107 | } 108 | 109 | // MARK: - Derive result from failable closure 110 | 111 | public func materialize(_ f: () throws -> T) -> Result { 112 | return materialize(try f()) 113 | } 114 | 115 | public func materialize(_ f: @autoclosure () throws -> T) -> Result { 116 | do { 117 | return .success(try f()) 118 | } catch { 119 | return .failure(AnyError(error)) 120 | } 121 | } 122 | 123 | @available(*, deprecated, message: "Use the overload which returns `Result` instead") 124 | public func materialize(_ f: () throws -> T) -> Result { 125 | return materialize(try f()) 126 | } 127 | 128 | @available(*, deprecated, message: "Use the overload which returns `Result` instead") 129 | public func materialize(_ f: @autoclosure () throws -> T) -> Result { 130 | do { 131 | return .success(try f()) 132 | } catch { 133 | // This isn't great, but it lets us maintain compatibility until this deprecated 134 | // method can be removed. 135 | #if _runtime(_ObjC) 136 | return .failure(error as NSError) 137 | #else 138 | // https://github.com/apple/swift-corelibs-foundation/blob/swift-3.0.2-RELEASE/Foundation/NSError.swift#L314 139 | let userInfo = _swift_Foundation_getErrorDefaultUserInfo(error) as? [String: Any] 140 | let nsError = NSError(domain: error._domain, code: error._code, userInfo: userInfo) 141 | return .failure(nsError) 142 | #endif 143 | } 144 | } 145 | 146 | // MARK: - Cocoa API conveniences 147 | 148 | #if !os(Linux) 149 | 150 | /// Constructs a `Result` with the result of calling `try` with an error pointer. 151 | /// 152 | /// This is convenient for wrapping Cocoa API which returns an object or `nil` + an error, by reference. e.g.: 153 | /// 154 | /// Result.try { NSData(contentsOfURL: URL, options: .dataReadingMapped, error: $0) } 155 | public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> T?) -> Result { 156 | var error: NSError? 157 | return `try`(&error).map(Result.success) ?? .failure(error ?? Result.error(function: function, file: file, line: line)) 158 | } 159 | 160 | /// Constructs a `Result` with the result of calling `try` with an error pointer. 161 | /// 162 | /// This is convenient for wrapping Cocoa API which returns a `Bool` + an error, by reference. e.g.: 163 | /// 164 | /// Result.try { NSFileManager.defaultManager().removeItemAtURL(URL, error: $0) } 165 | public func `try`(_ function: String = #function, file: String = #file, line: Int = #line, `try`: (NSErrorPointer) -> Bool) -> Result<(), NSError> { 166 | var error: NSError? 167 | return `try`(&error) ? 168 | .success(()) 169 | : .failure(error ?? Result<(), NSError>.error(function: function, file: file, line: line)) 170 | } 171 | 172 | #endif 173 | 174 | // MARK: - ErrorProtocolConvertible conformance 175 | 176 | extension NSError: ErrorProtocolConvertible { 177 | public static func error(from error: Swift.Error) -> Self { 178 | func cast(_ error: Swift.Error) -> T { 179 | return error as! T 180 | } 181 | 182 | return cast(error) 183 | } 184 | } 185 | 186 | // MARK: - Errors 187 | 188 | /// An “error” that is impossible to construct. 189 | /// 190 | /// This can be used to describe `Result`s where failures will never 191 | /// be generated. For example, `Result` describes a result that 192 | /// contains an `Int`eger and is guaranteed never to be a `failure`. 193 | public enum NoError: Swift.Error, Equatable { 194 | public static func ==(lhs: NoError, rhs: NoError) -> Bool { 195 | return true 196 | } 197 | } 198 | 199 | /// A type-erased error which wraps an arbitrary error instance. This should be 200 | /// useful for generic contexts. 201 | public struct AnyError: Swift.Error { 202 | /// The underlying error. 203 | public let error: Swift.Error 204 | 205 | public init(_ error: Swift.Error) { 206 | if let anyError = error as? AnyError { 207 | self = anyError 208 | } else { 209 | self.error = error 210 | } 211 | } 212 | } 213 | 214 | extension AnyError: ErrorProtocolConvertible { 215 | public static func error(from error: Error) -> AnyError { 216 | return AnyError(error) 217 | } 218 | } 219 | 220 | extension AnyError: CustomStringConvertible { 221 | public var description: String { 222 | return String(describing: error) 223 | } 224 | } 225 | 226 | // There appears to be a bug in Foundation on Linux which prevents this from working: 227 | // https://bugs.swift.org/browse/SR-3565 228 | // Don't forget to comment the tests back in when removing this check when it's fixed! 229 | #if !os(Linux) 230 | 231 | extension AnyError: LocalizedError { 232 | public var errorDescription: String? { 233 | return error.localizedDescription 234 | } 235 | 236 | public var failureReason: String? { 237 | return (error as? LocalizedError)?.failureReason 238 | } 239 | 240 | public var helpAnchor: String? { 241 | return (error as? LocalizedError)?.helpAnchor 242 | } 243 | 244 | public var recoverySuggestion: String? { 245 | return (error as? LocalizedError)?.recoverySuggestion 246 | } 247 | } 248 | 249 | #endif 250 | 251 | // MARK: - migration support 252 | extension Result { 253 | @available(*, unavailable, renamed: "success") 254 | public static func Success(_: T) -> Result { 255 | fatalError() 256 | } 257 | 258 | @available(*, unavailable, renamed: "failure") 259 | public static func Failure(_: Error) -> Result { 260 | fatalError() 261 | } 262 | } 263 | 264 | extension NSError { 265 | @available(*, unavailable, renamed: "error(from:)") 266 | public static func errorFromErrorType(_ error: Swift.Error) -> Self { 267 | fatalError() 268 | } 269 | } 270 | 271 | import Foundation 272 | -------------------------------------------------------------------------------- /BuildTimeLogger/ResultProtocol.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Rob Rix. All rights reserved. 2 | 3 | /// A type that can represent either failure with an error or success with a result value. 4 | public protocol ResultProtocol { 5 | associatedtype Value 6 | associatedtype Error: Swift.Error 7 | 8 | /// Constructs a successful result wrapping a `value`. 9 | init(value: Value) 10 | 11 | /// Constructs a failed result wrapping an `error`. 12 | init(error: Error) 13 | 14 | /// Case analysis for ResultProtocol. 15 | /// 16 | /// Returns the value produced by appliying `ifFailure` to the error if self represents a failure, or `ifSuccess` to the result value if self represents a success. 17 | func analysis(ifSuccess: (Value) -> U, ifFailure: (Error) -> U) -> U 18 | 19 | /// Returns the value if self represents a success, `nil` otherwise. 20 | /// 21 | /// A default implementation is provided by a protocol extension. Conforming types may specialize it. 22 | var value: Value? { get } 23 | 24 | /// Returns the error if self represents a failure, `nil` otherwise. 25 | /// 26 | /// A default implementation is provided by a protocol extension. Conforming types may specialize it. 27 | var error: Error? { get } 28 | } 29 | 30 | public extension ResultProtocol { 31 | 32 | /// Returns the value if self represents a success, `nil` otherwise. 33 | public var value: Value? { 34 | return analysis(ifSuccess: { $0 }, ifFailure: { _ in nil }) 35 | } 36 | 37 | /// Returns the error if self represents a failure, `nil` otherwise. 38 | public var error: Error? { 39 | return analysis(ifSuccess: { _ in nil }, ifFailure: { $0 }) 40 | } 41 | 42 | /// Returns a new Result by mapping `Success`es’ values using `transform`, or re-wrapping `Failure`s’ errors. 43 | public func map(_ transform: (Value) -> U) -> Result { 44 | return flatMap { .success(transform($0)) } 45 | } 46 | 47 | /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. 48 | public func flatMap(_ transform: (Value) -> Result) -> Result { 49 | return analysis( 50 | ifSuccess: transform, 51 | ifFailure: Result.failure) 52 | } 53 | 54 | /// Returns a Result with a tuple of the receiver and `other` values if both 55 | /// are `Success`es, or re-wrapping the error of the earlier `Failure`. 56 | public func fanout(_ other: @autoclosure () -> R) -> Result<(Value, R.Value), Error> 57 | where Error == R.Error 58 | { 59 | return self.flatMap { left in other().map { right in (left, right) } } 60 | } 61 | 62 | /// Returns a new Result by mapping `Failure`'s values using `transform`, or re-wrapping `Success`es’ values. 63 | public func mapError(_ transform: (Error) -> Error2) -> Result { 64 | return flatMapError { .failure(transform($0)) } 65 | } 66 | 67 | /// Returns the result of applying `transform` to `Failure`’s errors, or re-wrapping `Success`es’ values. 68 | public func flatMapError(_ transform: (Error) -> Result) -> Result { 69 | return analysis( 70 | ifSuccess: Result.success, 71 | ifFailure: transform) 72 | } 73 | 74 | /// Returns a new Result by mapping `Success`es’ values using `success`, and by mapping `Failure`'s values using `failure`. 75 | public func bimap(success: (Value) -> U, failure: (Error) -> Error2) -> Result { 76 | return analysis( 77 | ifSuccess: { .success(success($0)) }, 78 | ifFailure: { .failure(failure($0)) } 79 | ) 80 | } 81 | } 82 | 83 | public extension ResultProtocol { 84 | 85 | // MARK: Higher-order functions 86 | 87 | /// Returns `self.value` if this result is a .Success, or the given value otherwise. Equivalent with `??` 88 | public func recover(_ value: @autoclosure () -> Value) -> Value { 89 | return self.value ?? value() 90 | } 91 | 92 | /// Returns this result if it is a .Success, or the given result otherwise. Equivalent with `??` 93 | public func recover(with result: @autoclosure () -> Self) -> Self { 94 | return analysis( 95 | ifSuccess: { _ in self }, 96 | ifFailure: { _ in result() }) 97 | } 98 | } 99 | 100 | /// Protocol used to constrain `tryMap` to `Result`s with compatible `Error`s. 101 | public protocol ErrorProtocolConvertible: Swift.Error { 102 | static func error(from error: Swift.Error) -> Self 103 | } 104 | 105 | public extension ResultProtocol where Error: ErrorProtocolConvertible { 106 | 107 | /// Returns the result of applying `transform` to `Success`es’ values, or wrapping thrown errors. 108 | public func tryMap(_ transform: (Value) throws -> U) -> Result { 109 | return flatMap { value in 110 | do { 111 | return .success(try transform(value)) 112 | } 113 | catch { 114 | let convertedError = Error.error(from: error) 115 | // Revisit this in a future version of Swift. https://twitter.com/jckarter/status/672931114944696321 116 | return .failure(convertedError) 117 | } 118 | } 119 | } 120 | } 121 | 122 | // MARK: - Operators 123 | 124 | infix operator &&& : LogicalConjunctionPrecedence 125 | 126 | /// Returns a Result with a tuple of `left` and `right` values if both are `Success`es, or re-wrapping the error of the earlier `Failure`. 127 | @available(*, deprecated, renamed: "ResultProtocol.fanout(self:_:)") 128 | public func &&& (left: L, right: @autoclosure () -> R) -> Result<(L.Value, R.Value), L.Error> 129 | where L.Error == R.Error 130 | { 131 | return left.fanout(right) 132 | } 133 | 134 | precedencegroup ChainingPrecedence { 135 | associativity: left 136 | higherThan: TernaryPrecedence 137 | } 138 | 139 | infix operator >>- : ChainingPrecedence 140 | 141 | /// Returns the result of applying `transform` to `Success`es’ values, or re-wrapping `Failure`’s errors. 142 | /// 143 | /// This is a synonym for `flatMap`. 144 | @available(*, deprecated, renamed: "ResultProtocol.flatMap(self:_:)") 145 | public func >>- (result: T, transform: (T.Value) -> Result) -> Result { 146 | return result.flatMap(transform) 147 | } 148 | 149 | /// Returns `true` if `left` and `right` are both `Success`es and their values are equal, or if `left` and `right` are both `Failure`s and their errors are equal. 150 | public func == (left: T, right: T) -> Bool 151 | where T.Value: Equatable, T.Error: Equatable 152 | { 153 | if let left = left.value, let right = right.value { 154 | return left == right 155 | } else if let left = left.error, let right = right.error { 156 | return left == right 157 | } 158 | return false 159 | } 160 | 161 | /// Returns `true` if `left` and `right` represent different cases, or if they represent the same case but different values. 162 | public func != (left: T, right: T) -> Bool 163 | where T.Value: Equatable, T.Error: Equatable 164 | { 165 | return !(left == right) 166 | } 167 | 168 | /// Returns the value of `left` if it is a `Success`, or `right` otherwise. Short-circuits. 169 | public func ?? (left: T, right: @autoclosure () -> T.Value) -> T.Value { 170 | return left.recover(right()) 171 | } 172 | 173 | /// Returns `left` if it is a `Success`es, or `right` otherwise. Short-circuits. 174 | public func ?? (left: T, right: @autoclosure () -> T) -> T { 175 | return left.recover(with: right()) 176 | } 177 | 178 | // MARK: - migration support 179 | @available(*, unavailable, renamed: "ResultProtocol") 180 | public typealias ResultType = ResultProtocol 181 | 182 | @available(*, unavailable, renamed: "Error") 183 | public typealias ResultErrorType = Swift.Error 184 | 185 | @available(*, unavailable, renamed: "ErrorProtocolConvertible") 186 | public typealias ErrorTypeConvertible = ErrorProtocolConvertible 187 | 188 | extension ResultProtocol { 189 | @available(*, unavailable, renamed: "recover(with:)") 190 | public func recoverWith(_ result: @autoclosure () -> Self) -> Self { 191 | fatalError() 192 | } 193 | } 194 | 195 | extension ErrorProtocolConvertible { 196 | @available(*, unavailable, renamed: "error(from:)") 197 | public static func errorFromErrorType(_ error: Swift.Error) -> Self { 198 | fatalError() 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /BuildTimeLogger/SystemInfo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SystemInfo.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 20/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct SystemInfo { 12 | let hardware: HardwareInfo 13 | let devTools: DevToolsInfo 14 | } 15 | -------------------------------------------------------------------------------- /BuildTimeLogger/SystemInfoManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SystemInfoManager.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 20/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum SystemInfoNativeKey: String { 12 | case items = "_items" 13 | case cpuType = "cpu_type" 14 | case currentProcessorSpeed = "current_processor_speed" 15 | case machineModel = "machine_model" 16 | case physicalMemory = "physical_memory" 17 | case numberOfProcessors = "number_processors" 18 | case spdevtoolsVersion = "spdevtools_version" 19 | } 20 | 21 | class SystemInfoManager { 22 | func read() -> SystemInfo? { 23 | let task = Process() 24 | task.launchPath = "/usr/sbin/system_profiler" 25 | task.arguments = ["SPHardwareDataType", "SPDeveloperToolsDataType", "-xml"] 26 | 27 | let pipe = Pipe() 28 | task.standardOutput = pipe 29 | task.standardError = pipe 30 | task.launch() 31 | let data = pipe.fileHandleForReading.readDataToEndOfFile() 32 | 33 | task.waitUntilExit() 34 | 35 | var propertyListFormat = PropertyListSerialization.PropertyListFormat.xml 36 | guard let plistData = try? PropertyListSerialization.propertyList(from: data, options: .mutableContainersAndLeaves, format: &propertyListFormat) as? [AnyObject] else { 37 | return nil 38 | } 39 | 40 | if let plistDictionary = plistData as? [[String: AnyObject]], 41 | let hardwareInfo = readHardwareInfo(in: plistDictionary), 42 | let devToolsInfo = readDevToolsInfo(in: plistDictionary) { 43 | return SystemInfo(hardware: hardwareInfo, devTools: devToolsInfo) 44 | } 45 | 46 | return nil 47 | } 48 | 49 | private func readHardwareInfo(in dictionary: [[String: AnyObject]]) -> HardwareInfo? { 50 | for plistEntry in dictionary { 51 | guard let items = plistEntry[SystemInfoNativeKey.items.rawValue] as? [[String: AnyObject]] else { 52 | continue 53 | } 54 | 55 | guard let cpuType = items.first?[SystemInfoNativeKey.cpuType.rawValue] as? String, 56 | let cpuSpeed = items.first?[SystemInfoNativeKey.currentProcessorSpeed.rawValue] as? String, 57 | let machineModel = items.first?[SystemInfoNativeKey.machineModel.rawValue] as? String, 58 | let physicalMemory = items.first?[SystemInfoNativeKey.physicalMemory.rawValue] as? String, 59 | let numberOfProcessors = items.first?[SystemInfoNativeKey.numberOfProcessors.rawValue] as? Int else { 60 | continue 61 | } 62 | 63 | let systemInfo = HardwareInfo(cpuType: cpuType, cpuSpeed: cpuSpeed, machineModel: machineModel, physicalMemory: physicalMemory, numberOfProcessors: numberOfProcessors) 64 | 65 | return systemInfo 66 | } 67 | 68 | return nil 69 | } 70 | 71 | private func readDevToolsInfo(in dictionary: [[String: AnyObject]]) -> DevToolsInfo? { 72 | for plistEntry in dictionary { 73 | guard let items = plistEntry[SystemInfoNativeKey.items.rawValue] as? [[String: AnyObject]] else { 74 | continue 75 | } 76 | 77 | guard let version = items.first?[SystemInfoNativeKey.spdevtoolsVersion.rawValue] as? String else { 78 | continue 79 | } 80 | 81 | let devToolsInfo = DevToolsInfo(version: version) 82 | 83 | return devToolsInfo 84 | } 85 | 86 | return nil 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /BuildTimeLogger/TimeFormatter.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TimeFormatter.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 08/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct TimeFormatter { 12 | static func format(time: Int) -> String { 13 | let minutes = time / 60 14 | let seconds = time % 60 15 | 16 | return "\(minutes)m \(seconds)s" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BuildTimeLogger/UserSettings.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2016 Robert Gummesson 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // 24 | // UserCache.swift 25 | // BuildTimeAnalyzer 26 | // 27 | 28 | import Foundation 29 | 30 | class UserSettings { 31 | 32 | static private let derivedDataLocationKey = "derivedDataLocationKey" 33 | static private let windowLevelIsNormalKey = "windowLevelIsNormalKey" 34 | 35 | static private var _derivedDataLocation: String? 36 | static private var _windowLevelIsNormal: Bool? 37 | 38 | static var derivedDataLocation: String { 39 | get { 40 | if _derivedDataLocation == nil { 41 | _derivedDataLocation = UserDefaults.standard.string(forKey: derivedDataLocationKey) 42 | } 43 | if _derivedDataLocation == nil, let libraryFolder = NSSearchPathForDirectoriesInDomains(.libraryDirectory, .userDomainMask, true).first { 44 | _derivedDataLocation = "\(libraryFolder)/Developer/Xcode/DerivedData" 45 | } 46 | return _derivedDataLocation ?? "" 47 | } 48 | set { 49 | _derivedDataLocation = newValue 50 | UserDefaults.standard.set(newValue, forKey: derivedDataLocationKey) 51 | UserDefaults.standard.synchronize() 52 | } 53 | } 54 | 55 | static var windowShouldBeTopMost: Bool { 56 | get { 57 | if _windowLevelIsNormal == nil { 58 | _windowLevelIsNormal = UserDefaults.standard.bool(forKey: windowLevelIsNormalKey) 59 | } 60 | return !(_windowLevelIsNormal ?? true) 61 | } 62 | set { 63 | _windowLevelIsNormal = !newValue 64 | UserDefaults.standard.set(_windowLevelIsNormal, forKey: windowLevelIsNormalKey) 65 | UserDefaults.standard.synchronize() 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /BuildTimeLogger/XcodeDatabase+BuildHistoryEntry.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XcodeDatabase+BuildHistoryEntry.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 01/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension XcodeDatabase { 12 | var buildHistoryEntry: BuildHistoryEntry { 13 | return BuildHistoryEntry(buildTime: buildTime, schemeName: schemeName, date: Date(), username: NSUserName()) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BuildTimeLogger/XcodeDatabase.swift: -------------------------------------------------------------------------------- 1 | // The MIT License (MIT) 2 | // 3 | // Copyright (c) 2016 Robert Gummesson 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // 12 | // The above copyright notice and this permission notice shall be included in all 13 | // copies or substantial portions of the Software. 14 | // 15 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | // SOFTWARE. 22 | 23 | // 24 | // XcodeDatabase.swift 25 | // BuildTimeAnalyzer 26 | // 27 | 28 | import Foundation 29 | 30 | struct XcodeDatabase { 31 | var path: String 32 | var modificationDate: Date 33 | 34 | var key: String 35 | var schemeName: String 36 | var title: String 37 | var timeStartedRecording: Int 38 | var timeStoppedRecording: Int 39 | 40 | var isBuildType: Bool { 41 | return title.hasPrefix("Build ") || title.hasPrefix("Compile ") 42 | } 43 | 44 | var url: URL { 45 | return URL(fileURLWithPath: path) 46 | } 47 | 48 | var logUrl: URL { 49 | return folderPath.appendingPathComponent("\(key).xcactivitylog") 50 | } 51 | 52 | var folderPath: URL { 53 | return url.deletingLastPathComponent() 54 | } 55 | 56 | var buildTime: Int { 57 | return timeStoppedRecording - timeStartedRecording 58 | } 59 | 60 | init?(fromPath path: String) { 61 | guard let data = NSDictionary(contentsOfFile: path)?["logs"] as? [String: AnyObject], 62 | let key = XcodeDatabase.sortKeys(usingData: data).last?.key, 63 | let value = data[key] as? [String : AnyObject], 64 | let schemeName = value["schemeIdentifier-schemeName"] as? String, 65 | let title = value["title"] as? String, 66 | let timeStartedRecording = value["timeStartedRecording"] as? NSNumber, 67 | let timeStoppedRecording = value["timeStoppedRecording"] as? NSNumber, 68 | let fileAttributes = try? FileManager.default.attributesOfItem(atPath: path), 69 | let modificationDate = fileAttributes[FileAttributeKey.modificationDate] as? Date 70 | else { return nil } 71 | 72 | self.modificationDate = modificationDate 73 | self.path = path 74 | self.key = key 75 | self.schemeName = schemeName 76 | self.title = title 77 | self.timeStartedRecording = timeStartedRecording.intValue 78 | self.timeStoppedRecording = timeStoppedRecording.intValue 79 | } 80 | 81 | func processLog() -> String? { 82 | if let rawData = try? Data(contentsOf: URL(fileURLWithPath: logUrl.path)), 83 | let data = (rawData as NSData).gunzipped() { 84 | return String(data: data, encoding: String.Encoding.utf8) 85 | } 86 | return nil 87 | } 88 | 89 | static private func sortKeys(usingData data: [String: AnyObject]) -> [(Int, key: String)] { 90 | var sortedKeys: [(Int, key: String)] = [] 91 | for key in data.keys { 92 | if let value = data[key] as? [String: AnyObject], 93 | let timeStoppedRecording = value["timeStoppedRecording"] as? NSNumber { 94 | sortedKeys.append((timeStoppedRecording.intValue, key)) 95 | } 96 | } 97 | return sortedKeys.sorted{ $0.0 < $1.0 } 98 | } 99 | } 100 | 101 | extension XcodeDatabase : Equatable {} 102 | 103 | func ==(lhs: XcodeDatabase, rhs: XcodeDatabase) -> Bool { 104 | return lhs.path == rhs.path && lhs.modificationDate == rhs.modificationDate 105 | } 106 | -------------------------------------------------------------------------------- /BuildTimeLogger/XcodeDatabaseManager.swift: -------------------------------------------------------------------------------- 1 | // 2 | // XcodeDatabaseManager.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 08/03/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | struct XcodeDatabaseManager { 12 | var latestBuildData: XcodeDatabase? { 13 | let dataSource = DerivedDataManager.derivedData().compactMap{ 14 | XcodeDatabase(fromPath: $0.url.appendingPathComponent("Logs/Build/LogStoreManifest.plist").path) 15 | }.sorted(by: { $0.modificationDate > $1.modificationDate }) 16 | 17 | guard let latestBuildDatabase = dataSource.first else { 18 | return nil 19 | } 20 | 21 | return latestBuildDatabase 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BuildTimeLogger/main.swift: -------------------------------------------------------------------------------- 1 | // 2 | // main.swift 3 | // BuildTimeLogger 4 | // 5 | // Created by Marcin Religa on 22/02/2017. 6 | // Copyright © 2017 Marcin Religa. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // Need to wait in the beginning, otherwise without that the app is picking the previous build for some reason. 12 | sleep(1) 13 | 14 | let app = BuildTimeLoggerApp() 15 | app.run() 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 marcinreliga 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BuildTimeLogger-for-Xcode 2 | A console app for logging Xcode build times and presenting them in a notification right when the build finishes. 3 | Optionally the app can upload each log entry to a REST API endpoint accepting POST requests. 4 | 5 | Based on [BuildTimeAnalyzer-for-Xcode](https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode). 6 | ## Example notification 7 | ![notification](https://raw.githubusercontent.com/marcinreliga/BuildTimeLogger-for-Xcode/master/notification.png) 8 | ## Usage 9 | 1. Download BuildTimeLogger project, build and run it. 10 | 2. Copy the product (BuildTimeLogger app) into some easily accessible location. 11 | 3. In **your** Xcode project, edit scheme and add new Post-action in Build section: 12 | 13 | ![usage](https://raw.githubusercontent.com/marcinreliga/BuildTimeLogger-for-Xcode/master/usage.png) 14 | 15 | If you want to upload each log entry to a remote endpoint just specify the URL as a param: 16 | 17 | ![usage](https://raw.githubusercontent.com/marcinreliga/BuildTimeLogger-for-Xcode/master/usage_remote.png) 18 | 19 | As in the example, I tested that it works with [Firebase](https://firebase.google.com/), but it can potentially send the data to any REST API endpoint accepting POST requests. 20 | 21 | ## Viewing remotely stored logs 22 | 23 | To see remotely stored results call the app (from terminal, outside the Xcode) with additional param: 24 | ``` 25 | $ /PATH/TO/BuildTimeLogger https://your-project-name.firebaseio.com/.json fetch 26 | ``` 27 | 28 | Example output: 29 | ``` 30 | Fetching remote data... 31 | username: marcin.religa 32 | build time today: 30m 26s 33 | total build time: 165m 55s 34 | 35 | username: test.user 36 | build time today: 11m 23s 37 | total build time: 45m 40s 38 | 39 | ``` 40 | 41 | This currently only works for results in JSON format fetched from Firebase. If you use different type of remote storage then you need to fetch/parse results yourself, as appriopriate. 42 | -------------------------------------------------------------------------------- /notification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcinreliga/BuildTimeLogger-for-Xcode/51f880c8bf7450db47ca37f4bb99f08707ab9118/notification.png -------------------------------------------------------------------------------- /usage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcinreliga/BuildTimeLogger-for-Xcode/51f880c8bf7450db47ca37f4bb99f08707ab9118/usage.png -------------------------------------------------------------------------------- /usage_remote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/marcinreliga/BuildTimeLogger-for-Xcode/51f880c8bf7450db47ca37f4bb99f08707ab9118/usage_remote.png --------------------------------------------------------------------------------