-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
82 lines (66 loc) · 2.18 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
76
77
78
79
80
81
82
// swift-tools-version:5.10
import Foundation
import PackageDescription
// MARK: - Configuration Service
ConfigurationService.local.dependencies = [
.package(name: "WrkstrmLog", path: "../WrkstrmLog"),
.package(name: "WrkstrmMain", path: "../WrkstrmMain"),
]
ConfigurationService.remote.dependencies = [
.package(url: "https://github.com/wrkstrm/WrkstrmLog.git", from: "0.4.0"),
.package(url: "https://github.com/wrkstrm/WrkstrmMain.git", from: "1.0.0"),
]
// MARK: - Package Declaration
print("---- ConfigurationService Deps ----")
print(ConfigurationService.inject.dependencies.map(\.kind))
print("---- ConfigurationService Deps ----")
let package = Package(
name: "WrkstrmFoundation",
platforms: [
.iOS(.v16),
.macOS(.v13),
.macCatalyst(.v13),
.tvOS(.v16),
.visionOS(.v1),
.watchOS(.v9),
],
products: [
.library(name: "WrkstrmFoundation", targets: ["WrkstrmFoundation"])
],
dependencies: ConfigurationService.inject.dependencies,
targets: [
.target(
name: "WrkstrmFoundation",
dependencies: ["WrkstrmLog", "WrkstrmMain"],
swiftSettings: ConfigurationService.inject.swiftSettings
),
.testTarget(
name: "WrkstrmFoundationTests",
dependencies: ["WrkstrmFoundation"],
swiftSettings: ConfigurationService.inject.swiftSettings
),
]
)
// MARK: - Configuration Service
public struct ConfigurationService {
public static let version = "0.0.0"
public var swiftSettings: [SwiftSetting] = []
var dependencies: [PackageDescription.Package.Dependency] = []
public static let inject: ConfigurationService = ProcessInfo.useLocalDeps ? .local : .remote
static var local: ConfigurationService = .init(swiftSettings: [.localSwiftSettings])
static var remote: ConfigurationService = .init()
}
// MARK: - PackageDescription extensions
extension SwiftSetting {
public static let localSwiftSettings: SwiftSetting = .unsafeFlags([
"-Xfrontend",
"-warn-long-expression-type-checking=10",
])
}
// MARK: - Foundation extensions
extension ProcessInfo {
public static var useLocalDeps: Bool {
ProcessInfo.processInfo.environment["SPM_USE_LOCAL_DEPS"] == "true"
}
}
// CONFIG_SERVICE_END_V1_HASH:{{CONFIG_HASH}}