@@ -39,187 +39,227 @@ let package = Package(
3939 ] ,
4040 products: [
4141 . library( name: " IDEUtils " , type: . static, targets: [ " IDEUtils " ] ) ,
42+ . library( name: " SwiftCompilerPlugin " , type: . static, targets: [ " SwiftCompilerPlugin " ] ) ,
43+ . library( name: " SwiftCompilerPluginMessageHandling " , type: . static, targets: [ " SwiftCompilerPluginMessageHandling " ] ) ,
4244 . library( name: " SwiftDiagnostics " , type: . static, targets: [ " SwiftDiagnostics " ] ) ,
4345 . library( name: " SwiftOperators " , type: . static, targets: [ " SwiftOperators " ] ) ,
4446 . library( name: " SwiftParser " , type: . static, targets: [ " SwiftParser " ] ) ,
4547 . library( name: " SwiftParserDiagnostics " , type: . static, targets: [ " SwiftParserDiagnostics " ] ) ,
48+ . library( name: " SwiftRefactor " , type: . static, targets: [ " SwiftRefactor " ] ) ,
4649 . library( name: " SwiftSyntax " , type: . static, targets: [ " SwiftSyntax " ] ) ,
47- . library( name: " SwiftSyntaxParser " , type: . static, targets: [ " SwiftSyntaxParser " ] ) ,
4850 . library( name: " SwiftSyntaxBuilder " , type: . static, targets: [ " SwiftSyntaxBuilder " ] ) ,
4951 . 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 " ] ) ,
5353 ] ,
5454 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+
8557 . target(
86- name: " SwiftSyntaxParser " ,
87- dependencies: [ " SwiftSyntax " , " SwiftParser " ]
58+ name: " _InstructionCounter "
8859 ) ,
60+
8961 . target(
9062 name: " _SwiftSyntaxTestSupport " ,
9163 dependencies: [ " SwiftBasicFormat " , " SwiftSyntax " , " SwiftSyntaxBuilder " ]
9264 ) ,
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+
9376 . target(
9477 name: " IDEUtils " ,
9578 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 " ]
10780 ) ,
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 " ]
12185 ) ,
86+
87+ // MARK: SwiftBasicFormat
88+
12289 . 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 " ]
13093 ) ,
94+
95+ // MARK: SwiftCompilerPlugin
96+
13197 . target(
13298 name: " SwiftCompilerPlugin " ,
133- dependencies: [
134- " SwiftCompilerPluginMessageHandling " , " SwiftSyntaxMacros " ,
135- ]
99+ dependencies: [ " SwiftCompilerPluginMessageHandling " , " SwiftSyntaxMacros " ]
100+ ) ,
101+
102+ . testTarget(
103+ name: " SwiftCompilerPluginTest " ,
104+ dependencies: [ " SwiftCompilerPlugin " ]
136105 ) ,
106+
107+ // MARK: SwiftCompilerPluginMessageHandling
108+
137109 . target(
138110 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 " ]
145113 ) ,
114+
115+ // MARK: SwiftDiagnostics
116+
146117 . 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 " ]
162121 ) ,
163- . testTarget ( name : " IDEUtilsTest " , dependencies : [ " _SwiftSyntaxTestSupport " , " SwiftParser " , " SwiftSyntax " , " IDEUtils " ] ) ,
122+
164123 . testTarget(
165124 name: " SwiftDiagnosticsTest " ,
166125 dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftDiagnostics " , " SwiftParser " , " SwiftParserDiagnostics " ]
167126 ) ,
127+
128+ // MARK: SwiftSyntax
129+
130+ . target(
131+ name: " SwiftSyntax " ,
132+ dependencies: [ ] ,
133+ exclude: [ " CMakeLists.txt " ] ,
134+ swiftSettings: swiftSyntaxSwiftSettings
135+ ) ,
136+
168137 . testTarget(
169138 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 " ]
171148 ) ,
149+
172150 . testTarget(
173151 name: " SwiftSyntaxBuilderTest " ,
174152 dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftSyntaxBuilder " ]
175153 ) ,
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 " ]
180161 ) ,
162+
181163 . testTarget(
182164 name: " SwiftSyntaxMacrosTest " ,
183- dependencies: [
184- " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " ,
185- " _SwiftSyntaxTestSupport " , " SwiftSyntaxBuilder " ,
186- " SwiftSyntaxMacros " ,
187- ]
165+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " , " SwiftSyntaxBuilder " , " SwiftSyntaxMacros " ]
188166 ) ,
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 " ]
193174 ) ,
175+
194176 . testTarget(
195177 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 " ]
200187 ) ,
188+
201189 . testTarget(
202190 name: " SwiftParserDiagnosticsTest " ,
203191 dependencies: [ " SwiftDiagnostics " , " SwiftParserDiagnostics " ]
204192 ) ,
193+
194+ // MARK: SwiftOperators
195+
196+ . target(
197+ name: " SwiftOperators " ,
198+ dependencies: [ " SwiftDiagnostics " , " SwiftParser " , " SwiftSyntax " ] ,
199+ exclude: [
200+ " CMakeLists.txt "
201+ ]
202+ ) ,
203+
205204 . testTarget(
206205 name: " SwiftOperatorsTest " ,
207- dependencies: [
208- " SwiftOperators " , " _SwiftSyntaxTestSupport " ,
209- " SwiftParser " ,
210- ]
206+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftOperators " , " SwiftParser " ]
211207 ) ,
208+
209+ // MARK: SwiftRefactor
210+
211+ . target(
212+ name: " SwiftRefactor " ,
213+ dependencies: [ " SwiftParser " , " SwiftSyntax " ]
214+ ) ,
215+
212216 . testTarget(
213217 name: " SwiftRefactorTest " ,
218+ dependencies: [ " _SwiftSyntaxTestSupport " , " SwiftRefactor " , " SwiftSyntaxBuilder " ]
219+ ) ,
220+
221+ // MARK: - Executable targets
222+
223+ . executableTarget(
224+ name: " swift-parser-cli " ,
214225 dependencies: [
215- " SwiftRefactor " , " SwiftSyntaxBuilder " , " _SwiftSyntaxTestSupport " ,
226+ " _InstructionCounter " , " SwiftDiagnostics " , " SwiftOperators " , " SwiftParser " , " SwiftParserDiagnostics " , " SwiftSyntax " ,
227+ . product( name: " ArgumentParser " , package : " swift-argument-parser " ) ,
216228 ]
217229 ) ,
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+
218245 . 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 " ]
223263 ) ,
224264 ]
225265)
0 commit comments