From b436eb9e7e926749167b7a8dacee8cc5ac282e27 Mon Sep 17 00:00:00 2001 From: Luis Padron Date: Fri, 4 Oct 2024 14:08:08 -0400 Subject: [PATCH] Add support for Swift Package Manager --- .github/workflows/ci.yml | 13 +++++++ Package.resolved | 24 ++++++++++++ Package.swift | 38 +++++++++++++++++++ .../CrashReportAttachmentGenerator.swift | 4 ++ 4 files changed, 79 insertions(+) create mode 100644 Package.resolved create mode 100644 Package.swift diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4fd2807..0ccc96a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,3 +39,16 @@ jobs: run: bundle install --gemfile=Example/Gemfile - name: Lint AardvarkCrashReport Podspec run: bundle exec --gemfile=Example/Gemfile pod lib lint --verbose --fail-fast AardvarkCrashReport.podspec --allow-warnings + swift-build: + name: Swift Build + runs-on: macos-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Build + run: | + sudo xcode-select -s /Applications/Xcode_15.4.0.app + xcodebuild build \ + -scheme AardvarkCrashReport \ + -sdk iphonesimulator17.5 \ + -destination "OS=17.5,name=iPhone 15 Pro" diff --git a/Package.resolved b/Package.resolved new file mode 100644 index 0000000..85caf92 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,24 @@ +{ + "originHash" : "549469f9f553a93950ff05d44df84d6f9fbc6bed57d3b703d1d2c0c5e81bad4d", + "pins" : [ + { + "identity" : "aardvark", + "kind" : "remoteSourceControl", + "location" : "https://github.com/square/Aardvark", + "state" : { + "revision" : "2eb62ce13df23128dcc89b70cf200d369d47dbbd", + "version" : "5.2.0" + } + }, + { + "identity" : "plcrashreporter", + "kind" : "remoteSourceControl", + "location" : "https://github.com/microsoft/plcrashreporter", + "state" : { + "revision" : "6752f71de206f6a53fa6a758c3660fd9a7fe7527", + "version" : "1.11.2" + } + } + ], + "version" : 3 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..25390e7 --- /dev/null +++ b/Package.swift @@ -0,0 +1,38 @@ +// swift-tools-version:5.10 + +import PackageDescription + +let package = Package( + name: "AardvarkCrashReport", + platforms: [ + .iOS(.v14), + ], + products: [ + .library( + name: "AardvarkCrashReport", + targets: ["AardvarkCrashReport"] + ), + ], + dependencies: [ + .package( + url: "https://github.com/microsoft/plcrashreporter", + .upToNextMajor(from: "1.10.0") + ), + .package( + url: "https://github.com/square/Aardvark", + .upToNextMajor(from: "5.2.0") + ), + ], + targets: [ + .target( + name: "AardvarkCrashReport", + dependencies: [ + .product(name: "Aardvark", package: "Aardvark"), + .product(name: "CrashReporter", package: "plcrashreporter"), + ], + cSettings: [ + .define("SWIFT_PACKAGE"), + ] + ), + ] +) diff --git a/Sources/AardvarkCrashReport/CrashReportAttachmentGenerator.swift b/Sources/AardvarkCrashReport/CrashReportAttachmentGenerator.swift index af6b931..b9a6ad8 100644 --- a/Sources/AardvarkCrashReport/CrashReportAttachmentGenerator.swift +++ b/Sources/AardvarkCrashReport/CrashReportAttachmentGenerator.swift @@ -17,6 +17,10 @@ import Aardvark import CrashReporter +#if SWIFT_PACKAGE +import AardvarkSwift +#endif + public final class CrashReportAttachmentGenerator { // MARK: - Public Static Method