forked from RevenueCat/purchases-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
75 lines (63 loc) · 2.39 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
import class Foundation.ProcessInfo
let shouldTest = ProcessInfo.processInfo.environment["TEST"] == "1"
func resolveDependencies() -> [Package.Dependency] {
if shouldTest {
return [
.package(url: "https://github.com/AliSoftware/OHHTTPStubs.git", .branch("feature/spm-support")),
.package(url: "https://github.com/Quick/Nimble", .exact("8.0.4"))
]
}
return []
}
func resolveTargets() -> [Target] {
let objcSources = ["Purchases/Info.plist",
"Purchases/Caching",
"Purchases/FoundationExtensions",
"Purchases/Misc",
"Purchases/Networking",
"Purchases/Public",
"Purchases/Purchasing",
"Purchases/ProtectedExtensions",
"Purchases/SubscriberAttributes",
"Purchases/SwiftInterfaces"]
let infoPlist = "Purchases/Info.plist"
let swiftSources = "Purchases/SwiftSources"
let baseTargets: [Target] = [
.target(name: "Purchases",
dependencies: ["PurchasesCoreSwift"],
path: ".",
exclude: [infoPlist, swiftSources],
sources: ["Purchases"],
publicHeadersPath: "Purchases/Public",
cSettings: objcSources.map { CSetting.headerSearchPath($0) }
),
.target(name: "PurchasesCoreSwift",
dependencies: [],
path: ".",
sources: ["PurchasesCoreSwift"])]
if shouldTest {
let testTargets: [Target] = [
.testTarget(name: "PurchasesTests",
dependencies: ["Purchases", "OHHTTPStubs", "Nimble"],
path: "PurchasesTests",
exclude: [],
sources: nil)]
return baseTargets + testTargets
}
return baseTargets
}
let package = Package(
name: "Purchases",
platforms: [
.macOS(.v10_12), .iOS(.v9), .watchOS("6.2"), .tvOS(.v9)
],
products: [
.library(name: "Purchases",
targets: ["Purchases"]),
],
dependencies: resolveDependencies(),
targets: resolveTargets()
)