@@ -319,7 +319,7 @@ fileprivate func setup(
319
319
#else
320
320
try Process . checkNonZeroExit ( args: " cp " , " -R " , " -H " , srcDir. pathString, dstDir. pathString)
321
321
#endif
322
-
322
+
323
323
// Ensure we get a clean test fixture.
324
324
try localFileSystem. removeFileTree ( dstDir. appending ( component: " .build " ) )
325
325
try localFileSystem. removeFileTree ( dstDir. appending ( component: " .swiftpm " ) )
@@ -522,14 +522,7 @@ private func swiftArgs(
522
522
Xswiftc: [ String ] ,
523
523
buildSystem: BuildSystemProvider . Kind ?
524
524
) -> [ String ] {
525
- var args = [ " --configuration " ]
526
- switch configuration {
527
- case . debug:
528
- args. append ( " debug " )
529
- case . release:
530
- args. append ( " release " )
531
- }
532
-
525
+ var args = configuration. buildArgs
533
526
args += Xcc . flatMap { [ " -Xcc " , $0] }
534
527
args += Xld . flatMap { [ " -Xlinker " , $0] }
535
528
args += Xswiftc . flatMap { [ " -Xswiftc " , $0] }
@@ -538,7 +531,7 @@ private func swiftArgs(
538
531
return args
539
532
}
540
533
541
- @available ( * ,
534
+ @available ( * ,
542
535
deprecated,
543
536
renamed: " loadModulesGraph " ,
544
537
message: " Rename for consistency: the type of this functions return value is named `ModulesGraph`. "
@@ -571,6 +564,19 @@ public func loadPackageGraph(
571
564
)
572
565
}
573
566
567
+ extension BuildConfiguration {
568
+ public var buildArgs : [ String ] {
569
+ var args = [ " --configuration " ]
570
+ switch self {
571
+ case . debug:
572
+ args. append ( " debug " )
573
+ case . release:
574
+ args. append ( " release " )
575
+ }
576
+ return args
577
+ }
578
+ }
579
+
574
580
public let emptyZipFile = ByteString ( [ 0x80 , 0x75 , 0x05 , 0x06 ] + [ UInt8] ( repeating: 0x00 , count: 18 ) )
575
581
576
582
extension FileSystem {
@@ -682,7 +688,7 @@ public func getNumberOfMatches(of match: String, in value: String) -> Int {
682
688
}
683
689
684
690
public extension String {
685
- var withSwiftLineEnding : String {
691
+ var withSwiftLineEnding : String {
686
692
return replacingOccurrences ( of: " \r \n " , with: " \n " )
687
693
}
688
694
}
0 commit comments