-
Notifications
You must be signed in to change notification settings - Fork 47
/
Package.swift
172 lines (164 loc) · 6.23 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let availabilityDefinition = PackageDescription.SwiftSetting.unsafeFlags([
"-Xfrontend",
"-define-availability",
"-Xfrontend",
"SwiftStdlib 5.7:macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0",
"-Xfrontend",
"-define-availability",
"-Xfrontend",
"SwiftStdlib 5.8:macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4",
"-Xfrontend",
"-define-availability",
"-Xfrontend",
"SwiftStdlib 5.9:macOS 14.0, iOS 17.0, watchOS 10.0, tvOS 17.0",
"-Xfrontend",
"-define-availability",
"-Xfrontend",
"SwiftStdlib 5.10:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999",
"-Xfrontend",
"-define-availability",
"-Xfrontend",
"SwiftStdlib 6.0:macOS 9999, iOS 9999, watchOS 9999, tvOS 9999",
])
/// Swift settings for building a private stdlib-like module that is to be used
/// by other stdlib-like modules only.
let privateStdlibSettings: [PackageDescription.SwiftSetting] = [
.unsafeFlags(["-Xfrontend", "-disable-implicit-concurrency-module-import"]),
.unsafeFlags(["-Xfrontend", "-disable-implicit-string-processing-module-import"]),
]
/// Swift settings for building a user-facing stdlib-like module.
let publicStdlibSettings: [PackageDescription.SwiftSetting] = [
.unsafeFlags(["-enable-library-evolution"]),
.unsafeFlags(["-Xfrontend", "-disable-implicit-concurrency-module-import"]),
.unsafeFlags(["-Xfrontend", "-disable-implicit-string-processing-module-import"]),
availabilityDefinition
]
let package = Package(
name: "swift-experimental-string-processing",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "_StringProcessing",
targets: ["_StringProcessing"]),
// FIXME: Disabled due to rdar://94763190.
// .library(
// name: "Prototypes",
// targets: ["Prototypes"]),
.library(
name: "_RegexParser",
targets: ["_RegexParser"]),
.executable(
name: "VariadicsGenerator",
targets: ["VariadicsGenerator"]),
// Disable to work around rdar://126877024
.executable(
name: "RegexBenchmark",
targets: ["RegexBenchmark"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "_RegexParser",
dependencies: [],
swiftSettings: privateStdlibSettings),
.testTarget(
name: "MatchingEngineTests",
dependencies: [
"_RegexParser", "_StringProcessing"
]),
.target(
name: "_CUnicode",
dependencies: []),
.target(
name: "_StringProcessing",
dependencies: [
"_RegexParser",
"_CUnicode",
],
swiftSettings: publicStdlibSettings),
.target(
name: "RegexBuilder",
dependencies: ["_StringProcessing", "_RegexParser"],
swiftSettings: publicStdlibSettings),
.target(name: "TestSupport",
swiftSettings: [availabilityDefinition]),
.testTarget(
name: "RegexTests",
dependencies: ["_StringProcessing", "RegexBuilder", "TestSupport"],
swiftSettings: [
availabilityDefinition
]),
.testTarget(
name: "RegexBuilderTests",
dependencies: ["_StringProcessing", "RegexBuilder", "TestSupport"],
swiftSettings: [
availabilityDefinition
]),
.testTarget(
name: "DocumentationTests",
dependencies: ["_StringProcessing", "RegexBuilder"],
swiftSettings: [
availabilityDefinition,
.unsafeFlags(["-enable-bare-slash-regex"]),
]),
// FIXME: Disabled due to rdar://94763190.
// .testTarget(
// name: "Prototypes",
// dependencies: ["_RegexParser", "_StringProcessing"],
// swiftSettings: [
// .unsafeFlags(["-Xfrontend", "-disable-availability-checking"])
// ]),
// MARK: Scripts
.executableTarget(
name: "VariadicsGenerator",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser")
]),
.executableTarget(
name: "PatternConverter",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"_RegexParser",
"_StringProcessing"
]),
.executableTarget(
name: "RegexTester",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"_RegexParser",
"_StringProcessing"
],
swiftSettings: [availabilityDefinition]),
.executableTarget(
name: "RegexBenchmark",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"_RegexParser",
"_StringProcessing",
"RegexBuilder"
],
swiftSettings: [
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"]),
]),
// MARK: Exercises
.target(
name: "Exercises",
dependencies: ["_RegexParser", "_StringProcessing", "RegexBuilder"],
swiftSettings: [
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"])
]),
.testTarget(
name: "ExercisesTests",
dependencies: ["Exercises"],
swiftSettings: [
.unsafeFlags(["-Xfrontend", "-disable-availability-checking"])
])
]
)