You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[6.0] Update diagnostics for duplicated product/target names (#7575)
- Explanation:
Improves diagnostic messages for duplicate product/target to include
involved packages and other useful information.
- Scope: Package manifests/graphs with duplicate product/target names.
- Main Branch PRs:
#7572
- Resolves: rdar://127623219
- Risk: Very Low
- Reviewed By: @xedin
- Testing: New tests were added to the suite and existing tests updated.
(cherry picked from commit e5123e4)
return"multiple products named '\(product)' in: \(packagesDescriptions.joined(separator:", "))"
285
+
return"multiple packages (\(packagesDescriptions.joined(separator:", "))) declare products with a conflicting name: '\(product)’; product names need to be unique across the package graph"
return"multiple targets named '\(target)' in: '\(packages)'"
101
+
return"multiple packages ('\(packages)') declare targets with a conflicting name: '\(target)’; target names need to be unique across the package graph"
"multiple packages (\'barpkg\' (at '\(barPkg)'), \'foopkg\' (at '\(fooPkg)')) declare products with a conflicting name: \'Logging’; product names need to be unique across the package graph"
132
132
)
133
133
}
134
134
}
@@ -550,7 +550,7 @@ final class BuildPlanTests: XCTestCase {
"multiple packages (\'barpkg\' (at '\(barPkg)'), \'foopkg\' (at '\(fooPkg)')) declare products with a conflicting name: \'Logging’; product names need to be unique across the package graph"
XCTAssertEqual((error as?PackageGraphError)?.description,"multiple packages (\'barpkg\' (at '\(barPkg)'), \'foopkg\' (at '\(fooPkg)')) declare products with a conflicting name: \'Logging’; product names need to be unique across the package graph")
266
266
}
267
267
}
268
268
@@ -324,7 +324,7 @@ final class ModuleAliasingBuildTests: XCTestCase {
XCTAssertEqual((error as?PackageGraphError)?.description,"multiple packages (\'barpkg\' (at '\(barPkg)'), \'foopkg\' (at '\(fooPkg)')) declare products with a conflicting name: \'Logging’; product names need to be unique across the package graph")
328
328
}
329
329
}
330
330
@@ -4692,7 +4692,7 @@ final class ModuleAliasingBuildTests: XCTestCase {
4692
4692
4693
4693
XCTFail("unexpectedly resolved the package graph successfully")
XCTAssertEqual(error.interpolationDescription,"multiple packages ('other' (at '\(AbsolutePath("/Other"))'), 'some' (at '\(AbsolutePath("/Some"))')) declare products with a conflicting name: 'SomeProduct’; product names need to be unique across the package graph")
4696
4696
}
4697
4697
XCTAssertEqual(observability.diagnostics.map{ $0.description }.sorted(),["[warning]: product aliasing requires tools-version 5.2 or later, so it is not supported by \'other\'","[warning]: product aliasing requires tools-version 5.2 or later, so it is not supported by \'some\'"])
Copy file name to clipboardExpand all lines: Tests/PackageGraphTests/ModulesGraphTests.swift
+7-8Lines changed: 7 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -336,7 +336,7 @@ final class ModulesGraphTests: XCTestCase {
336
336
)
337
337
338
338
testDiagnostics(observability.diagnostics){ result in
339
-
result.check(diagnostic:"multiple targets named 'Bar' in: 'bar', 'foo'", severity:.error)
339
+
result.check(diagnostic:"multiple packages ('bar', 'foo') declare targets with a conflicting name: 'Bar’; target names need to be unique across the package graph", severity:.error)
340
340
}
341
341
}
342
342
@@ -395,7 +395,7 @@ final class ModulesGraphTests: XCTestCase {
395
395
)
396
396
397
397
testDiagnostics(observability.diagnostics){ result in
398
-
result.check(diagnostic:"multiple targets named 'First' in: 'first', 'fourth', 'second', 'third'", severity:.error)
398
+
result.check(diagnostic:"multiple packages ('first', 'fourth', 'second', 'third') declare targets with a conflicting name: 'First’; target names need to be unique across the package graph", severity:.error)
399
399
}
400
400
}
401
401
@@ -465,8 +465,8 @@ final class ModulesGraphTests: XCTestCase {
465
465
)
466
466
467
467
testDiagnostics(observability.diagnostics){ result in
468
-
result.checkUnordered(diagnostic:"multiple targets named 'Bar' in: 'fourth', 'third'", severity:.error)
469
-
result.checkUnordered(diagnostic:"multiple targets named 'Foo' in: 'first', 'second'", severity:.error)
468
+
result.checkUnordered(diagnostic:"multiple packages ('fourth', 'third') declare targets with a conflicting name: 'Bar’; target names need to be unique across the package graph", severity:.error)
469
+
result.checkUnordered(diagnostic:"multiple packages ('first', 'second') declare targets with a conflicting name: 'Foo’; target names need to be unique across the package graph", severity:.error)
470
470
}
471
471
}
472
472
@@ -534,7 +534,7 @@ final class ModulesGraphTests: XCTestCase {
534
534
)
535
535
536
536
testDiagnostics(observability.diagnostics){ result in
537
-
result.check(diagnostic:"multiple targets named 'First' in: 'first', 'fourth'", severity:.error)
537
+
result.check(diagnostic:"multiple packages ('first', 'fourth') declare targets with a conflicting name: 'First’; target names need to be unique across the package graph", severity:.error)
538
538
}
539
539
}
540
540
@@ -1254,7 +1254,7 @@ final class ModulesGraphTests: XCTestCase {
1254
1254
)
1255
1255
1256
1256
testDiagnostics(observability.diagnostics){ result in
1257
-
result.check(diagnostic:"multiple targets named 'Foo' in: 'dep2', 'start'", severity:.error)
1257
+
result.check(diagnostic:"multiple packages ('dep2', 'start') declare targets with a conflicting name: 'Foo’; target names need to be unique across the package graph", severity:.error)
1258
1258
}
1259
1259
}
1260
1260
@@ -1303,8 +1303,7 @@ final class ModulesGraphTests: XCTestCase {
XCTAssertEqual((error as?PackageGraphError)?.description,"multiple packages (\'bar\' (at '\(barPkg)'), \'baz\' (at '\(bazPkg)')) declare products with a conflicting name: \'Bar’; product names need to be unique across the package graph")
0 commit comments