@@ -57,17 +57,16 @@ public final class ArgsResolver {
5757 }
5858 }
5959
60- public func resolveArgumentList( for job: Job , useResponseFiles: ResponseFileHandling = . heuristic,
61- quotePaths: Bool = false ) throws -> [ String ] {
62- let ( arguments, _) = try resolveArgumentList ( for: job, useResponseFiles: useResponseFiles,
63- quotePaths: quotePaths)
60+ public func resolveArgumentList( for job: Job , useResponseFiles: ResponseFileHandling = . heuristic)
61+ throws -> [ String ] {
62+ let ( arguments, _) = try resolveArgumentList ( for: job, useResponseFiles: useResponseFiles)
6463 return arguments
6564 }
6665
67- public func resolveArgumentList( for job: Job , useResponseFiles: ResponseFileHandling = . heuristic,
68- quotePaths : Bool = false ) throws -> ( [ String ] , usingResponseFile: Bool ) {
69- let tool = try resolve ( . path( job. tool) , quotePaths : quotePaths )
70- var arguments = [ tool] + ( try job. commandLine. map { try resolve ( $0, quotePaths : quotePaths ) } )
66+ public func resolveArgumentList( for job: Job , useResponseFiles: ResponseFileHandling = . heuristic)
67+ throws -> ( [ String ] , usingResponseFile: Bool ) {
68+ let tool = try resolve ( . path( job. tool) )
69+ var arguments = [ tool] + ( try job. commandLine. map { try resolve ( $0) } )
7170 let usingResponseFile = try createResponseFileIfNeeded ( for: job, resolvedArguments: & arguments,
7271 useResponseFiles: useResponseFiles)
7372 return ( arguments, usingResponseFile)
@@ -77,46 +76,45 @@ public final class ArgsResolver {
7776 public func resolveArgumentList( for job: Job , forceResponseFiles: Bool ,
7877 quotePaths: Bool = false ) throws -> [ String ] {
7978 let useResponseFiles : ResponseFileHandling = forceResponseFiles ? . forced : . heuristic
80- return try resolveArgumentList ( for: job, useResponseFiles: useResponseFiles, quotePaths : quotePaths )
79+ return try resolveArgumentList ( for: job, useResponseFiles: useResponseFiles)
8180 }
8281
8382 @available ( * , deprecated, message: " use resolveArgumentList(for:,useResponseFiles:,quotePaths:) " )
8483 public func resolveArgumentList( for job: Job , forceResponseFiles: Bool ,
8584 quotePaths: Bool = false ) throws -> ( [ String ] , usingResponseFile: Bool ) {
8685 let useResponseFiles : ResponseFileHandling = forceResponseFiles ? . forced : . heuristic
87- return try resolveArgumentList ( for: job, useResponseFiles: useResponseFiles, quotePaths : quotePaths )
86+ return try resolveArgumentList ( for: job, useResponseFiles: useResponseFiles)
8887 }
8988
9089 /// Resolve the given argument.
91- public func resolve( _ arg: Job . ArgTemplate ,
92- quotePaths: Bool = false ) throws -> String {
90+ public func resolve( _ arg: Job . ArgTemplate ) throws -> String {
9391 switch arg {
9492 case . flag( let flag) :
9593 return flag
9694
9795 case . path( let path) :
9896 return try lock. withLock {
99- return try unsafeResolve ( path: path, quotePaths : quotePaths )
97+ return try unsafeResolve ( path: path)
10098 }
10199
102100 case . responseFilePath( let path) :
103- return " @ \( try resolve ( . path( path) , quotePaths : quotePaths ) ) "
101+ return " @ \( try resolve ( . path( path) ) ) "
104102
105103 case let . joinedOptionAndPath( option, path) :
106- return option + ( try resolve ( . path( path) , quotePaths : quotePaths ) )
104+ return option + ( try resolve ( . path( path) ) )
107105
108106 case let . squashedArgumentList( option: option, args: args) :
109107 return try option + args. map {
110- try resolve ( $0, quotePaths : quotePaths )
108+ try resolve ( $0)
111109 } . joined ( separator: " " )
112110 }
113111 }
114112
115113 /// Needs to be done inside of `lock`. Marked unsafe to make that more obvious.
116- private func unsafeResolve( path: VirtualPath , quotePaths : Bool ) throws -> String {
114+ private func unsafeResolve( path: VirtualPath ) throws -> String {
117115 // If there was a path mapping, use it.
118116 if let actualPath = pathMapping [ path] {
119- return quotePaths ? quoteArgument ( actualPath ) : actualPath
117+ return actualPath
120118 }
121119
122120 // Return the path from the temporary directory if this is a temporary file.
@@ -140,21 +138,21 @@ public final class ArgsResolver {
140138
141139 let result = actualPath. name
142140 pathMapping [ path] = result
143- return quotePaths ? " ' \( result ) ' " : result
141+ return result
144142 }
145143
146144 // Otherwise, return the path.
147145 let result = path. name
148146 pathMapping [ path] = result
149- return quotePaths ? quoteArgument ( result ) : result
147+ return result
150148 }
151149
152150 private func createFileList( path: VirtualPath , contents: [ VirtualPath ] ) throws {
153151 // FIXME: Need a way to support this for distributed build systems...
154152 if let absPath = path. absolutePath {
155153 try fileSystem. writeFileContents ( absPath) { out in
156154 for path in contents {
157- try ! out <<< unsafeResolve ( path: path, quotePaths : false ) <<< " \n "
155+ try ! out <<< unsafeResolve ( path: path) <<< " \n "
158156 }
159157 }
160158 }
@@ -184,7 +182,7 @@ public final class ArgsResolver {
184182 }
185183
186184 private func quoteAndEscape( path: VirtualPath ) -> String {
187- let inputNode = Node . scalar ( Node . Scalar ( try ! unsafeResolve ( path: path, quotePaths : false ) ,
185+ let inputNode = Node . scalar ( Node . Scalar ( try ! unsafeResolve ( path: path) ,
188186 Tag ( . str) , . doubleQuoted) )
189187 // Width parameter of -1 sets preferred line-width to unlimited so that no extraneous
190188 // line-breaks will be inserted during serialization.
0 commit comments