@@ -39,187 +39,227 @@ let package = Package(
39
39
] ,
40
40
products: [
41
41
. library( name: " IDEUtils " , type: . static, targets: [ " IDEUtils " ] ) ,
42
+ . library( name: " SwiftCompilerPlugin " , type: . static, targets: [ " SwiftCompilerPlugin " ] ) ,
43
+ . library( name: " SwiftCompilerPluginMessageHandling " , type: . static, targets: [ " SwiftCompilerPluginMessageHandling " ] ) ,
42
44
. library( name: " SwiftDiagnostics " , type: . static, targets: [ " SwiftDiagnostics " ] ) ,
43
45
. library( name: " SwiftOperators " , type: . static, targets: [ " SwiftOperators " ] ) ,
44
46
. library( name: " SwiftParser " , type: . static, targets: [ " SwiftParser " ] ) ,
45
47
. library( name: " SwiftParserDiagnostics " , type: . static, targets: [ " SwiftParserDiagnostics " ] ) ,
48
+ . library( name: " SwiftRefactor " , type: . static, targets: [ " SwiftRefactor " ] ) ,
46
49
. library( name: " SwiftSyntax " , type: . static, targets: [ " SwiftSyntax " ] ) ,
47
- . library( name: " SwiftSyntaxParser " , type: . static, targets: [ " SwiftSyntaxParser " ] ) ,
48
50
. library( name: " SwiftSyntaxBuilder " , type: . static, targets: [ " SwiftSyntaxBuilder " ] ) ,
49
51
. library( name: " SwiftSyntaxMacros " , type: . static, targets: [ " SwiftSyntaxMacros " ] ) ,
50
- . library( name: " SwiftCompilerPlugin " , type: . static, targets: [ " SwiftCompilerPlugin " ] ) ,
51
- . library( name: " SwiftCompilerPluginMessageHandling " , type: . static, targets: [ " SwiftCompilerPluginMessageHandling " ] ) ,
52
- . library( name: " SwiftRefactor " , type: . static, targets: [ " SwiftRefactor " ] ) ,
52
+ . library( name: " SwiftSyntaxParser " , type: . static, targets: [ " SwiftSyntaxParser " ] ) ,
53
53
] ,
54
54
targets: [
55
- . target( name: " _InstructionCounter " ) ,
56
- . target(
57
- name: " SwiftBasicFormat " ,
58
- dependencies: [ " SwiftSyntax " ] ,
59
- exclude: [
60
- " CMakeLists.txt "
61
- ]
62
- ) ,
63
- . target(
64
- name: " SwiftDiagnostics " ,
65
- dependencies: [ " SwiftSyntax " ] ,
66
- exclude: [
67
- " CMakeLists.txt "
68
- ]
69
- ) ,
70
- . target(
71
- name: " SwiftSyntax " ,
72
- dependencies: [ ] ,
73
- exclude: [
74
- " CMakeLists.txt "
75
- ] ,
76
- swiftSettings: swiftSyntaxSwiftSettings
77
- ) ,
78
- . target(
79
- name: " SwiftSyntaxBuilder " ,
80
- dependencies: [ " SwiftBasicFormat " , " SwiftSyntax " , " SwiftParser " , " SwiftParserDiagnostics " ] ,
81
- exclude: [
82
- " CMakeLists.txt "
83
- ]
84
- ) ,
55
+ // MARK: - Internal helper targets
56
+
85
57
. target(
86
- name: " SwiftSyntaxParser " ,
87
- dependencies: [ " SwiftSyntax " , " SwiftParser " ]
58
+ name: " _InstructionCounter "
88
59
) ,
60
+
89
61
. target(
90
62
name: " _SwiftSyntaxTestSupport " ,
91
63
dependencies: [ " SwiftBasicFormat " , " SwiftSyntax " , " SwiftSyntaxBuilder " ]
92
64
) ,
65
+
66
+ // MARK: - Library targets
67
+ // Formatting style:
68
+ // - One section for each target and its test target
69
+ // - Sections are sorted alphabetically
70
+ // - Each target argument takes exactly one line, unless there are external dependencies.
71
+ // In that case package and internal dependencies are on different lines.
72
+ // - All array elements are sorted alphabetically
73
+
74
+ // MARK: IDEUtils
75
+
93
76
. target(
94
77
name: " IDEUtils " ,
95
78
dependencies: [ " SwiftSyntax " ] ,
96
- exclude: [
97
- " CMakeLists.txt "
98
- ]
99
- ) ,
100
- . target(
101
- name: " SwiftParser " ,
102
- dependencies: [ " SwiftSyntax " ] ,
103
- exclude: [
104
- " CMakeLists.txt " ,
105
- " README.md " ,
106
- ]
79
+ exclude: [ " CMakeLists.txt " ]
107
80
) ,
108
- . target(
109
- name: " SwiftParserDiagnostics " ,
110
- dependencies: [ " SwiftBasicFormat " , " SwiftDiagnostics " , " SwiftParser " , " SwiftSyntax " ] ,
111
- exclude: [
112
- " CMakeLists.txt "
113
- ]
114
- ) ,
115
- . target(
116
- name: " SwiftOperators " ,
117
- dependencies: [ " SwiftSyntax " , " SwiftParser " , " SwiftDiagnostics " ] ,
118
- exclude: [
119
- " CMakeLists.txt "
120
- ]
81
+
82
+ . testTarget(
83
+ name: " IDEUtilsTest " ,
84
+ dependencies: [ " _SwiftSyntaxTestSupport " , " IDEUtils " , " SwiftParser " , " SwiftSyntax " ]
121
85
) ,
86
+
87
+ // MARK: SwiftBasicFormat
88
+
122
89
. target(
123
- name: " SwiftSyntaxMacros " ,
124
- dependencies: [
125
- " SwiftSyntax " , " SwiftSyntaxBuilder " , " SwiftParser " , " SwiftDiagnostics " ,
126
- ] ,
127
- exclude: [
128
- " CMakeLists.txt "
129
- ]
90
+ name: " SwiftBasicFormat " ,
91
+ dependencies: [ " SwiftSyntax " ] ,
92
+ exclude: [ " CMakeLists.txt " ]
130
93
) ,
94
+
95
+ // MARK: SwiftCompilerPlugin
96
+
131
97
. target(
132
98
name: " SwiftCompilerPlugin " ,
133
- dependencies: [
134
- " SwiftCompilerPluginMessageHandling " , " SwiftSyntaxMacros " ,
135
- ]
99
+ dependencies: [ " SwiftCompilerPluginMessageHandling " , " SwiftSyntaxMacros " ]
100
+ ) ,
101
+
102
+ . testTarget(
103
+ name: " SwiftCompilerPluginTest " ,
104
+ dependencies: [ " SwiftCompilerPlugin " ]
136
105
) ,
106
+
107
+ // MARK: SwiftCompilerPluginMessageHandling
108
+
137
109
. target(
138
110
name: " SwiftCompilerPluginMessageHandling " ,
139
- dependencies: [
140
- " SwiftSyntax " , " SwiftParser " , " SwiftDiagnostics " , " SwiftSyntaxMacros " , " SwiftOperators " ,
141
- ] ,
142
- exclude: [
143
- " CMakeLists.txt "
144
- ]
111
+ dependencies: [ " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " , " SwiftSyntax " , " SwiftSyntaxMacros " ] ,
112
+ exclude: [ " CMakeLists.txt " ]
145
113
) ,
114
+
115
+ // MARK: SwiftDiagnostics
116
+
146
117
. target(
147
- name: " SwiftRefactor " ,
148
- dependencies: [
149
- " SwiftSyntax " , " SwiftParser " ,
150
- ]
151
- ) ,
152
- . executableTarget(
153
- name: " lit-test-helper " ,
154
- dependencies: [ " IDEUtils " , " SwiftSyntax " , " SwiftSyntaxParser " ]
155
- ) ,
156
- . executableTarget(
157
- name: " swift-parser-cli " ,
158
- dependencies: [
159
- " _InstructionCounter " , " SwiftDiagnostics " , " SwiftSyntax " , " SwiftParser " , " SwiftParserDiagnostics " , " SwiftOperators " ,
160
- . product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
161
- ]
118
+ name: " SwiftDiagnostics " ,
119
+ dependencies: [ " SwiftSyntax " ] ,
120
+ exclude: [ " CMakeLists.txt " ]
162
121
) ,
163
- . testTarget ( name : " IDEUtilsTest " , dependencies : [ " _SwiftSyntaxTestSupport " , " SwiftParser " , " SwiftSyntax " , " IDEUtils " ] ) ,
122
+
164
123
. testTarget(
165
124
name: " SwiftDiagnosticsTest " ,
166
125
dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftDiagnostics " , " SwiftParser " , " SwiftParserDiagnostics " ]
167
126
) ,
127
+
128
+ // MARK: SwiftSyntax
129
+
130
+ . target(
131
+ name: " SwiftSyntax " ,
132
+ dependencies: [ ] ,
133
+ exclude: [ " CMakeLists.txt " ] ,
134
+ swiftSettings: swiftSyntaxSwiftSettings
135
+ ) ,
136
+
168
137
. testTarget(
169
138
name: " SwiftSyntaxTest " ,
170
- dependencies: [ " SwiftSyntax " , " _SwiftSyntaxTestSupport " ]
139
+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftSyntax " ]
140
+ ) ,
141
+
142
+ // MARK: SwiftSyntaxBuilder
143
+
144
+ . target(
145
+ name: " SwiftSyntaxBuilder " ,
146
+ dependencies: [ " SwiftBasicFormat " , " SwiftParser " , " SwiftParserDiagnostics " , " SwiftSyntax " ] ,
147
+ exclude: [ " CMakeLists.txt " ]
171
148
) ,
149
+
172
150
. testTarget(
173
151
name: " SwiftSyntaxBuilderTest " ,
174
152
dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftSyntaxBuilder " ]
175
153
) ,
176
- . testTarget(
177
- name: " SwiftSyntaxParserTest " ,
178
- dependencies: [ " SwiftSyntaxParser " , " _SwiftSyntaxTestSupport " ] ,
179
- exclude: [ " Inputs " ]
154
+
155
+ // MARK: SwiftSyntaxMacros
156
+
157
+ . target(
158
+ name: " SwiftSyntaxMacros " ,
159
+ dependencies: [ " SwiftDiagnostics " , " SwiftParser " , " SwiftSyntax " , " SwiftSyntaxBuilder " ] ,
160
+ exclude: [ " CMakeLists.txt " ]
180
161
) ,
162
+
181
163
. testTarget(
182
164
name: " SwiftSyntaxMacrosTest " ,
183
- dependencies: [
184
- " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " ,
185
- " _SwiftSyntaxTestSupport " , " SwiftSyntaxBuilder " ,
186
- " SwiftSyntaxMacros " ,
187
- ]
165
+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " , " SwiftSyntaxBuilder " , " SwiftSyntaxMacros " ]
188
166
) ,
189
- . testTarget(
190
- name: " PerformanceTest " ,
191
- dependencies: [ " IDEUtils " , " SwiftSyntax " , " SwiftSyntaxParser " , " SwiftParser " ] ,
192
- exclude: [ " Inputs " ]
167
+
168
+ // MARK: SwiftParser
169
+
170
+ . target(
171
+ name: " SwiftParser " ,
172
+ dependencies: [ " SwiftSyntax " ] ,
173
+ exclude: [ " CMakeLists.txt " , " README.md " ]
193
174
) ,
175
+
194
176
. testTarget(
195
177
name: " SwiftParserTest " ,
196
- dependencies: [
197
- " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " ,
198
- " _SwiftSyntaxTestSupport " , " SwiftSyntaxBuilder " ,
199
- ]
178
+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " , " SwiftSyntaxBuilder " ]
179
+ ) ,
180
+
181
+ // MARK: SwiftParserDiagnostics
182
+
183
+ . target(
184
+ name: " SwiftParserDiagnostics " ,
185
+ dependencies: [ " SwiftBasicFormat " , " SwiftDiagnostics " , " SwiftParser " , " SwiftSyntax " ] ,
186
+ exclude: [ " CMakeLists.txt " ]
200
187
) ,
188
+
201
189
. testTarget(
202
190
name: " SwiftParserDiagnosticsTest " ,
203
191
dependencies: [ " SwiftDiagnostics " , " SwiftParserDiagnostics " ]
204
192
) ,
193
+
194
+ // MARK: SwiftOperators
195
+
196
+ . target(
197
+ name: " SwiftOperators " ,
198
+ dependencies: [ " SwiftDiagnostics " , " SwiftParser " , " SwiftSyntax " ] ,
199
+ exclude: [
200
+ " CMakeLists.txt "
201
+ ]
202
+ ) ,
203
+
205
204
. testTarget(
206
205
name: " SwiftOperatorsTest " ,
207
- dependencies: [
208
- " SwiftOperators " , " _SwiftSyntaxTestSupport " ,
209
- " SwiftParser " ,
210
- ]
206
+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftOperators " , " SwiftParser " ]
211
207
) ,
208
+
209
+ // MARK: SwiftRefactor
210
+
211
+ . target(
212
+ name: " SwiftRefactor " ,
213
+ dependencies: [ " SwiftParser " , " SwiftSyntax " ]
214
+ ) ,
215
+
212
216
. testTarget(
213
217
name: " SwiftRefactorTest " ,
218
+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftRefactor " , " SwiftSyntaxBuilder " ]
219
+ ) ,
220
+
221
+ // MARK: - Executable targets
222
+
223
+ . executableTarget(
224
+ name: " swift-parser-cli " ,
214
225
dependencies: [
215
- " SwiftRefactor " , " SwiftSyntaxBuilder " , " _SwiftSyntaxTestSupport " ,
226
+ " _InstructionCounter " , " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " , " SwiftParserDiagnostics " , " SwiftSyntax " ,
227
+ . product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
216
228
]
217
229
) ,
230
+
231
+ // MARK: - Deprecated targets
232
+
233
+ // MARK: lit-test-helper
234
+ // TODO: All the lit-based tests should be migrated to XCTest so we don't have a
235
+ // dependency on FileCheck
236
+
237
+ . executableTarget(
238
+ name: " lit-test-helper " ,
239
+ dependencies: [ " IDEUtils " , " SwiftSyntax " , " SwiftSyntaxParser " ]
240
+ ) ,
241
+
242
+ // MARK: PerformanceTest
243
+ // TODO: Should be included in SwiftParserTest/SwiftSyntaxTest
244
+
218
245
. testTarget(
219
- name: " SwiftCompilerPluginTest " ,
220
- dependencies: [
221
- " SwiftCompilerPlugin "
222
- ]
246
+ name: " PerformanceTest " ,
247
+ dependencies: [ " IDEUtils " , " SwiftParser " , " SwiftSyntax " , " SwiftSyntaxParser " ] ,
248
+ exclude: [ " Inputs " ]
249
+ ) ,
250
+
251
+ // MARK: SwiftSyntaxParser
252
+ // TODO: All clients should use SwiftParser instead
253
+
254
+ . target(
255
+ name: " SwiftSyntaxParser " ,
256
+ dependencies: [ " SwiftSyntax " , " SwiftParser " ]
257
+ ) ,
258
+
259
+ . testTarget(
260
+ name: " SwiftSyntaxParserTest " ,
261
+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftSyntaxParser " ] ,
262
+ exclude: [ " Inputs " ]
223
263
) ,
224
264
]
225
265
)
0 commit comments