diff --git a/.ruby-version b/.ruby-version index f03c3ef9..25b001e7 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ - 2.6.4 + 2.7.0 diff --git a/.travis.yml b/.travis.yml index 196d8c67..5555b5dd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,6 @@ language: swift os: osx -osx_image: xcode11.2 -before_install: - - bundler install - - bundle update - - bundle exec pod repo update - - bundle exec pod install +osx_image: xcode11.6 script: - - bundle exec fastlane ios tests - - bundle exec fastlane mac tests + - sh scripts/install.sh + - sh scripts/test.sh diff --git a/Backtrace.podspec b/Backtrace.podspec index 6c6e58cf..4263bacc 100644 --- a/Backtrace.podspec +++ b/Backtrace.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "Backtrace" - s.version = "1.5.4" + s.version = "1.5.5" s.summary = "Backtrace's integration with iOS, macOS and tvOS" s.description = "Reliable crash and hang reporting for iOS, macOS and tvOS." s.homepage = "https://backtrace.io/" diff --git a/Backtrace.xcodeproj/xcshareddata/xcschemes/Backtrace-iOS.xcscheme b/Backtrace.xcodeproj/xcshareddata/xcschemes/Backtrace-iOS.xcscheme index 44411aff..898ad3d8 100644 --- a/Backtrace.xcodeproj/xcshareddata/xcschemes/Backtrace-iOS.xcscheme +++ b/Backtrace.xcodeproj/xcshareddata/xcschemes/Backtrace-iOS.xcscheme @@ -20,20 +20,6 @@ ReferencedContainer = "container:Backtrace.xcodeproj"> - - - - - - - - diff --git a/Brewfile b/Brewfile new file mode 100644 index 00000000..df6007fa --- /dev/null +++ b/Brewfile @@ -0,0 +1 @@ +brew "fastlane" \ No newline at end of file diff --git a/Brewfile.lock.json b/Brewfile.lock.json new file mode 100644 index 00000000..b46ead0b --- /dev/null +++ b/Brewfile.lock.json @@ -0,0 +1,39 @@ +{ + "entries": { + "brew": { + "fastlane": { + "version": "2.152.0", + "bottle": { + "cellar": ":any", + "prefix": "/usr/local", + "files": { + "catalina": { + "url": "https://homebrew.bintray.com/bottles/fastlane-2.152.0.catalina.bottle.tar.gz", + "sha256": "133fd49959694621a60d6212e9e21631c34015b836427353e8c864a280d579cb" + }, + "mojave": { + "url": "https://homebrew.bintray.com/bottles/fastlane-2.152.0.mojave.bottle.tar.gz", + "sha256": "346c5892ebc93be7f37ab7e080db591d4d91c1849096b478739a1873988af4f9" + }, + "high_sierra": { + "url": "https://homebrew.bintray.com/bottles/fastlane-2.152.0.high_sierra.bottle.tar.gz", + "sha256": "6d96e2a20decfae69a34e7e774edaa30da4b3d7f7895291612c33031a6d27d53" + } + } + } + } + } + }, + "system": { + "macos": { + "catalina": { + "HOMEBREW_VERSION": "2.4.7", + "HOMEBREW_PREFIX": "/usr/local", + "Homebrew/homebrew-core": "3635145b479e8168b3a6b6f93c6662e862364fd3", + "CLT": "1103.0.32.62", + "Xcode": "11.6", + "macOS": "10.15.6" + } + } + } +} diff --git a/Gemfile b/Gemfile index f03e0ee2..d1bf7c6f 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,3 @@ -# frozen_string_literal: true - source "https://rubygems.org" -git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } - -gem "fastlane" gem "cocoapods" diff --git a/Gemfile.lock b/Gemfile.lock index 13f2e7a1..6284077f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,23 +2,20 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (3.0.2) - activesupport (4.2.11.1) + activesupport (4.2.11.3) i18n (~> 0.7) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.7.0) - public_suffix (>= 2.0.2, < 5.0) - algoliasearch (1.27.1) + algoliasearch (1.27.3) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) - babosa (1.0.3) claide (1.0.3) - cocoapods (1.8.4) + cocoapods (1.9.3) activesupport (>= 4.0.2, < 5) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.8.4) + cocoapods-core (= 1.9.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.2.2, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -33,187 +30,61 @@ GEM molinillo (~> 0.6.6) nap (~> 1.0) ruby-macho (~> 1.4) - xcodeproj (>= 1.11.1, < 2.0) - cocoapods-core (1.8.4) + xcodeproj (>= 1.14.0, < 2.0) + cocoapods-core (1.9.3) activesupport (>= 4.0.2, < 6) algoliasearch (~> 1.0) concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) + netrc (~> 0.11) + typhoeus (~> 1.0) cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.3.0) + cocoapods-downloader (1.4.0) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) cocoapods-stats (1.1.0) - cocoapods-trunk (1.4.1) + cocoapods-trunk (1.5.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) - cocoapods-try (1.1.0) - colored (1.2) + cocoapods-try (1.2.0) colored2 (3.1.2) - commander-fastlane (4.4.6) - highline (~> 1.7.2) concurrent-ruby (1.1.6) - declarative (0.0.10) - declarative-option (0.1.0) - digest-crc (0.4.1) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) - dotenv (2.7.5) - emoji_regex (1.0.1) escape (0.0.4) - excon (0.72.0) - faraday (0.17.3) - multipart-post (>= 1.2, < 3) - faraday-cookie_jar (0.0.6) - faraday (>= 0.7.4) - http-cookie (~> 1.0.0) - faraday_middleware (0.13.1) - faraday (>= 0.7.4, < 1.0) - fastimage (2.1.7) - fastlane (2.141.0) - CFPropertyList (>= 2.3, < 4.0.0) - addressable (>= 2.3, < 3.0.0) - babosa (>= 1.0.2, < 2.0.0) - bundler (>= 1.12.0, < 3.0.0) - colored - commander-fastlane (>= 4.4.6, < 5.0.0) - dotenv (>= 2.1.1, < 3.0.0) - emoji_regex (>= 0.1, < 2.0) - excon (>= 0.71.0, < 1.0.0) - faraday (~> 0.17) - faraday-cookie_jar (~> 0.0.6) - faraday_middleware (~> 0.13.1) - fastimage (>= 2.1.0, < 3.0.0) - gh_inspector (>= 1.1.2, < 2.0.0) - google-api-client (>= 0.29.2, < 0.37.0) - google-cloud-storage (>= 1.15.0, < 2.0.0) - highline (>= 1.7.2, < 2.0.0) - json (< 3.0.0) - jwt (~> 2.1.0) - mini_magick (>= 4.9.4, < 5.0.0) - multi_xml (~> 0.5) - multipart-post (~> 2.0.0) - plist (>= 3.1.0, < 4.0.0) - public_suffix (~> 2.0.0) - rubyzip (>= 1.3.0, < 2.0.0) - security (= 0.1.3) - simctl (~> 1.6.3) - slack-notifier (>= 2.0.0, < 3.0.0) - terminal-notifier (>= 2.0.0, < 3.0.0) - terminal-table (>= 1.4.5, < 2.0.0) - tty-screen (>= 0.6.3, < 1.0.0) - tty-spinner (>= 0.8.0, < 1.0.0) - word_wrap (~> 1.0.0) - xcodeproj (>= 1.13.0, < 2.0.0) - xcpretty (~> 0.3.0) - xcpretty-travis-formatter (>= 0.0.3) + ethon (0.12.0) + ffi (>= 1.3.0) + ffi (1.13.1) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - google-api-client (0.36.4) - addressable (~> 2.5, >= 2.5.1) - googleauth (~> 0.9) - httpclient (>= 2.8.1, < 3.0) - mini_mime (~> 1.0) - representable (~> 3.0) - retriable (>= 2.0, < 4.0) - signet (~> 0.12) - google-cloud-core (1.5.0) - google-cloud-env (~> 1.0) - google-cloud-errors (~> 1.0) - google-cloud-env (1.3.0) - faraday (~> 0.11) - google-cloud-errors (1.0.0) - google-cloud-storage (1.25.1) - addressable (~> 2.5) - digest-crc (~> 0.4) - google-api-client (~> 0.33) - google-cloud-core (~> 1.2) - googleauth (~> 0.9) - mini_mime (~> 1.0) - googleauth (0.10.0) - faraday (~> 0.12) - jwt (>= 1.4, < 3.0) - memoist (~> 0.16) - multi_json (~> 1.11) - os (>= 0.9, < 2.0) - signet (~> 0.12) - highline (1.7.10) - http-cookie (1.0.3) - domain_name (~> 0.5) httpclient (2.8.3) i18n (0.9.5) concurrent-ruby (~> 1.0) - json (2.3.0) - jwt (2.1.0) - memoist (0.16.2) - mini_magick (4.10.1) - mini_mime (1.0.2) - minitest (5.14.0) + json (2.3.1) + minitest (5.14.1) molinillo (0.6.6) - multi_json (1.14.1) - multi_xml (0.6.0) - multipart-post (2.0.0) - nanaimo (0.2.6) + nanaimo (0.3.0) nap (1.1.0) - naturally (2.2.0) netrc (0.11.0) - os (1.0.1) - plist (3.5.0) - public_suffix (2.0.5) - representable (3.0.4) - declarative (< 0.1.0) - declarative-option (< 0.2.0) - uber (< 0.2.0) - retriable (3.1.2) - rouge (2.0.7) ruby-macho (1.4.0) - rubyzip (1.3.0) - security (0.1.3) - signet (0.12.0) - addressable (~> 2.3) - faraday (~> 0.9) - jwt (>= 1.5, < 3.0) - multi_json (~> 1.10) - simctl (1.6.8) - CFPropertyList - naturally - slack-notifier (2.3.2) - terminal-notifier (2.0.0) - terminal-table (1.8.0) - unicode-display_width (~> 1.1, >= 1.1.1) thread_safe (0.3.6) - tty-cursor (0.7.1) - tty-screen (0.7.1) - tty-spinner (0.9.3) - tty-cursor (~> 0.7) - tzinfo (1.2.6) + typhoeus (1.4.0) + ethon (>= 0.9.0) + tzinfo (1.2.7) thread_safe (~> 0.1) - uber (0.1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.6) - unicode-display_width (1.6.1) - word_wrap (1.0.0) - xcodeproj (1.15.0) + xcodeproj (1.17.1) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) - nanaimo (~> 0.2.6) - xcpretty (0.3.0) - rouge (~> 2.0.7) - xcpretty-travis-formatter (1.0.0) - xcpretty (~> 0.2, >= 0.0.7) + nanaimo (~> 0.3.0) PLATFORMS ruby DEPENDENCIES cocoapods - fastlane BUNDLED WITH - 2.0.2 + 2.1.4 diff --git a/Podfile.lock b/Podfile.lock index 75e8439d..5da9c4b4 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - Backtrace (1.5.4): + - Backtrace (1.5.5): - Backtrace-PLCrashReporter - Backtrace-PLCrashReporter (1.5.2) - Nimble (8.0.5) @@ -22,11 +22,11 @@ EXTERNAL SOURCES: :path: "./Backtrace.podspec" SPEC CHECKSUMS: - Backtrace: 3be763061ac14fd97029d78cbfc6b39c179b62a9 + Backtrace: d3dfe8106c641cbee1413dec5e3c997840bbe17d Backtrace-PLCrashReporter: cae6b9bd6d0b2f55adc114c1a41908c03f1bfc72 Nimble: 4ab1aeb9b45553c75b9687196b0fa0713170a332 Quick: 7fb19e13be07b5dfb3b90d4f9824c855a11af40e PODFILE CHECKSUM: 62d8c592f7a14dbdbf06ce7cbf47810c1a25075e -COCOAPODS: 1.8.4 +COCOAPODS: 1.9.3 diff --git a/Sources/Features/Crash Reporting/CrashReporter.swift b/Sources/Features/Crash Reporting/CrashReporter.swift index 2b6e0f4f..542c9a69 100644 --- a/Sources/Features/Crash Reporting/CrashReporter.swift +++ b/Sources/Features/Crash Reporting/CrashReporter.swift @@ -5,13 +5,12 @@ final class CrashReporter { private let reporter: PLCrashReporter static private let crashName = "live_report" public init(config: PLCrashReporterConfig = PLCrashReporterConfig.defaultConfiguration()) { - reporter = PLCrashReporter.init(configuration: config) + reporter = PLCrashReporter(configuration: config) } } extension CrashReporter: CrashReporting { func signalContext(_ mutableContext: inout SignalContext) { - let rawMutablePointer = UnsafeMutableRawPointer(&mutableContext) let handler: @convention(c) (_ signalInfo: UnsafeMutablePointer?, _ uContext: UnsafeMutablePointer?, _ context: UnsafeMutableRawPointer?) -> Void = { signalInfoPointer, _, context in @@ -22,7 +21,10 @@ extension CrashReporter: CrashReporting { attributesProvider.set(faultMessage: "siginfo_t.si_signo: \(signalInfo.si_signo)") try? AttributesStorage.store(attributesProvider.allAttributes, fileName: CrashReporter.crashName) } - var callbacks = PLCrashReporterCallbacks(version: 0, context: rawMutablePointer, handleSignal: handler) + + var callbacks = withUnsafeMutableBytes(of: &mutableContext) { rawMutablePointer in + PLCrashReporterCallbacks(version: 0, context: rawMutablePointer.baseAddress, handleSignal: handler) + } reporter.setCrash(&callbacks) } diff --git a/Sources/Features/Extensions/URLSession+Sync.swift b/Sources/Features/Extensions/URLSession+Sync.swift index 7d8505de..23329ff5 100644 --- a/Sources/Features/Extensions/URLSession+Sync.swift +++ b/Sources/Features/Extensions/URLSession+Sync.swift @@ -1,11 +1,15 @@ import Foundation extension URLSession { - typealias Response = (responseData: Data?, urlResponse: HTTPURLResponse?, responseError: Error?) + typealias Response = (responseData: Data?, urlResponse: HTTPURLResponse?, responseError: Swift.Error?) + + enum Error: Swift.Error { + case failedToReceiveResponse + } func sync(_ urlRequest: URLRequest) -> Response { let semaphore = DispatchSemaphore(value: 0) - var response: Response + var response: Response = Response(nil, nil, Error.failedToReceiveResponse) let task = dataTask(with: urlRequest, completionHandler: { (responseData, responseUrl, responseError) in diff --git a/Tests/AttributesTests.swift b/Tests/AttributesTests.swift index 649b3bad..5fc55ffb 100644 --- a/Tests/AttributesTests.swift +++ b/Tests/AttributesTests.swift @@ -91,7 +91,10 @@ final class AttributesTests: QuickSpec { } it("sets process age information") { - expect { try ProcessInfo.age() }.toNot(be(0)) + expect { + sleep(1) + return try ProcessInfo.age() + }.toNot(be(0)) } it("sets number of threads information") { diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d6d2eb39..3f738d78 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -18,14 +18,14 @@ default_platform(:ios) platform :ios do desc "Run iOS tests" lane :tests do - common_tests(scheme: "Backtrace-iOS") + common_tests(scheme: "Backtrace-iOS", disable_slide_to_type: true) end end platform :mac do desc "Run macOS tests" lane :tests do - common_tests(scheme: "Backtrace-macOS") + common_tests(scheme: "Backtrace-macOS", disable_slide_to_type: true) end end @@ -44,7 +44,7 @@ lane :common_tests do |options| clean: true, code_coverage: true, open_report: true, - disable_slide_to_type: false, + disable_slide_to_type: options[:disable_slide_to_type], disable_concurrent_testing: true ) end diff --git a/fastlane/README.md b/fastlane/README.md index efb9e33d..9887961e 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -12,7 +12,7 @@ Install _fastlane_ using ``` [sudo] gem install fastlane -NV ``` -or alternatively using `brew cask install fastlane` +or alternatively using `brew install fastlane` # Available Actions ### common_tests diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100644 index 00000000..4d7f734a --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -ex + +brew bundle +gem install bundler:2.1.4 +bundle install +bundle exec pod repo update +bundle exec pod install diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100644 index 00000000..118d5de1 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -ex + +fastlane ios tests +fastlane mac tests \ No newline at end of file