@@ -284,12 +284,8 @@ final class SwiftDriverTests: XCTestCase {
284284 [ TypedVirtualPath ( file: VirtualPath . relative ( RelativePath ( " a.swift " ) ) . intern ( ) , type: . swift) ,
285285 TypedVirtualPath ( file: VirtualPath . absolute ( AbsolutePath ( " /tmp/b.swift " ) ) . intern ( ) , type: . swift) ] )
286286
287- let workingDirectory =
288- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /wobble " , relativeTo: $0) }
289- ?? AbsolutePath ( validating: " /Foo/Bar " )
290- let tempDirectory =
291- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /tmp " , relativeTo: $0) }
292- ?? AbsolutePath ( validating: " /Foo/Bar " )
287+ let workingDirectory = localFileSystem. currentWorkingDirectory!. appending ( components: " wobble " )
288+ let tempDirectory = localFileSystem. currentWorkingDirectory!. appending ( components: " tmp " )
293289
294290 let driver2 = try Driver ( args: [ " swiftc " , " a.swift " , " -working-directory " , workingDirectory. pathString, rebase ( " b.swift " , at: tempDirectory) ] )
295291 XCTAssertEqual ( driver2. inputFiles,
@@ -649,9 +645,7 @@ final class SwiftDriverTests: XCTestCase {
649645 XCTAssertEqual ( plannedJobs [ 2 ] . outputs. first!. file, VirtualPath . relative ( RelativePath ( executableName ( " Test " ) ) ) )
650646
651647 // Forwarding of arguments.
652- let workingDirectory =
653- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /tmp " , relativeTo: $0) }
654- ?? AbsolutePath ( validating: " /Foo/Bar " )
648+ let workingDirectory = localFileSystem. currentWorkingDirectory!. appending ( components: " tmp " )
655649
656650 var driver2 = try Driver ( args: [ " swiftc " , " -color-diagnostics " , " foo.swift " , " bar.swift " , " -working-directory " , workingDirectory. pathString, " -api-diff-data-file " , " diff.txt " , " -Xfrontend " , " -HI " , " -no-color-diagnostics " , " -g " ] )
657651 let plannedJobs2 = try driver2. planBuild ( )
@@ -1097,8 +1091,7 @@ final class SwiftDriverTests: XCTestCase {
10971091 ]
10981092 ]
10991093
1100- let root = try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /foo_root " , relativeTo: $0) }
1101- ?? AbsolutePath ( validating: " /foo_root " )
1094+ let root = localFileSystem. currentWorkingDirectory!. appending ( components: " foo_root " )
11021095
11031096 let resolvedStringyEntries : [ String : [ FileType : String ] ] = [
11041097 " " : [ . swiftDeps: root. appending ( components: " foo.build " , " master.swiftdeps " ) . pathString] ,
@@ -2749,8 +2742,7 @@ final class SwiftDriverTests: XCTestCase {
27492742 }
27502743
27512744 do {
2752- let root = try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /foo/bar " , relativeTo: $0) }
2753- ?? AbsolutePath ( validating: " /foo/bar " )
2745+ let root = localFileSystem. currentWorkingDirectory!. appending ( components: " foo " , " bar " )
27542746
27552747 var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " bar.swift " , " -module-name " , " Test " , " -emit-module-path " , rebase ( " Test.swiftmodule " , at: root) , " -no-emit-module-separately " ] )
27562748 let plannedJobs = try driver. planBuild ( )
@@ -2814,8 +2806,7 @@ final class SwiftDriverTests: XCTestCase {
28142806 envVars [ " SWIFT_DRIVER_LD_EXEC " ] = ld. nativePathString ( escaped: false )
28152807
28162808 do {
2817- let root = try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /foo/bar " , relativeTo: $0) }
2818- ?? AbsolutePath ( validating: " /foo/bar " )
2809+ let root = localFileSystem. currentWorkingDirectory!. appending ( components: " foo " , " bar " )
28192810
28202811 var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " bar.swift " , " -module-name " , " Test " , " -emit-module-path " , rebase ( " Test.swiftmodule " , at: root) , " -emit-symbol-graph " , " -emit-symbol-graph-dir " , " /foo/bar/ " , " -experimental-emit-module-separately " , " -emit-library " ] ,
28212812 env: envVars)
@@ -2837,8 +2828,7 @@ final class SwiftDriverTests: XCTestCase {
28372828 }
28382829
28392830 do {
2840- let root = try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /foo/bar " , relativeTo: $0) }
2841- ?? AbsolutePath ( validating: " /foo/bar " )
2831+ let root = localFileSystem. currentWorkingDirectory!. appending ( components: " foo " , " bar " )
28422832
28432833 // We don't expect partial jobs when asking only for the swiftmodule with
28442834 // -experimental-emit-module-separately.
@@ -2886,8 +2876,7 @@ final class SwiftDriverTests: XCTestCase {
28862876 func testEmitModuleSeparatelyWMO( ) throws {
28872877 var envVars = ProcessEnv . vars
28882878 envVars [ " SWIFT_DRIVER_LD_EXEC " ] = ld. nativePathString ( escaped: false )
2889- let root = try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /foo/bar " , relativeTo: $0) }
2890- ?? AbsolutePath ( validating: " /foo/bar " )
2879+ let root = localFileSystem. currentWorkingDirectory!. appending ( components: " foo " , " bar " )
28912880
28922881 do {
28932882 var driver = try Driver ( args: [ " swiftc " , " foo.swift " , " bar.swift " , " -module-name " , " Test " , " -emit-module-path " , rebase ( " Test.swiftmodule " , at: root) , " -emit-symbol-graph " , " -emit-symbol-graph-dir " , root. pathString, " -emit-library " , " -target " , " x86_64-apple-macosx10.15 " , " -wmo " , " -emit-module-separately-wmo " ] ,
@@ -4262,9 +4251,7 @@ final class SwiftDriverTests: XCTestCase {
42624251 }
42634252
42644253 func testLEqualPassedDownToLinkerInvocation( ) throws {
4265- let workingDirectory =
4266- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /Foo/Bar " , relativeTo: $0) }
4267- ?? AbsolutePath ( validating: " /Foo/Bar " )
4254+ let workingDirectory = localFileSystem. currentWorkingDirectory!. appending ( components: " Foo " , " Bar " )
42684255
42694256 var driver = try Driver ( args: [
42704257 " swiftc " , " -working-directory " , workingDirectory. pathString, " -emit-executable " , " test.swift " , " -L=. " , " -F=. "
@@ -4283,9 +4270,7 @@ final class SwiftDriverTests: XCTestCase {
42834270 }
42844271
42854272 func testWorkingDirectoryForImplicitOutputs( ) throws {
4286- let workingDirectory =
4287- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /Foo/Bar " , relativeTo: $0) }
4288- ?? AbsolutePath ( validating: " /Foo/Bar " )
4273+ let workingDirectory = localFileSystem. currentWorkingDirectory!. appending ( components: " Foo " , " Bar " )
42894274
42904275 var driver = try Driver ( args: [
42914276 " swiftc " , " -working-directory " , workingDirectory. pathString, " -emit-executable " , " -c " , " /tmp/main.swift "
@@ -4298,9 +4283,7 @@ final class SwiftDriverTests: XCTestCase {
42984283 }
42994284
43004285 func testWorkingDirectoryForImplicitModules( ) throws {
4301- let workingDirectory =
4302- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /Foo/Bar " , relativeTo: $0) }
4303- ?? AbsolutePath ( validating: " /Foo/Bar " )
4286+ let workingDirectory = localFileSystem. currentWorkingDirectory!. appending ( components: " Foo " , " Bar " )
43044287
43054288 var driver = try Driver ( args: [
43064289 " swiftc " , " -working-directory " , workingDirectory. pathString, " -emit-module " , " /tmp/main.swift "
@@ -4677,8 +4660,7 @@ final class SwiftDriverTests: XCTestCase {
46774660 // Replace the error stream with one we capture here.
46784661 let errorStream = stderrStream
46794662
4680- let root = try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /build " , relativeTo: $0) }
4681- ?? AbsolutePath ( validating: " /build " )
4663+ let root = localFileSystem. currentWorkingDirectory!. appending ( components: " build " )
46824664
46834665 let errorOutputFile = path. appending ( component: " dummy_error_stream " )
46844666 TSCBasic . stderrStream = try ! ThreadSafeOutputByteStream ( LocalFileOutputByteStream ( errorOutputFile) )
@@ -5903,9 +5885,7 @@ final class SwiftDriverTests: XCTestCase {
59035885
59045886 func testFrontendTargetInfoWithWorkingDirectory( ) throws {
59055887 do {
5906- let workingDirectory =
5907- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /absolute/path " , relativeTo: $0) }
5908- ?? AbsolutePath ( validating: " /Foo/Bar " )
5888+ let workingDirectory = localFileSystem. currentWorkingDirectory!. appending ( components: " absolute " , " path " )
59095889
59105890 var driver = try Driver ( args: [ " swiftc " , " -typecheck " , " foo.swift " ,
59115891 " -resource-dir " , " resource/dir " ,
@@ -6352,13 +6332,8 @@ final class SwiftDriverTests: XCTestCase {
63526332
63536333 func testRegistrarLookup( ) throws {
63546334#if os(Windows)
6355- let SDKROOT : AbsolutePath =
6356- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /SDKROOT " , relativeTo: $0) }
6357- ?? AbsolutePath ( validating: " /SDKROOT " )
6358-
6359- let resourceDir : AbsolutePath =
6360- try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /swift/resources " , relativeTo: $0) }
6361- ?? AbsolutePath ( validating: " /swift/resources " )
6335+ let SDKROOT : AbsolutePath = localFileSystem. currentWorkingDirectory!. appending ( components: " SDKROOT " )
6336+ let resourceDir : AbsolutePath = localFileSystem. currentWorkingDirectory!. appending ( components: " swift " , " resources " )
63626337
63636338 let platform : String = " windows "
63646339#if arch(x86_64)
0 commit comments