From d968efe19c6c43370bc794059375bee9f878d0ec Mon Sep 17 00:00:00 2001 From: Antoine van der Lee <ajvanderlee@gmail.com> Date: Fri, 3 Sep 2021 15:47:58 +0200 Subject: [PATCH] Add a metrics kit logger (#89) * Add a metrics kit logger * Remove whitespace * Fix tests --- .../contents.xcworkspacedata | 2 +- .../xcschemes/Diagnostics.xcscheme | 44 +- Diagnostics.xcodeproj/project.pbxproj | 643 ------------------ DiagnosticsTests/Info.plist | 22 - .../project.pbxproj | 93 +-- .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../xcschemes/Diagnostics-Example.xcscheme | 2 +- Package.swift | 3 +- Sources/DiagnosticsLogger.swift | 39 +- Sources/MetricKit/MetricsMonitor.swift | 83 +++ 10 files changed, 146 insertions(+), 785 deletions(-) rename {Diagnostics.xcodeproj/project.xcworkspace => .swiftpm/xcode/package.xcworkspace}/contents.xcworkspacedata (69%) rename {Diagnostics.xcodeproj => .swiftpm/xcode}/xcshareddata/xcschemes/Diagnostics.xcscheme (67%) delete mode 100644 Diagnostics.xcodeproj/project.pbxproj delete mode 100644 DiagnosticsTests/Info.plist rename {Diagnostics.xcodeproj => Example/Diagnostics-Example.xcodeproj}/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) create mode 100644 Sources/MetricKit/MetricsMonitor.swift diff --git a/Diagnostics.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata similarity index 69% rename from Diagnostics.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata index a8a2d9f..919434a 100644 --- a/Diagnostics.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ <Workspace version = "1.0"> <FileRef - location = "self:Diagnostics.xcodeproj"> + location = "self:"> </FileRef> </Workspace> diff --git a/Diagnostics.xcodeproj/xcshareddata/xcschemes/Diagnostics.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/Diagnostics.xcscheme similarity index 67% rename from Diagnostics.xcodeproj/xcshareddata/xcschemes/Diagnostics.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/Diagnostics.xcscheme index 86f2bb1..c9c1148 100644 --- a/Diagnostics.xcodeproj/xcshareddata/xcschemes/Diagnostics.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/Diagnostics.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "1120" + LastUpgradeVersion = "1250" version = "1.3"> <BuildAction parallelizeBuildables = "YES" @@ -14,10 +14,24 @@ buildForAnalyzing = "YES"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "500B274B239524E100C304D4" - BuildableName = "Diagnostics.framework" + BlueprintIdentifier = "Diagnostics" + BuildableName = "Diagnostics" BlueprintName = "Diagnostics" - ReferencedContainer = "container:Diagnostics.xcodeproj"> + ReferencedContainer = "container:"> + </BuildableReference> + </BuildActionEntry> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "YES" + buildForArchiving = "YES" + buildForAnalyzing = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "DiagnosticsTests" + BuildableName = "DiagnosticsTests" + BlueprintName = "DiagnosticsTests" + ReferencedContainer = "container:"> </BuildableReference> </BuildActionEntry> </BuildActionEntries> @@ -26,24 +40,16 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "NO" - language = "en" - codeCoverageEnabled = "YES"> - <CommandLineArguments> - <CommandLineArgument - argument = "-UNITTEST" - isEnabled = "YES"> - </CommandLineArgument> - </CommandLineArguments> + shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> <TestableReference skipped = "NO"> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "500B2754239524E100C304D4" - BuildableName = "DiagnosticsTests.xctest" + BlueprintIdentifier = "DiagnosticsTests" + BuildableName = "DiagnosticsTests" BlueprintName = "DiagnosticsTests" - ReferencedContainer = "container:Diagnostics.xcodeproj"> + ReferencedContainer = "container:"> </BuildableReference> </TestableReference> </Testables> @@ -68,10 +74,10 @@ <MacroExpansion> <BuildableReference BuildableIdentifier = "primary" - BlueprintIdentifier = "500B274B239524E100C304D4" - BuildableName = "Diagnostics.framework" + BlueprintIdentifier = "Diagnostics" + BuildableName = "Diagnostics" BlueprintName = "Diagnostics" - ReferencedContainer = "container:Diagnostics.xcodeproj"> + ReferencedContainer = "container:"> </BuildableReference> </MacroExpansion> </ProfileAction> diff --git a/Diagnostics.xcodeproj/project.pbxproj b/Diagnostics.xcodeproj/project.pbxproj deleted file mode 100644 index 2e0482c..0000000 --- a/Diagnostics.xcodeproj/project.pbxproj +++ /dev/null @@ -1,643 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 34B211622554220500C70B3A /* ByteCountFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B211612554220500C70B3A /* ByteCountFormatter.swift */; }; - 34B211662554221500C70B3A /* Device.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B211652554221500C70B3A /* Device.swift */; }; - 416CE0182406D85F00698E0A /* HTMLEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 416CE0172406D85F00698E0A /* HTMLEncoding.swift */; }; - 416CE0D0241FA65700698E0A /* HTMLEncodingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 416CE0CF241FA65700698E0A /* HTMLEncodingTests.swift */; }; - 500B2756239524E100C304D4 /* Diagnostics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 500B274C239524E100C304D4 /* Diagnostics.framework */; }; - 500B275D239524E100C304D4 /* Diagnostics.h in Headers */ = {isa = PBXBuildFile; fileRef = 500B274F239524E100C304D4 /* Diagnostics.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 500B276823953E4100C304D4 /* DiagnosticsReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B276723953E4100C304D4 /* DiagnosticsReporter.swift */; }; - 500B27A22395413200C304D4 /* MFMailComposeVCExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27A12395413200C304D4 /* MFMailComposeVCExtensions.swift */; }; - 500B27A5239544F200C304D4 /* AppSystemMetadataReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27A4239544F200C304D4 /* AppSystemMetadataReporter.swift */; }; - 500B27AA2395520300C304D4 /* DiagnosticsReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27A92395520300C304D4 /* DiagnosticsReport.swift */; }; - 500B27AC2395523600C304D4 /* Diagnostics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27AB2395523600C304D4 /* Diagnostics.swift */; }; - 500B27B02395551200C304D4 /* HTMLGenerating.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27AF2395551200C304D4 /* HTMLGenerating.swift */; }; - 500B27B22395553000C304D4 /* HTMLGeneratingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27B12395553000C304D4 /* HTMLGeneratingTests.swift */; }; - 500B27B923955CAF00C304D4 /* GeneralInfoReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27B823955CAF00C304D4 /* GeneralInfoReporter.swift */; }; - 500B27BC239561A500C304D4 /* BundleExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27BB239561A500C304D4 /* BundleExtensions.swift */; }; - 500B27C22395777C00C304D4 /* UserDefaultsReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27C12395777C00C304D4 /* UserDefaultsReporter.swift */; }; - 500B27C4239590E100C304D4 /* DiagnosticsLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27C3239590E100C304D4 /* DiagnosticsLogger.swift */; }; - 500B27C62395967200C304D4 /* LogsReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27C52395967200C304D4 /* LogsReporter.swift */; }; - 500B27CA23968CA900C304D4 /* Mocks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27C923968CA900C304D4 /* Mocks.swift */; }; - 505000EE239FA22400EADD27 /* DiagnosticsReportFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505000ED239FA22400EADD27 /* DiagnosticsReportFilter.swift */; }; - 505000F0239FA2A300EADD27 /* DiagnosticsChapter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505000EF239FA2A300EADD27 /* DiagnosticsChapter.swift */; }; - 509F59342396921A006AD8D1 /* MFMailComposeViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 509F59332396921A006AD8D1 /* MFMailComposeViewControllerTests.swift */; }; - 509F5937239694C1006AD8D1 /* LogsReporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 509F5936239694C1006AD8D1 /* LogsReporterTests.swift */; }; - 509F59392396973F006AD8D1 /* UserDefaultsReporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 509F59382396973F006AD8D1 /* UserDefaultsReporterTests.swift */; }; - 509F593B2396980A006AD8D1 /* GeneralInfoReporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 509F593A2396980A006AD8D1 /* GeneralInfoReporterTests.swift */; }; - 509F594023969C2A006AD8D1 /* AppSystemMetadataReporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 509F593F23969C2A006AD8D1 /* AppSystemMetadataReporterTests.swift */; }; - 509F59D12397BD3A006AD8D1 /* DiagnosticsReporterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B27AD2395528100C304D4 /* DiagnosticsReporterTests.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 500B2757239524E100C304D4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 500B2743239524E100C304D4 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 500B274B239524E100C304D4; - remoteInfo = Diagnostics; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 34B211612554220500C70B3A /* ByteCountFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ByteCountFormatter.swift; sourceTree = "<group>"; }; - 34B211652554221500C70B3A /* Device.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Device.swift; sourceTree = "<group>"; }; - 416CE0172406D85F00698E0A /* HTMLEncoding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLEncoding.swift; sourceTree = "<group>"; }; - 416CE0CF241FA65700698E0A /* HTMLEncodingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLEncodingTests.swift; sourceTree = "<group>"; }; - 500B274C239524E100C304D4 /* Diagnostics.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Diagnostics.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 500B274F239524E100C304D4 /* Diagnostics.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Diagnostics.h; sourceTree = "<group>"; }; - 500B2750239524E100C304D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; - 500B2755239524E100C304D4 /* DiagnosticsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DiagnosticsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 500B275C239524E100C304D4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; - 500B276723953E4100C304D4 /* DiagnosticsReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticsReporter.swift; sourceTree = "<group>"; }; - 500B27A12395413200C304D4 /* MFMailComposeVCExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFMailComposeVCExtensions.swift; sourceTree = "<group>"; }; - 500B27A4239544F200C304D4 /* AppSystemMetadataReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSystemMetadataReporter.swift; sourceTree = "<group>"; }; - 500B27A92395520300C304D4 /* DiagnosticsReport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticsReport.swift; sourceTree = "<group>"; }; - 500B27AB2395523600C304D4 /* Diagnostics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Diagnostics.swift; sourceTree = "<group>"; }; - 500B27AD2395528100C304D4 /* DiagnosticsReporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticsReporterTests.swift; sourceTree = "<group>"; }; - 500B27AF2395551200C304D4 /* HTMLGenerating.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HTMLGenerating.swift; sourceTree = "<group>"; }; - 500B27B12395553000C304D4 /* HTMLGeneratingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTMLGeneratingTests.swift; sourceTree = "<group>"; }; - 500B27B823955CAF00C304D4 /* GeneralInfoReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralInfoReporter.swift; sourceTree = "<group>"; }; - 500B27BB239561A500C304D4 /* BundleExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BundleExtensions.swift; sourceTree = "<group>"; }; - 500B27BD23956A8A00C304D4 /* style.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = style.css; sourceTree = "<group>"; }; - 500B27C12395777C00C304D4 /* UserDefaultsReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsReporter.swift; sourceTree = "<group>"; }; - 500B27C3239590E100C304D4 /* DiagnosticsLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticsLogger.swift; sourceTree = "<group>"; }; - 500B27C52395967200C304D4 /* LogsReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogsReporter.swift; sourceTree = "<group>"; }; - 500B27C923968CA900C304D4 /* Mocks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mocks.swift; sourceTree = "<group>"; }; - 5050002423993D0300EADD27 /* Changelog.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Changelog.md; sourceTree = "<group>"; }; - 505000ED239FA22400EADD27 /* DiagnosticsReportFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticsReportFilter.swift; sourceTree = "<group>"; }; - 505000EF239FA2A300EADD27 /* DiagnosticsChapter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiagnosticsChapter.swift; sourceTree = "<group>"; }; - 5068CEAC23A250D400CB78BE /* Diagnostics.podspec */ = {isa = PBXFileReference; lastKnownFileType = text; path = Diagnostics.podspec; sourceTree = "<group>"; }; - 509F59332396921A006AD8D1 /* MFMailComposeViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFMailComposeViewControllerTests.swift; sourceTree = "<group>"; }; - 509F5936239694C1006AD8D1 /* LogsReporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogsReporterTests.swift; sourceTree = "<group>"; }; - 509F59382396973F006AD8D1 /* UserDefaultsReporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultsReporterTests.swift; sourceTree = "<group>"; }; - 509F593A2396980A006AD8D1 /* GeneralInfoReporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralInfoReporterTests.swift; sourceTree = "<group>"; }; - 509F593F23969C2A006AD8D1 /* AppSystemMetadataReporterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppSystemMetadataReporterTests.swift; sourceTree = "<group>"; }; - 509F59D02397B77F006AD8D1 /* Package.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Package.swift; sourceTree = "<group>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 500B2749239524E100C304D4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 500B2752239524E100C304D4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 500B2756239524E100C304D4 /* Diagnostics.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 500B2742239524E100C304D4 = { - isa = PBXGroup; - children = ( - 5050002423993D0300EADD27 /* Changelog.md */, - 5068CEAC23A250D400CB78BE /* Diagnostics.podspec */, - 509F59D02397B77F006AD8D1 /* Package.swift */, - 500B274E239524E100C304D4 /* Diagnostics */, - 500B2759239524E100C304D4 /* DiagnosticsTests */, - 500B274D239524E100C304D4 /* Products */, - 500B276623953E2200C304D4 /* Sources */, - ); - sourceTree = "<group>"; - }; - 500B274D239524E100C304D4 /* Products */ = { - isa = PBXGroup; - children = ( - 500B274C239524E100C304D4 /* Diagnostics.framework */, - 500B2755239524E100C304D4 /* DiagnosticsTests.xctest */, - ); - name = Products; - sourceTree = "<group>"; - }; - 500B274E239524E100C304D4 /* Diagnostics */ = { - isa = PBXGroup; - children = ( - 500B274F239524E100C304D4 /* Diagnostics.h */, - 500B2750239524E100C304D4 /* Info.plist */, - ); - path = Diagnostics; - sourceTree = "<group>"; - }; - 500B2759239524E100C304D4 /* DiagnosticsTests */ = { - isa = PBXGroup; - children = ( - 509F59322396920E006AD8D1 /* Extensions */, - 509F5935239694A0006AD8D1 /* Reporters */, - 500B27AD2395528100C304D4 /* DiagnosticsReporterTests.swift */, - 416CE0CF241FA65700698E0A /* HTMLEncodingTests.swift */, - 500B27B12395553000C304D4 /* HTMLGeneratingTests.swift */, - 500B275C239524E100C304D4 /* Info.plist */, - 500B27C923968CA900C304D4 /* Mocks.swift */, - ); - path = DiagnosticsTests; - sourceTree = "<group>"; - }; - 500B276623953E2200C304D4 /* Sources */ = { - isa = PBXGroup; - children = ( - 500B27BA2395617A00C304D4 /* Extensions */, - 500B27A02395412300C304D4 /* MFMailExtensions */, - 500B27A3239544DB00C304D4 /* Reporters */, - 500B27AB2395523600C304D4 /* Diagnostics.swift */, - 34B211652554221500C70B3A /* Device.swift */, - 505000EF239FA2A300EADD27 /* DiagnosticsChapter.swift */, - 500B27C3239590E100C304D4 /* DiagnosticsLogger.swift */, - 500B27A92395520300C304D4 /* DiagnosticsReport.swift */, - 505000ED239FA22400EADD27 /* DiagnosticsReportFilter.swift */, - 500B276723953E4100C304D4 /* DiagnosticsReporter.swift */, - 416CE0172406D85F00698E0A /* HTMLEncoding.swift */, - 500B27AF2395551200C304D4 /* HTMLGenerating.swift */, - 500B27BD23956A8A00C304D4 /* style.css */, - ); - path = Sources; - sourceTree = "<group>"; - }; - 500B27A02395412300C304D4 /* MFMailExtensions */ = { - isa = PBXGroup; - children = ( - 500B27A12395413200C304D4 /* MFMailComposeVCExtensions.swift */, - ); - path = MFMailExtensions; - sourceTree = "<group>"; - }; - 500B27A3239544DB00C304D4 /* Reporters */ = { - isa = PBXGroup; - children = ( - 500B27A4239544F200C304D4 /* AppSystemMetadataReporter.swift */, - 500B27B823955CAF00C304D4 /* GeneralInfoReporter.swift */, - 500B27C12395777C00C304D4 /* UserDefaultsReporter.swift */, - 500B27C52395967200C304D4 /* LogsReporter.swift */, - ); - path = Reporters; - sourceTree = "<group>"; - }; - 500B27BA2395617A00C304D4 /* Extensions */ = { - isa = PBXGroup; - children = ( - 500B27BB239561A500C304D4 /* BundleExtensions.swift */, - 34B211612554220500C70B3A /* ByteCountFormatter.swift */, - ); - path = Extensions; - sourceTree = "<group>"; - }; - 509F59322396920E006AD8D1 /* Extensions */ = { - isa = PBXGroup; - children = ( - 509F59332396921A006AD8D1 /* MFMailComposeViewControllerTests.swift */, - ); - path = Extensions; - sourceTree = "<group>"; - }; - 509F5935239694A0006AD8D1 /* Reporters */ = { - isa = PBXGroup; - children = ( - 509F5936239694C1006AD8D1 /* LogsReporterTests.swift */, - 509F59382396973F006AD8D1 /* UserDefaultsReporterTests.swift */, - 509F593A2396980A006AD8D1 /* GeneralInfoReporterTests.swift */, - 509F593F23969C2A006AD8D1 /* AppSystemMetadataReporterTests.swift */, - ); - path = Reporters; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 500B2747239524E100C304D4 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 500B275D239524E100C304D4 /* Diagnostics.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 500B274B239524E100C304D4 /* Diagnostics */ = { - isa = PBXNativeTarget; - buildConfigurationList = 500B2760239524E100C304D4 /* Build configuration list for PBXNativeTarget "Diagnostics" */; - buildPhases = ( - 500B2747239524E100C304D4 /* Headers */, - 500B2748239524E100C304D4 /* Sources */, - 500B2749239524E100C304D4 /* Frameworks */, - 500B274A239524E100C304D4 /* Resources */, - 500B27C723959EB500C304D4 /* SwiftLint */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Diagnostics; - productName = Diagnostics; - productReference = 500B274C239524E100C304D4 /* Diagnostics.framework */; - productType = "com.apple.product-type.framework"; - }; - 500B2754239524E100C304D4 /* DiagnosticsTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 500B2763239524E100C304D4 /* Build configuration list for PBXNativeTarget "DiagnosticsTests" */; - buildPhases = ( - 500B2751239524E100C304D4 /* Sources */, - 500B2752239524E100C304D4 /* Frameworks */, - 500B2753239524E100C304D4 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 500B2758239524E100C304D4 /* PBXTargetDependency */, - ); - name = DiagnosticsTests; - productName = DiagnosticsTests; - productReference = 500B2755239524E100C304D4 /* DiagnosticsTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 500B2743239524E100C304D4 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1120; - ORGANIZATIONNAME = WeTransfer; - TargetAttributes = { - 500B274B239524E100C304D4 = { - CreatedOnToolsVersion = 11.2.1; - LastSwiftMigration = 1120; - }; - 500B2754239524E100C304D4 = { - CreatedOnToolsVersion = 11.2.1; - }; - }; - }; - buildConfigurationList = 500B2746239524E100C304D4 /* Build configuration list for PBXProject "Diagnostics" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 500B2742239524E100C304D4; - productRefGroup = 500B274D239524E100C304D4 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 500B274B239524E100C304D4 /* Diagnostics */, - 500B2754239524E100C304D4 /* DiagnosticsTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 500B274A239524E100C304D4 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 500B2753239524E100C304D4 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 500B27C723959EB500C304D4 /* SwiftLint */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 12; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - name = SwiftLint; - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "./Submodules/WeTransfer-iOS-CI/SwiftLint/swiftlint.sh\n"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 500B2748239524E100C304D4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 500B27BC239561A500C304D4 /* BundleExtensions.swift in Sources */, - 500B27C4239590E100C304D4 /* DiagnosticsLogger.swift in Sources */, - 500B27B923955CAF00C304D4 /* GeneralInfoReporter.swift in Sources */, - 500B27C22395777C00C304D4 /* UserDefaultsReporter.swift in Sources */, - 500B27AC2395523600C304D4 /* Diagnostics.swift in Sources */, - 500B27A5239544F200C304D4 /* AppSystemMetadataReporter.swift in Sources */, - 500B27B02395551200C304D4 /* HTMLGenerating.swift in Sources */, - 34B211662554221500C70B3A /* Device.swift in Sources */, - 500B27AA2395520300C304D4 /* DiagnosticsReport.swift in Sources */, - 500B276823953E4100C304D4 /* DiagnosticsReporter.swift in Sources */, - 500B27A22395413200C304D4 /* MFMailComposeVCExtensions.swift in Sources */, - 34B211622554220500C70B3A /* ByteCountFormatter.swift in Sources */, - 505000EE239FA22400EADD27 /* DiagnosticsReportFilter.swift in Sources */, - 500B27C62395967200C304D4 /* LogsReporter.swift in Sources */, - 416CE0182406D85F00698E0A /* HTMLEncoding.swift in Sources */, - 505000F0239FA2A300EADD27 /* DiagnosticsChapter.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 500B2751239524E100C304D4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 416CE0D0241FA65700698E0A /* HTMLEncodingTests.swift in Sources */, - 500B27B22395553000C304D4 /* HTMLGeneratingTests.swift in Sources */, - 509F59392396973F006AD8D1 /* UserDefaultsReporterTests.swift in Sources */, - 500B27CA23968CA900C304D4 /* Mocks.swift in Sources */, - 509F594023969C2A006AD8D1 /* AppSystemMetadataReporterTests.swift in Sources */, - 509F593B2396980A006AD8D1 /* GeneralInfoReporterTests.swift in Sources */, - 509F5937239694C1006AD8D1 /* LogsReporterTests.swift in Sources */, - 509F59342396921A006AD8D1 /* MFMailComposeViewControllerTests.swift in Sources */, - 509F59D12397BD3A006AD8D1 /* DiagnosticsReporterTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 500B2758239524E100C304D4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 500B274B239524E100C304D4 /* Diagnostics */; - targetProxy = 500B2757239524E100C304D4 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 500B275E239524E100C304D4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.2; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 500B275F239524E100C304D4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.2; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 500B2761239524E100C304D4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Automatic; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Diagnostics/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MARKETING_VERSION = 1.0.1; - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.Diagnostics; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 500B2762239524E100C304D4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - APPLICATION_EXTENSION_API_ONLY = YES; - CLANG_ENABLE_MODULES = YES; - CODE_SIGN_STYLE = Automatic; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Diagnostics/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MARKETING_VERSION = 1.0.1; - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.Diagnostics; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 500B2764239524E100C304D4 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = HDE72H7JV2; - INFOPLIST_FILE = DiagnosticsTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.DiagnosticsTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 500B2765239524E100C304D4 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = HDE72H7JV2; - INFOPLIST_FILE = DiagnosticsTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - PRODUCT_BUNDLE_IDENTIFIER = com.wetransfer.DiagnosticsTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 500B2746239524E100C304D4 /* Build configuration list for PBXProject "Diagnostics" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 500B275E239524E100C304D4 /* Debug */, - 500B275F239524E100C304D4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 500B2760239524E100C304D4 /* Build configuration list for PBXNativeTarget "Diagnostics" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 500B2761239524E100C304D4 /* Debug */, - 500B2762239524E100C304D4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 500B2763239524E100C304D4 /* Build configuration list for PBXNativeTarget "DiagnosticsTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 500B2764239524E100C304D4 /* Debug */, - 500B2765239524E100C304D4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 500B2743239524E100C304D4 /* Project object */; -} diff --git a/DiagnosticsTests/Info.plist b/DiagnosticsTests/Info.plist deleted file mode 100644 index 64d65ca..0000000 --- a/DiagnosticsTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>$(DEVELOPMENT_LANGUAGE)</string> - <key>CFBundleExecutable</key> - <string>$(EXECUTABLE_NAME)</string> - <key>CFBundleIdentifier</key> - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>$(PRODUCT_NAME)</string> - <key>CFBundlePackageType</key> - <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> - <key>CFBundleShortVersionString</key> - <string>1.0</string> - <key>CFBundleVersion</key> - <string>1</string> -</dict> -</plist> diff --git a/Example/Diagnostics-Example.xcodeproj/project.pbxproj b/Example/Diagnostics-Example.xcodeproj/project.pbxproj index db95605..dc4b116 100644 --- a/Example/Diagnostics-Example.xcodeproj/project.pbxproj +++ b/Example/Diagnostics-Example.xcodeproj/project.pbxproj @@ -3,13 +3,11 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ 500B277C23953F8C00C304D4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 500B277B23953F8C00C304D4 /* ViewController.swift */; }; - 500B27B523955AD400C304D4 /* Diagnostics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 500B279B23953FCA00C304D4 /* Diagnostics.framework */; }; - 500B27B623955AD400C304D4 /* Diagnostics.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 500B279B23953FCA00C304D4 /* Diagnostics.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 505000F2239FA4AB00EADD27 /* CustomFilters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505000F1239FA4AB00EADD27 /* CustomFilters.swift */; }; 505000FD239FA4CB00EADD27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 505000F5239FA4CA00EADD27 /* Assets.xcassets */; }; 505000FE239FA4CB00EADD27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 505000F6239FA4CA00EADD27 /* LaunchScreen.storyboard */; }; @@ -17,32 +15,9 @@ 50500100239FA4CB00EADD27 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505000FA239FA4CA00EADD27 /* AppDelegate.swift */; }; 50500102239FA4CB00EADD27 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505000FC239FA4CA00EADD27 /* SceneDelegate.swift */; }; 509F59CE2397AD0D006AD8D1 /* CustomReporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 509F59CD2397AD0D006AD8D1 /* CustomReporter.swift */; }; + 84F575FF26DE67180032BB3A /* Diagnostics in Frameworks */ = {isa = PBXBuildFile; productRef = 84F575FE26DE67180032BB3A /* Diagnostics */; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - 500B279A23953FCA00C304D4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 500B279523953FCA00C304D4 /* Diagnostics.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 500B274C239524E100C304D4; - remoteInfo = Diagnostics; - }; - 500B279C23953FCA00C304D4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 500B279523953FCA00C304D4 /* Diagnostics.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 500B2755239524E100C304D4; - remoteInfo = DiagnosticsTests; - }; - 500B279E23953FEB00C304D4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 500B279523953FCA00C304D4 /* Diagnostics.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 500B274B239524E100C304D4; - remoteInfo = Diagnostics; - }; -/* End PBXContainerItemProxy section */ - /* Begin PBXCopyFilesBuildPhase section */ 500B27B723955AD400C304D4 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -50,7 +25,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 500B27B623955AD400C304D4 /* Diagnostics.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -60,7 +34,6 @@ /* Begin PBXFileReference section */ 500B277423953F8C00C304D4 /* Diagnostics-Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Diagnostics-Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 500B277B23953F8C00C304D4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; - 500B279523953FCA00C304D4 /* Diagnostics.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Diagnostics.xcodeproj; path = ../Diagnostics.xcodeproj; sourceTree = "<group>"; }; 505000F1239FA4AB00EADD27 /* CustomFilters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomFilters.swift; sourceTree = "<group>"; }; 505000F5239FA4CA00EADD27 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 505000F7239FA4CA00EADD27 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; @@ -69,6 +42,7 @@ 505000FB239FA4CA00EADD27 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 505000FC239FA4CA00EADD27 /* SceneDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; 509F59CD2397AD0D006AD8D1 /* CustomReporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomReporter.swift; sourceTree = "<group>"; }; + 84F575FD26DE666B0032BB3A /* Diagnostics */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Diagnostics; path = ..; sourceTree = "<group>"; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -76,7 +50,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 500B27B523955AD400C304D4 /* Diagnostics.framework in Frameworks */, + 84F575FF26DE67180032BB3A /* Diagnostics in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -86,9 +60,9 @@ 500B276B23953F8C00C304D4 = { isa = PBXGroup; children = ( + 84F575FD26DE666B0032BB3A /* Diagnostics */, 500B277623953F8C00C304D4 /* Diagnostics-Example */, 500B277523953F8C00C304D4 /* Products */, - 500B279523953FCA00C304D4 /* Diagnostics.xcodeproj */, 500B27B323955AC000C304D4 /* Frameworks */, ); sourceTree = "<group>"; @@ -112,15 +86,6 @@ path = "Diagnostics-Example"; sourceTree = "<group>"; }; - 500B279623953FCA00C304D4 /* Products */ = { - isa = PBXGroup; - children = ( - 500B279B23953FCA00C304D4 /* Diagnostics.framework */, - 500B279D23953FCA00C304D4 /* DiagnosticsTests.xctest */, - ); - name = Products; - sourceTree = "<group>"; - }; 500B27B323955AC000C304D4 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -156,9 +121,12 @@ buildRules = ( ); dependencies = ( - 500B279F23953FEB00C304D4 /* PBXTargetDependency */, + 84F5760126DE67390032BB3A /* PBXTargetDependency */, ); name = "Diagnostics-Example"; + packageProductDependencies = ( + 84F575FE26DE67180032BB3A /* Diagnostics */, + ); productName = "Diagnostics-Example"; productReference = 500B277423953F8C00C304D4 /* Diagnostics-Example.app */; productType = "com.apple.product-type.application"; @@ -170,7 +138,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 1120; - LastUpgradeCheck = 1120; + LastUpgradeCheck = 1250; ORGANIZATIONNAME = WeTransfer; TargetAttributes = { 500B277323953F8C00C304D4 = { @@ -189,12 +157,6 @@ mainGroup = 500B276B23953F8C00C304D4; productRefGroup = 500B277523953F8C00C304D4 /* Products */; projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 500B279623953FCA00C304D4 /* Products */; - ProjectRef = 500B279523953FCA00C304D4 /* Diagnostics.xcodeproj */; - }, - ); projectRoot = ""; targets = ( 500B277323953F8C00C304D4 /* Diagnostics-Example */, @@ -202,23 +164,6 @@ }; /* End PBXProject section */ -/* Begin PBXReferenceProxy section */ - 500B279B23953FCA00C304D4 /* Diagnostics.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = Diagnostics.framework; - remoteRef = 500B279A23953FCA00C304D4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 500B279D23953FCA00C304D4 /* DiagnosticsTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = DiagnosticsTests.xctest; - remoteRef = 500B279C23953FCA00C304D4 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - /* Begin PBXResourcesBuildPhase section */ 500B277223953F8C00C304D4 /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -248,10 +193,9 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 500B279F23953FEB00C304D4 /* PBXTargetDependency */ = { + 84F5760126DE67390032BB3A /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = Diagnostics; - targetProxy = 500B279E23953FEB00C304D4 /* PBXContainerItemProxy */; + productRef = 84F5760026DE67390032BB3A /* Diagnostics */; }; /* End PBXTargetDependency section */ @@ -301,6 +245,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -361,6 +306,7 @@ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; @@ -447,6 +393,17 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 84F575FE26DE67180032BB3A /* Diagnostics */ = { + isa = XCSwiftPackageProductDependency; + productName = Diagnostics; + }; + 84F5760026DE67390032BB3A /* Diagnostics */ = { + isa = XCSwiftPackageProductDependency; + productName = Diagnostics; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 500B276C23953F8C00C304D4 /* Project object */; } diff --git a/Diagnostics.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Example/Diagnostics-Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Diagnostics.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Example/Diagnostics-Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Example/Diagnostics-Example.xcodeproj/xcshareddata/xcschemes/Diagnostics-Example.xcscheme b/Example/Diagnostics-Example.xcodeproj/xcshareddata/xcschemes/Diagnostics-Example.xcscheme index b18148f..f55ff29 100644 --- a/Example/Diagnostics-Example.xcodeproj/xcshareddata/xcschemes/Diagnostics-Example.xcscheme +++ b/Example/Diagnostics-Example.xcodeproj/xcshareddata/xcschemes/Diagnostics-Example.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "1140" + LastUpgradeVersion = "1250" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Package.swift b/Package.swift index a8161a5..9a6b936 100644 --- a/Package.swift +++ b/Package.swift @@ -20,6 +20,7 @@ let package = Package(name: "Diagnostics", ], targets: [ // dev .target(name: "DangerDependencies", dependencies: [.product(name: "Danger", package: "danger-swift"), "WeTransferPRLinter"], path: "Submodules/WeTransfer-iOS-CI/Danger-Swift", sources: ["DangerFakeSource.swift"]), - .target(name: "Diagnostics", path: "Sources", exclude: ["style.css"]) + .target(name: "Diagnostics", path: "Sources", exclude: ["style.css"]), + .testTarget(name: "DiagnosticsTests", dependencies: ["Diagnostics"], path: "DiagnosticsTests") ], swiftLanguageVersions: [.v5]) diff --git a/Sources/DiagnosticsLogger.swift b/Sources/DiagnosticsLogger.swift index a30b2d6..949ce45 100644 --- a/Sources/DiagnosticsLogger.swift +++ b/Sources/DiagnosticsLogger.swift @@ -7,6 +7,8 @@ // import Foundation +import MetricKit + #if os(macOS) import AppKit #else @@ -43,6 +45,8 @@ public final class DiagnosticsLogger { return formatter }() + private lazy var metricsMonitor: MetricsMonitor = MetricsMonitor() + /// Whether the logger is setup and ready to use. private var isSetup: Bool = false @@ -104,35 +108,10 @@ extension DiagnosticsLogger { logFileHandle.seekToEndOfFile() logSize = Int64(logFileHandle.offsetInFile) setupPipe() - setupCrashMonitoring() + metricsMonitor.startMonitoring() isSetup = true startNewSession() } - - private func setupCrashMonitoring() { - NSSetUncaughtExceptionHandler { exception in - DiagnosticsLogger.logExceptionUsingCallStackSymbols(exception, description: "Uncaught Exception") - } - } - - /// Creates a new log section with the current thread call stack symbols. - private static func logExceptionUsingCallStackSymbols(_ exception: NSException, description: String) { - let message = """ - - --- - - 🚨 CRASH: - Description: \(description) - Exception name: \(exception.name.rawValue) - Reason: \(exception.reason ?? "nil") - - \(Thread.callStackSymbols.joined(separator: "\n")) - - --- - - """ - standard.log(message) - } } // MARK: - Setup & Logging @@ -191,10 +170,10 @@ extension DiagnosticsLogger { } } - private func log(_ output: String) { + func log(_ output: String) { // Make sure we have enough disk space left. This prevents a crash due to a lack of space. guard Device.freeDiskSpaceInBytes > minimumRequiredDiskSpace else { return } - + guard let data = output.data(using: .utf8) else { return assertionFailure("Missing file handle or invalid output logged") @@ -214,7 +193,7 @@ extension DiagnosticsLogger { } else { legacyAppend(data, to: fileHandle) } - + self?.logSize += Int64(data.count) self?.trimLinesIfNecessary() } catch { @@ -222,7 +201,7 @@ extension DiagnosticsLogger { } } } - + private func legacyAppend(_ data: Data, to fileHandle: FileHandle) { defer { fileHandle.closeFile() diff --git a/Sources/MetricKit/MetricsMonitor.swift b/Sources/MetricKit/MetricsMonitor.swift new file mode 100644 index 0000000..a9954c1 --- /dev/null +++ b/Sources/MetricKit/MetricsMonitor.swift @@ -0,0 +1,83 @@ +// +// MetricsMonitor.swift +// +// +// Created by Antoine van der Lee on 31/08/2021. +// + +import Foundation +import MetricKit + +/// Monitors payloads delivered by MetricKit and logs valueable information, including crashes. +final class MetricsMonitor: NSObject { + + func startMonitoring() { + if #available(iOS 14, *) { + MXMetricManager.shared.add(self) + } + + NSSetUncaughtExceptionHandler { exception in + MetricsMonitor.logExceptionUsingCallStackSymbols(exception, description: "Uncaught Exception") + } + } + + /// Creates a new log section with the current thread call stack symbols. + private static func logExceptionUsingCallStackSymbols(_ exception: NSException, description: String) { + let message = """ + + --- + + 🚨 CRASH: + Description: \(description) + Exception name: \(exception.name.rawValue) + Reason: \(exception.reason ?? "nil") + + \(Thread.callStackSymbols.joined(separator: "\n")) + + --- + + """ + DiagnosticsLogger.standard.log(message) + } +} + +extension MetricsMonitor: MXMetricManagerSubscriber { + @available(iOS 13.0, *) + func didReceive(_ payloads: [MXMetricPayload]) { + // We don't do anything with metrics yet. + } + + @available(iOS 14.0, *) + func didReceive(_ payloads: [MXDiagnosticPayload]) { + guard let payload = payloads.last else { + // We only use the last payload to prevent duplicate logging as much as possible. + return + } + + let message = """ + + --- + MXDIAGNOSTICS RECEIVED: + \(payload.logDescription) + --- + + """ + DiagnosticsLogger.standard.log(message) + } +} + +@available(iOS 14.0, *) +extension MXDiagnosticPayload { + var logDescription: String { + var logs: [String] = [] + logs.append(contentsOf: crashDiagnostics?.compactMap { $0.logDescription } ?? []) + return logs.joined(separator: "\n") + } +} + +@available(iOS 14.0, *) +extension MXCrashDiagnostic { + var logDescription: String { + "💥 Reason: \(terminationReason ?? ""), Type: \(exceptionType?.stringValue ?? ""), Code: \(exceptionCode?.stringValue ?? ""), Signal: \(signal?.stringValue ?? ""), OS: \(metaData.osVersion), Build: \(metaData.applicationBuildVersion)" + } +}