@@ -284,12 +284,8 @@ final class SwiftDriverTests: XCTestCase {
284
284
[ TypedVirtualPath ( file: VirtualPath . relative ( RelativePath ( " a.swift " ) ) . intern ( ) , type: . swift) ,
285
285
TypedVirtualPath ( file: VirtualPath . absolute ( AbsolutePath ( " /tmp/b.swift " ) ) . intern ( ) , type: . swift) ] )
286
286
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 " )
293
289
294
290
let driver2 = try Driver ( args: [ " swiftc " , " a.swift " , " -working-directory " , workingDirectory. pathString, rebase ( " b.swift " , at: tempDirectory) ] )
295
291
XCTAssertEqual ( driver2. inputFiles,
@@ -649,9 +645,7 @@ final class SwiftDriverTests: XCTestCase {
649
645
XCTAssertEqual ( plannedJobs [ 2 ] . outputs. first!. file, VirtualPath . relative ( RelativePath ( executableName ( " Test " ) ) ) )
650
646
651
647
// 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 " )
655
649
656
650
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 " ] )
657
651
let plannedJobs2 = try driver2. planBuild ( )
@@ -1097,8 +1091,7 @@ final class SwiftDriverTests: XCTestCase {
1097
1091
]
1098
1092
]
1099
1093
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 " )
1102
1095
1103
1096
let resolvedStringyEntries : [ String : [ FileType : String ] ] = [
1104
1097
" " : [ . swiftDeps: root. appending ( components: " foo.build " , " master.swiftdeps " ) . pathString] ,
@@ -2749,8 +2742,7 @@ final class SwiftDriverTests: XCTestCase {
2749
2742
}
2750
2743
2751
2744
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 " )
2754
2746
2755
2747
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 " ] )
2756
2748
let plannedJobs = try driver. planBuild ( )
@@ -2814,8 +2806,7 @@ final class SwiftDriverTests: XCTestCase {
2814
2806
envVars [ " SWIFT_DRIVER_LD_EXEC " ] = ld. nativePathString ( escaped: false )
2815
2807
2816
2808
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 " )
2819
2810
2820
2811
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 " ] ,
2821
2812
env: envVars)
@@ -2837,8 +2828,7 @@ final class SwiftDriverTests: XCTestCase {
2837
2828
}
2838
2829
2839
2830
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 " )
2842
2832
2843
2833
// We don't expect partial jobs when asking only for the swiftmodule with
2844
2834
// -experimental-emit-module-separately.
@@ -2886,8 +2876,7 @@ final class SwiftDriverTests: XCTestCase {
2886
2876
func testEmitModuleSeparatelyWMO( ) throws {
2887
2877
var envVars = ProcessEnv . vars
2888
2878
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 " )
2891
2880
2892
2881
do {
2893
2882
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 {
4262
4251
}
4263
4252
4264
4253
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 " )
4268
4255
4269
4256
var driver = try Driver ( args: [
4270
4257
" swiftc " , " -working-directory " , workingDirectory. pathString, " -emit-executable " , " test.swift " , " -L=. " , " -F=. "
@@ -4283,9 +4270,7 @@ final class SwiftDriverTests: XCTestCase {
4283
4270
}
4284
4271
4285
4272
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 " )
4289
4274
4290
4275
var driver = try Driver ( args: [
4291
4276
" swiftc " , " -working-directory " , workingDirectory. pathString, " -emit-executable " , " -c " , " /tmp/main.swift "
@@ -4298,9 +4283,7 @@ final class SwiftDriverTests: XCTestCase {
4298
4283
}
4299
4284
4300
4285
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 " )
4304
4287
4305
4288
var driver = try Driver ( args: [
4306
4289
" swiftc " , " -working-directory " , workingDirectory. pathString, " -emit-module " , " /tmp/main.swift "
@@ -4677,8 +4660,7 @@ final class SwiftDriverTests: XCTestCase {
4677
4660
// Replace the error stream with one we capture here.
4678
4661
let errorStream = stderrStream
4679
4662
4680
- let root = try localFileSystem. currentWorkingDirectory. map { AbsolutePath ( " /build " , relativeTo: $0) }
4681
- ?? AbsolutePath ( validating: " /build " )
4663
+ let root = localFileSystem. currentWorkingDirectory!. appending ( components: " build " )
4682
4664
4683
4665
let errorOutputFile = path. appending ( component: " dummy_error_stream " )
4684
4666
TSCBasic . stderrStream = try ! ThreadSafeOutputByteStream ( LocalFileOutputByteStream ( errorOutputFile) )
@@ -5903,9 +5885,7 @@ final class SwiftDriverTests: XCTestCase {
5903
5885
5904
5886
func testFrontendTargetInfoWithWorkingDirectory( ) throws {
5905
5887
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 " )
5909
5889
5910
5890
var driver = try Driver ( args: [ " swiftc " , " -typecheck " , " foo.swift " ,
5911
5891
" -resource-dir " , " resource/dir " ,
@@ -6352,13 +6332,8 @@ final class SwiftDriverTests: XCTestCase {
6352
6332
6353
6333
func testRegistrarLookup( ) throws {
6354
6334
#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 " )
6362
6337
6363
6338
let platform : String = " windows "
6364
6339
#if arch(x86_64)
0 commit comments