@@ -3536,7 +3536,9 @@ final class BuildPlanTests: XCTestCase {
3536
3536
toolset: . init(
3537
3537
knownTools: [
3538
3538
. cCompiler: . init( extraCLIOptions: [ " -I/fake/sdk/sysroot " , " -clang-flag-from-json " ] ) ,
3539
- . swiftCompiler: . init( extraCLIOptions: [ " -swift-flag-from-json " ] )
3539
+ . swiftCompiler: . init( extraCLIOptions: [ " -swift-flag-from-json " ] ) ,
3540
+ . librarian: . init( path: " /fake/toolchain/usr/bin/lib " ) ,
3541
+ . linker: . init( path: " /fake/toolchain/usr/bin/lnk " ) ,
3540
3542
] ,
3541
3543
rootPaths: try UserToolchain . default. destination. toolset. rootPaths
3542
3544
) ,
@@ -3567,7 +3569,18 @@ final class BuildPlanTests: XCTestCase {
3567
3569
XCTAssertMatch ( try lib. basicArguments ( isCXX: false ) , args)
3568
3570
3569
3571
let exe = try result. target ( for: " exe " ) . swiftTarget ( ) . compileArguments ( )
3570
- 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 " ] )
3572
+ XCTAssertMatch ( exe, [
3573
+ " -module-cache-path " ,
3574
+ " \( buildPath. appending ( components: " ModuleCache " ) ) " ,
3575
+ . anySequence,
3576
+ " -swift-flag-from-json " ,
3577
+ . anySequence,
3578
+ " -swift-command-line-flag " ,
3579
+ . anySequence,
3580
+ " -Xcc " , " -clang-flag-from-json " ,
3581
+ . anySequence,
3582
+ " -Xcc " , " -clang-command-line-flag "
3583
+ ] )
3571
3584
}
3572
3585
3573
3586
func testUserToolchainWithToolsetCompileFlags( ) throws {
@@ -3757,7 +3770,10 @@ final class BuildPlanTests: XCTestCase {
3757
3770
properties: . init(
3758
3771
sdkRootPath: " /fake/sdk " ,
3759
3772
includeSearchPaths: [ sdkIncludeSearchPath] ,
3760
- librarySearchPaths: [ sdkLibrarySearchPath] ) )
3773
+ librarySearchPaths: [ sdkLibrarySearchPath] ) ,
3774
+ toolset: . init( knownTools: [
3775
+ . swiftCompiler: . init( extraCLIOptions: [ " -use-ld=lld " ] ) ,
3776
+ ] ) )
3761
3777
let toolchain = try UserToolchain ( destination: destination)
3762
3778
let buildParameters = mockBuildParameters ( toolchain: toolchain)
3763
3779
let result = try BuildPlanResult ( plan: BuildPlan (
@@ -3770,17 +3786,17 @@ final class BuildPlanTests: XCTestCase {
3770
3786
3771
3787
// Compile C Target
3772
3788
let cLibCompileArguments = try result. target ( for: " cLib " ) . clangTarget ( ) . basicArguments ( isCXX: false )
3773
- let cLibCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( sdkIncludeSearchPath) " ]
3789
+ let cLibCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( AbsolutePath ( sdkIncludeSearchPath) . _nativePathString ( escaped : false ) ) " ]
3774
3790
XCTAssertMatch ( cLibCompileArguments, cLibCompileArgumentsPattern)
3775
3791
3776
3792
// Compile Swift Target
3777
3793
let exeCompileArguments = try result. target ( for: " exe " ) . swiftTarget ( ) . compileArguments ( )
3778
- let exeCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( sdkIncludeSearchPath) " ]
3794
+ let exeCompileArgumentsPattern : [ StringPattern ] = [ " -I " , " \( AbsolutePath ( sdkIncludeSearchPath) . _nativePathString ( escaped : false ) ) " ]
3779
3795
XCTAssertMatch ( exeCompileArguments, exeCompileArgumentsPattern)
3780
3796
3781
3797
// Link Product
3782
3798
let exeLinkArguments = try result. buildProduct ( for: " exe " ) . linkArguments ( )
3783
- let exeLinkArgumentsPattern : [ StringPattern ] = [ " -L " , " \( sdkIncludeSearchPath) " ]
3799
+ let exeLinkArgumentsPattern : [ StringPattern ] = [ " -L " , " \( AbsolutePath ( sdkIncludeSearchPath) . _nativePathString ( escaped : false ) ) " ]
3784
3800
XCTAssertMatch ( exeLinkArguments, exeLinkArgumentsPattern)
3785
3801
}
3786
3802
@@ -4750,7 +4766,7 @@ final class BuildPlanTests: XCTestCase {
4750
4766
4751
4767
let yamlContents : String = try fs. readFileContents ( yaml)
4752
4768
XCTAssertMatch ( yamlContents, . contains( """
4753
- inputs: [ " /Pkg/Snippets/ASnippet.swift " , " /Pkg/.build/debug/Lib.swiftmodule "
4769
+ inputs: [ " \( AbsolutePath ( " /Pkg/Snippets/ASnippet.swift " ) . _nativePathString ( escaped : true ) ) " , " \( AbsolutePath ( " /Pkg/.build/debug/Lib.swiftmodule " ) . _nativePathString ( escaped : true ) ) "
4754
4770
""" ) )
4755
4771
4756
4772
}
0 commit comments