-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPackage.swift
75 lines (64 loc) · 2.52 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
74
75
// swift-tools-version: 5.6
import PackageDescription
import class Foundation.ProcessInfo
var dependencies: [Target.Dependency] = {
var dependencies: [Target.Dependency] = [
.product(name: "OrderedCollections", package: "swift-collections")
]
if ProcessInfo.processInfo.environment["ASYNCOBJECTS_ENABLE_LOGGING_LEVEL"] != nil {
dependencies.append(.product(name: "Logging", package: "swift-log"))
}
return dependencies
}()
var settings: [SwiftSetting] = {
var settings: [SwiftSetting] = []
if ProcessInfo.processInfo.environment["SWIFTCI_CONCURRENCY_CHECKS"] != nil {
settings.append(
.unsafeFlags([
"-Xfrontend",
"-warn-concurrency",
"-enable-actor-data-race-checks",
"-require-explicit-sendable",
"-strict-concurrency=complete"
])
)
}
if ProcessInfo.processInfo.environment["SWIFTCI_WARNINGS_AS_ERRORS"] != nil {
settings.append(.unsafeFlags(["-warnings-as-errors"]))
}
if ProcessInfo.processInfo.environment["ASYNCOBJECTS_USE_CHECKEDCONTINUATION"] != nil {
settings.append(.define("ASYNCOBJECTS_USE_CHECKEDCONTINUATION"))
}
if let level = ProcessInfo.processInfo.environment["ASYNCOBJECTS_ENABLE_LOGGING_LEVEL"] {
if level.caseInsensitiveCompare("TRACE") == .orderedSame {
settings.append(.define("ASYNCOBJECTS_ENABLE_LOGGING_LEVEL_TRACE"))
} else if level.caseInsensitiveCompare("DEBUG") == .orderedSame {
settings.append(.define("ASYNCOBJECTS_ENABLE_LOGGING_LEVEL_DEBUG"))
} else {
settings.append(.define("ASYNCOBJECTS_ENABLE_LOGGING_LEVEL_INFO"))
}
}
return settings
}()
let package = Package(
name: "AsyncObjects",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
.library(name: "AsyncObjects", targets: ["AsyncObjects"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-format", from: "0.50700.0"),
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
],
targets: [
.target(name: "AsyncObjects", dependencies: dependencies, swiftSettings: settings),
.testTarget(name: "AsyncObjectsTests", dependencies: ["AsyncObjects"]),
]
)