@@ -59,7 +59,7 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
5959 await tester. checkBuild ( runDestination: . host) { results in
6060 results. checkNoDiagnostics ( )
6161
62- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
62+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
6363 task. checkCommandLine ( [ " tool " , " -foo " , " -bar " ] )
6464 task. checkEnvironment ( [ " ENVVAR " : " VALUE " ] )
6565 #expect( task. workingDirectory == Path . root. join ( " working/directory " ) )
@@ -119,14 +119,14 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
119119 await tester. checkBuild ( runDestination: . host) { results in
120120 results. checkNoDiagnostics ( )
121121
122- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
122+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
123123 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 ] ) )
125125 }
126126
127- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task 2 " ] ) ) { task in
127+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task 2 " , . any ] ) ) { task in
128128 task. checkCommandLine ( [ " tool2 " , " -bar " , " -foo " ] )
129- results. checkTaskDoesNotFollow ( task, . matchRule ( [ " CustomTask " , " My Custom Task " ] ) )
129+ results. checkTaskDoesNotFollow ( task, . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) )
130130 }
131131 }
132132 }
@@ -170,7 +170,7 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
170170 await tester. checkBuild ( runDestination: . host) { results in
171171 results. checkNoDiagnostics ( )
172172
173- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
173+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
174174 task. checkCommandLine ( [ " tool " , " -foo " , " -bar " ] )
175175 task. checkOutputs ( [
176176 // Virtual output
@@ -223,9 +223,64 @@ fileprivate struct CustomTaskConstructionTests: CoreBasedTests {
223223 await tester. checkBuild ( runDestination: . host) { results in
224224 results. checkNoDiagnostics ( )
225225
226- results. checkTask ( . matchRule ( [ " CustomTask " , " My Custom Task " ] ) ) { task in
226+ results. checkTask ( . matchRulePattern ( [ " CustomTask " , " My Custom Task " , . any ] ) ) { task in
227227 task. checkEnvironment ( [ " ENVVAR " : " VALUE " , " MY_SETTING " : " FOO " ] )
228228 }
229229 }
230230 }
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+ }
231286}
0 commit comments