@@ -59,7 +59,7 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
59
59
await tester. checkBuild ( runDestination: . host) { results in
60
60
results. checkNoDiagnostics ( )
61
61
62
- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
62
+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
63
63
task. checkCommandLine ( [ " tool " , " -foo " , " -bar " ] )
64
64
task. checkEnvironment ( [ " ENVVAR " : " VALUE " ] )
65
65
#expect( task. workingDirectory == Path . root. join ( " working/directory " ) )
@@ -119,14 +119,14 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
119
119
await tester. checkBuild ( runDestination: . host) { results in
120
120
results. checkNoDiagnostics ( )
121
121
122
- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
122
+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
123
123
task. checkCommandLine ( [ " tool " , " -foo " , " -bar " ] )
124
- results. checkTaskDoesNotFollow ( task, . matchRule ( [ " CustomTask " , " My Custom Task 2 " ] ) )
124
+ results. checkTaskDoesNotFollow ( task, . matchRulePattern ( [ " CustomTask " , " My Custom Task 2 " , . any ] ) )
125
125
}
126
126
127
- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task 2 " ] ) ) { task in
127
+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task 2 " , . any ] ) ) { task in
128
128
task. checkCommandLine ( [ " tool2 " , " -bar " , " -foo " ] )
129
- results. checkTaskDoesNotFollow ( task, . matchRule ( [ " CustomTask " , " My Custom Task " ] ) )
129
+ results. checkTaskDoesNotFollow ( task, . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) )
130
130
}
131
131
}
132
132
}
@@ -170,7 +170,7 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
170
170
await tester. checkBuild ( runDestination: . host) { results in
171
171
results. checkNoDiagnostics ( )
172
172
173
- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
173
+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
174
174
task. checkCommandLine ( [ " tool " , " -foo " , " -bar " ] )
175
175
task. checkOutputs ( [
176
176
// Virtual output
@@ -223,9 +223,64 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
223
223
await tester. checkBuild ( runDestination: . host) { results in
224
224
results. checkNoDiagnostics ( )
225
225
226
- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
226
+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
227
227
task. checkEnvironment ( [ " ENVVAR " : " VALUE " , " MY_SETTING " : " FOO " ] )
228
228
}
229
229
}
230
230
}
231
+
232
+ @Test ( . requireSDKs( . host) )
233
+ func customTasksWithDuplicateDescriptions( ) async throws {
234
+ let testProject = TestProject (
235
+ " aProject " ,
236
+ groupTree: TestGroup (
237
+ " SomeFiles " , path: " Sources " ,
238
+ children: [
239
+ TestFile ( " input.txt " ) ,
240
+ TestFile ( " input2.txt " ) ,
241
+ TestFile ( " main.c " ) ,
242
+ ] ) ,
243
+ buildConfigurations: [
244
+ TestBuildConfiguration (
245
+ " Debug " ,
246
+ buildSettings: [
247
+ " GENERATE_INFOPLIST_FILE " : " YES " ,
248
+ " PRODUCT_NAME " : " $(TARGET_NAME) " ,
249
+ " SDKROOT " : " auto " ,
250
+ ] ) ,
251
+ ] ,
252
+ targets: [
253
+ TestStandardTarget (
254
+ " CoreFoo " , type: . framework,
255
+ buildPhases: [
256
+ TestSourcesBuildPhase ( [ " main.c " ] )
257
+ ] ,
258
+ customTasks: [
259
+ TestCustomTask (
260
+ commandLine: [ " tool " , " -foo " , " -bar " ] ,
261
+ environment: [ " ENVVAR " : " VALUE " ] ,
262
+ workingDirectory: Path . root. join ( " working/directory " ) . str,
263
+ executionDescription: " My Custom Task " ,
264
+ inputs: [ " $(SRCROOT)/Sources/input.txt " ] ,
265
+ outputs: [ Path . root. join ( " output " ) . str] ,
266
+ enableSandboxing: false ,
267
+ preparesForIndexing: false ) ,
268
+ TestCustomTask (
269
+ commandLine: [ " tool " , " -foo " , " -bar " ] ,
270
+ environment: [ " ENVVAR " : " VALUE " ] ,
271
+ workingDirectory: Path . root. join ( " working/directory " ) . str,
272
+ executionDescription: " My Custom Task " ,
273
+ inputs: [ " $(SRCROOT)/Sources/input2.txt " ] ,
274
+ outputs: [ Path . root. join ( " output2 " ) . str] ,
275
+ enableSandboxing: false ,
276
+ preparesForIndexing: false )
277
+ ]
278
+ ) ,
279
+ ] )
280
+ let tester = try await TaskConstructionTester ( getCore ( ) , testProject)
281
+ await tester. checkBuild ( runDestination: . host) { results in
282
+ // Ensure we don't incorrectly diagnose duplicate custom tasks
283
+ results. checkNoDiagnostics ( )
284
+ }
285
+ }
231
286
}
0 commit comments