@@ -43,12 +43,14 @@ final class BuildPlanTests: XCTestCase {
43
43
" /barPkg/Sources/BarLogging/file.swift "
44
44
)
45
45
let observability = ObservabilitySystem . makeForTesting ( )
46
+ let fooPkg : AbsolutePath = " /fooPkg "
47
+ let barPkg : AbsolutePath = " /barPkg "
46
48
XCTAssertThrowsError ( try loadPackageGraph (
47
49
fileSystem: fs,
48
50
manifests: [
49
51
Manifest . createFileSystemManifest (
50
52
displayName: " fooPkg " ,
51
- path: " / fooPkg" ,
53
+ path: fooPkg,
52
54
products: [
53
55
ProductDescription ( name: " Logging " , type: . library( . dynamic) , targets: [ " FooLogging " ] ) ,
54
56
] ,
@@ -57,7 +59,7 @@ final class BuildPlanTests: XCTestCase {
57
59
] ) ,
58
60
Manifest . createFileSystemManifest (
59
61
displayName: " barPkg " ,
60
- path: " / barPkg" ,
62
+ path: barPkg,
61
63
products: [
62
64
ProductDescription ( name: " Logging " , type: . library( . static) , targets: [ " BarLogging " ] ) ,
63
65
] ,
@@ -69,24 +71,21 @@ final class BuildPlanTests: XCTestCase {
69
71
path: " /thisPkg " ,
70
72
toolsVersion: . v5_8,
71
73
dependencies: [
72
- . localSourceControl( path: " / fooPkg" , requirement: . upToNextMajor( from: " 1.0.0 " ) ) ,
73
- . localSourceControl( path: " / barPkg" , requirement: . upToNextMajor( from: " 2.0.0 " ) ) ,
74
+ . localSourceControl( path: fooPkg, requirement: . upToNextMajor( from: " 1.0.0 " ) ) ,
75
+ . localSourceControl( path: barPkg, requirement: . upToNextMajor( from: " 2.0.0 " ) ) ,
74
76
] ,
75
77
targets: [
76
78
TargetDescription ( name: " exe " ,
77
- dependencies: [ . product( name: " Logging " ,
78
- package : " fooPkg "
79
- ) ,
80
- . product( name: " Logging " ,
81
- package : " barPkg "
82
- ) ,
79
+ dependencies: [ . product( name: " Logging " , package : " fooPkg " ) ,
80
+ . product( name: " Logging " , package : " barPkg " ) ,
83
81
] ,
84
82
type: . executable) ,
85
83
] ) ,
86
84
] ,
87
85
observabilityScope: observability. topScope
88
86
) ) { error in
89
- XCTAssertEqual ( ( error as? PackageGraphError ) ? . description, " multiple products named 'Logging' in: 'barpkg' (at '/barPkg'), 'foopkg' (at '/fooPkg') " )
87
+ XCTAssertEqual ( ( error as? PackageGraphError ) ? . description,
88
+ " multiple products named 'Logging' in: 'barpkg' (at ' \( barPkg) '), 'foopkg' (at ' \( fooPkg) ') " )
90
89
}
91
90
}
92
91
@@ -418,13 +417,15 @@ final class BuildPlanTests: XCTestCase {
418
417
" /barPkg/Sources/BarLogging/file.swift "
419
418
)
420
419
let observability = ObservabilitySystem . makeForTesting ( )
420
+ let fooPkg : AbsolutePath = " /fooPkg "
421
+ let barPkg : AbsolutePath = " /barPkg "
421
422
422
423
XCTAssertThrowsError ( try loadPackageGraph (
423
424
fileSystem: fs,
424
425
manifests: [
425
426
Manifest . createFileSystemManifest (
426
427
displayName: " fooPkg " ,
427
- path: " / fooPkg" ,
428
+ path: fooPkg,
428
429
toolsVersion: . v5_8,
429
430
products: [
430
431
ProductDescription ( name: " Logging " , type: . library( . automatic) , targets: [ " FooLogging " ] ) ,
@@ -434,7 +435,7 @@ final class BuildPlanTests: XCTestCase {
434
435
] ) ,
435
436
Manifest . createFileSystemManifest (
436
437
displayName: " barPkg " ,
437
- path: " / barPkg" ,
438
+ path: barPkg,
438
439
products: [
439
440
ProductDescription ( name: " Logging " , type: . library( . automatic) , targets: [ " BarLogging " ] ) ,
440
441
] ,
@@ -450,19 +451,16 @@ final class BuildPlanTests: XCTestCase {
450
451
] ,
451
452
targets: [
452
453
TargetDescription ( name: " exe " ,
453
- dependencies: [ . product( name: " Logging " ,
454
- package : " fooPkg "
455
- ) ,
456
- . product( name: " Logging " ,
457
- package : " barPkg "
458
- ) ,
454
+ dependencies: [ . product( name: " Logging " , package : " fooPkg " ) ,
455
+ . product( name: " Logging " , package : " barPkg " ) ,
459
456
] ,
460
457
type: . executable) ,
461
458
] ) ,
462
459
] ,
463
460
observabilityScope: observability. topScope
464
461
) ) { error in
465
- XCTAssertEqual ( ( error as? PackageGraphError ) ? . description, " multiple products named 'Logging' in: 'barpkg' (at '/barPkg'), 'foopkg' (at '/fooPkg') " )
462
+ XCTAssertEqual ( ( error as? PackageGraphError ) ? . description,
463
+ " multiple products named 'Logging' in: 'barpkg' (at ' \( barPkg) '), 'foopkg' (at ' \( fooPkg) ') " )
466
464
}
467
465
}
468
466
@@ -3526,7 +3524,7 @@ final class BuildPlanTests: XCTestCase {
3526
3524
toolset: . init(
3527
3525
knownTools: [
3528
3526
. cCompiler: . init( extraCLIOptions: [ " -I/fake/sdk/sysroot " , " -clang-flag-from-json " ] ) ,
3529
- . swiftCompiler: . init( extraCLIOptions: [ " -swift-flag-from-json " ] )
3527
+ . swiftCompiler: . init( extraCLIOptions: [ " -use-ld=lld " , " - swift-flag-from-json" ] )
3530
3528
] ,
3531
3529
rootPaths: try UserToolchain . default. swiftSDK. toolset. rootPaths
3532
3530
) ,
@@ -3557,7 +3555,17 @@ final class BuildPlanTests: XCTestCase {
3557
3555
XCTAssertMatch ( try lib. basicArguments ( isCXX: false ) , args)
3558
3556
3559
3557
let exe = try result. target ( for: " exe " ) . swiftTarget ( ) . compileArguments ( )
3560
- XCTAssertMatch ( exe, [ " -module-cache-path " , " \( buildPath. appending ( components: " ModuleCache " ) ) " , . anySequence, " -swift-flag-from-json " , " -g " , " -swift-command-line-flag " , . anySequence, " -Xcc " , " -clang-flag-from-json " , " -Xcc " , " -g " , " -Xcc " , " -clang-command-line-flag " ] )
3558
+ XCTAssertMatch ( exe, [
3559
+ " -module-cache-path " , " \( buildPath. appending ( components: " ModuleCache " ) ) " ,
3560
+ . anySequence,
3561
+ " -swift-flag-from-json " ,
3562
+ . anySequence,
3563
+ " -swift-command-line-flag " ,
3564
+ . anySequence,
3565
+ " -Xcc " , " -clang-flag-from-json " ,
3566
+ . anySequence,
3567
+ " -Xcc " , " -clang-command-line-flag "
3568
+ ] )
3561
3569
}
3562
3570
3563
3571
func testUserToolchainWithToolsetCompileFlags( ) throws {
@@ -3740,14 +3748,17 @@ final class BuildPlanTests: XCTestCase {
3740
3748
XCTAssertNoDiagnostics ( observability. diagnostics)
3741
3749
3742
3750
let targetTriple = try UserToolchain . default. targetTriple
3743
- let sdkIncludeSearchPath = " /usr/lib/swift_static/none/include "
3744
- let sdkLibrarySearchPath = " /usr/lib/swift_static/none/lib "
3751
+ let sdkIncludeSearchPath = AbsolutePath ( " /usr/lib/swift_static/none/include " )
3752
+ let sdkLibrarySearchPath = AbsolutePath ( " /usr/lib/swift_static/none/lib " )
3745
3753
let swiftSDK = try SwiftSDK (
3746
3754
targetTriple: targetTriple,
3747
3755
properties: . init(
3748
3756
sdkRootPath: " /fake/sdk " ,
3749
- includeSearchPaths: [ sdkIncludeSearchPath] ,
3750
- librarySearchPaths: [ sdkLibrarySearchPath] ) )
3757
+ includeSearchPaths: [ sdkIncludeSearchPath. pathString] ,
3758
+ librarySearchPaths: [ sdkLibrarySearchPath. pathString] ) ,
3759
+ toolset: . init( knownTools: [
3760
+ . swiftCompiler: . init( extraCLIOptions: [ " -use-ld=lld " ] ) ,
3761
+ ] ) )
3751
3762
let toolchain = try UserToolchain ( swiftSDK: swiftSDK)
3752
3763
let buildParameters = mockBuildParameters ( toolchain: toolchain)
3753
3764
let result = try BuildPlanResult ( plan: BuildPlan (
@@ -4740,9 +4751,8 @@ final class BuildPlanTests: XCTestCase {
4740
4751
4741
4752
let yamlContents : String = try fs. readFileContents ( yaml)
4742
4753
XCTAssertMatch ( yamlContents, . contains( """
4743
- inputs: [ " /Pkg/Snippets/ASnippet.swift " , " /Pkg/.build/debug/Lib.swiftmodule "
4754
+ inputs: [ " \( AbsolutePath ( " /Pkg/Snippets/ASnippet.swift " ) . _nativePathString ( escaped : true ) ) " , " \( AbsolutePath ( " /Pkg/.build/debug/Lib.swiftmodule " ) . _nativePathString ( escaped : true ) ) "
4744
4755
""" ) )
4745
-
4746
4756
}
4747
4757
4748
4758
private func sanitizerTest( _ sanitizer: PackageModel . Sanitizer , expectedName: String ) throws {
0 commit comments