|
1 | 1 | // swift-tools-version:5.3
|
| 2 | +import Darwin.C |
2 | 3 | import PackageDescription
|
3 | 4 |
|
| 5 | +var products: [Product] = [ |
| 6 | + .library(name: "Sentry", targets: ["Sentry"]), |
| 7 | + .library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]), |
| 8 | + .library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI"]) |
| 9 | +] |
| 10 | + |
| 11 | +var targets: [Target] = [ |
| 12 | + .binaryTarget( |
| 13 | + name: "Sentry", |
| 14 | + url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.52.1/Sentry.xcframework.zip", |
| 15 | + checksum: "48a6c6693148a3f9096108164eb938a931b964395fcf38e169383b9e4cffcfc5" //Sentry-Static |
| 16 | + ), |
| 17 | + .binaryTarget( |
| 18 | + name: "Sentry-Dynamic", |
| 19 | + url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.52.1/Sentry-Dynamic.xcframework.zip", |
| 20 | + checksum: "b9d9054c65ee5ac0591c27826edddc54490a96c2a83dee25519cae0c1a593231" //Sentry-Dynamic |
| 21 | + ), |
| 22 | + .target ( |
| 23 | + name: "SentrySwiftUI", |
| 24 | + dependencies: ["Sentry", "SentryInternal"], |
| 25 | + path: "Sources/SentrySwiftUI", |
| 26 | + exclude: ["SentryInternal/", "module.modulemap"], |
| 27 | + linkerSettings: [ |
| 28 | + .linkedFramework("Sentry") |
| 29 | + ]), |
| 30 | + .target( |
| 31 | + name: "SentryInternal", |
| 32 | + path: "Sources/SentrySwiftUI", |
| 33 | + sources: [ |
| 34 | + "SentryInternal/" |
| 35 | + ], |
| 36 | + publicHeadersPath: "SentryInternal/") |
| 37 | +] |
| 38 | + |
| 39 | +let env = getenv("EXPERIMENTAL_SPM_BUILDS") |
| 40 | +if let env, String(cString: env, encoding: .utf8) == "1" { |
| 41 | + products.append(.library(name: "SentrySPM", type: .dynamic, targets: ["SentryObjc"])) |
| 42 | + targets.append(contentsOf: [ |
| 43 | + // At least one source file is required |
| 44 | + .target(name: "SentryHeaders", path: "Sources/Sentry", sources: ["SentryDsn.m"], publicHeadersPath: "Public"), |
| 45 | + .target( |
| 46 | + name: "_SentryPrivate", |
| 47 | + dependencies: ["SentryHeaders"], |
| 48 | + path: "Sources/Sentry", |
| 49 | + sources: ["NSLocale+Sentry.m"], |
| 50 | + publicHeadersPath: "include", |
| 51 | + cSettings: [.headerSearchPath("include/HybridPublic")]), |
| 52 | + .target( |
| 53 | + name: "SentrySwift", |
| 54 | + dependencies: ["_SentryPrivate", "SentryHeaders"], |
| 55 | + path: "Sources/Swift", |
| 56 | + swiftSettings: [ |
| 57 | + // The application extension flag is required due to https://github.com/getsentry/sentry-cocoa/issues/5371 |
| 58 | + .unsafeFlags(["-enable-library-evolution", "-Xfrontend", "-application-extension"]), |
| 59 | + // This flag is used to make some API breaking changes necessary for the framework to compile with SPM. |
| 60 | + // We can either make more extensive changes to allow it to be backwards compatible, or release them as part of a V9 release. |
| 61 | + // For now we use this flag so that CI can compile the SPM version. |
| 62 | + .define("SENTRY_SWIFT_PACKAGE") |
| 63 | + ], |
| 64 | + linkerSettings: [ |
| 65 | + .unsafeFlags(["-Xlinker", "-application_extension"]) |
| 66 | + ]), |
| 67 | + .target( |
| 68 | + name: "SentryObjc", |
| 69 | + dependencies: ["SentrySwift"], |
| 70 | + path: "Sources", |
| 71 | + exclude: ["Sentry/SentryDsn.m", "Sentry/NSLocale+Sentry.m", "Swift", "SentrySwiftUI", "Resources", "Configuration"], |
| 72 | + cSettings: [ |
| 73 | + .headerSearchPath("Sentry/include/HybridPublic"), |
| 74 | + .headerSearchPath("Sentry"), |
| 75 | + .headerSearchPath("SentryCrash/Recording"), |
| 76 | + .headerSearchPath("SentryCrash/Recording/Monitors"), |
| 77 | + .headerSearchPath("SentryCrash/Recording/Tools"), |
| 78 | + .headerSearchPath("SentryCrash/Installations"), |
| 79 | + .headerSearchPath("SentryCrash/Reporting/Filters"), |
| 80 | + .headerSearchPath("SentryCrash/Reporting/Filters/Tools")]) |
| 81 | + ]) |
| 82 | +} |
| 83 | + |
4 | 84 | let package = Package(
|
5 | 85 | name: "Sentry",
|
6 | 86 | platforms: [.iOS(.v11), .macOS(.v10_13), .tvOS(.v11), .watchOS(.v4)],
|
7 |
| - products: [ |
8 |
| - .library(name: "Sentry", targets: ["Sentry"]), |
9 |
| - .library(name: "Sentry-Dynamic", targets: ["Sentry-Dynamic"]), |
10 |
| - .library(name: "SentrySwiftUI", targets: ["Sentry", "SentrySwiftUI"]) |
11 |
| - ], |
12 |
| - targets: [ |
13 |
| - .binaryTarget( |
14 |
| - name: "Sentry", |
15 |
| - url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.52.1/Sentry.xcframework.zip", |
16 |
| - checksum: "48a6c6693148a3f9096108164eb938a931b964395fcf38e169383b9e4cffcfc5" //Sentry-Static |
17 |
| - ), |
18 |
| - .binaryTarget( |
19 |
| - name: "Sentry-Dynamic", |
20 |
| - url: "https://github.com/getsentry/sentry-cocoa/releases/download/8.52.1/Sentry-Dynamic.xcframework.zip", |
21 |
| - checksum: "b9d9054c65ee5ac0591c27826edddc54490a96c2a83dee25519cae0c1a593231" //Sentry-Dynamic |
22 |
| - ), |
23 |
| - .target ( name: "SentrySwiftUI", |
24 |
| - dependencies: ["Sentry", "SentryInternal"], |
25 |
| - path: "Sources/SentrySwiftUI", |
26 |
| - exclude: ["SentryInternal/", "module.modulemap"], |
27 |
| - linkerSettings: [ |
28 |
| - .linkedFramework("Sentry") |
29 |
| - ] |
30 |
| - ), |
31 |
| - .target( name: "SentryInternal", |
32 |
| - path: "Sources/SentrySwiftUI", |
33 |
| - sources: [ |
34 |
| - "SentryInternal/" |
35 |
| - ], |
36 |
| - publicHeadersPath: "SentryInternal/" |
37 |
| - ), |
38 |
| - .target(name: "SentryCoreSwift", path: "Sources/Swift/Core") |
39 |
| - ], |
| 87 | + products: products, |
| 88 | + targets: targets, |
40 | 89 | cxxLanguageStandard: .cxx14
|
41 | 90 | )
|
0 commit comments