forked from mxcl/PromiseKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
65 lines (55 loc) · 2.11 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
// swift-tools-version:5.3
import PackageDescription
let pkg = Package(name: "PromiseKit")
pkg.platforms = [
.macOS(.v10_10),
.iOS(.v10), //FIXME strictly 8.0, but Tests require 10
.tvOS(.v10), //FIXME strictly 9.0, but Tests require 10
.watchOS(.v3)
]
pkg.swiftLanguageVersions = [.v5]
#if !os(Linux)
pkg.dependencies = [
.package(url: "https://github.com/AliSoftware/OHHTTPStubs", from: "9.1.0")
]
#endif
func dependencies(for name: String) -> [Target.Dependency] {
switch name {
case "PromiseKit":
return []
default:
return [.target(name: "PromiseKit")]
}
}
func has(tests name: String) -> Target? {
switch name {
case "PMKFoundation":
var deps = [Target.Dependency.target(name: "PMKFoundation")]
#if !os(Linux)
deps.append(.product(name: "OHHTTPStubsSwift", package: "OHHTTPStubs"))
#endif
return .testTarget(name: "\(name)Tests", dependencies: deps, path: "Tests/\(name)")
case "PMKHomeKit", "PMKMapKit", "PMKCoreLocation":
return .testTarget(name: "\(name)Tests", dependencies: [.target(name: name)], path: "Tests/\(name)")
default:
return nil
}
}
for name in ["PMKCloudKit", "PMKCoreLocation", "PMKFoundation", "PMKHealthKit", "PMKHomeKit", "PMKMapKit", "PMKPhotos", "PMKStoreKit", "PromiseKit"] {
#if os(Linux)
guard name == "PromiseKit" || name == "PMKFoundation" else { continue }
#endif
pkg.targets.append(.target(name: name, dependencies: dependencies(for: name)))
pkg.products.append(.library(name: name, targets: [name]))
if let testTarget = has(tests: name) {
pkg.targets.append(testTarget)
}
}
pkg.targets += [
.testTarget(name: "Core", dependencies: ["PromiseKit"]),
.testTarget(name: "Cancel", dependencies: ["PromiseKit"]),
.testTarget(name: "APlusSwiftTests", dependencies: ["PromiseKit"], path: "Tests/A+/Swift"),
.testTarget(name: "APlusJSTests", dependencies: ["PromiseKit"], path: "Tests/A+/JavaScript", exclude: [
"index.js", "package-lock.json", "package.json", "README.md", "webpack.config.js", "build", "node_modules"
]),
]