-
-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathPackage.swift
More file actions
59 lines (51 loc) · 1.91 KB
/
Package.swift
File metadata and controls
59 lines (51 loc) · 1.91 KB
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
// swift-tools-version: 6.0
import PackageDescription
let package = Package(
name: "swift-osc",
platforms: [.macOS(.v10_15), .iOS(.v13), .tvOS(.v13), .watchOS(.v6)],
products: [
.library(name: "SwiftOSC", targets: ["SwiftOSC"])
],
dependencies: [
.package(url: "https://github.com/orchetect/swift-osc-core", exact: "1.3.0"),
.package(url: "https://github.com/orchetect/swift-osc-io-nio", exact: "1.1.0")
],
targets: [
.target(
name: "SwiftOSC",
dependencies: [
.product(name: "SwiftOSCCore", package: "swift-osc-core"),
.product(name: "SwiftOSCIO", package: "swift-osc-io-nio")
],
swiftSettings: [.define("DEBUG", .when(configuration: .debug))]
)
],
swiftLanguageModes: [.v5, .v6]
)
#if canImport(Foundation) || canImport(CoreFoundation)
#if canImport(Foundation)
import class Foundation.ProcessInfo
func getEnvironmentVar(_ name: String) -> String? {
ProcessInfo.processInfo.environment[name]
}
#elseif canImport(CoreFoundation)
import CoreFoundation
func getEnvironmentVar(_ name: String) -> String? {
guard let rawValue = getenv(name) else { return nil }
return String(utf8String: rawValue)
}
#endif
func isEnvironmentVarTrue(_ name: String) -> Bool {
guard let value = getEnvironmentVar(name)?
.trimmingCharacters(in: .whitespacesAndNewlines)
else { return false }
return ["true", "yes", "1"].contains(value.lowercased())
}
// MARK: - CI Pipeline
if isEnvironmentVarTrue("GITHUB_ACTIONS") {
for target in package.targets.filter(\.isTest) {
if target.swiftSettings == nil { target.swiftSettings = [] }
target.swiftSettings? += [.define("GITHUB_ACTIONS", .when(configuration: .debug))]
}
}
#endif