@@ -876,7 +876,13 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
876876 let optionContext = await discoveredCommandLineToolSpecInfo ( cbc. producer, cbc. scope, delegate)
877877
878878 // Compute the command line arguments from the template.
879- let commandLine = commandLine ?? commandLineFromTemplate ( cbc, delegate, optionContext: optionContext, specialArgs: specialArgs, lookup: lookup) . map ( \. asString)
879+ let providedCommandLine = commandLine
880+ let commandLine : [ String ]
881+ if let providedCommandLine {
882+ commandLine = providedCommandLine
883+ } else {
884+ commandLine = await commandLineFromTemplate ( cbc, delegate, optionContext: optionContext, specialArgs: specialArgs, lookup: lookup) . map ( \. asString)
885+ }
880886
881887 // Compute the environment variables to set.
882888 var environment : [ ( String , String ) ] = environmentFromSpec ( cbc, delegate, lookup: lookup)
@@ -1152,7 +1158,7 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
11521158 }
11531159
11541160 /// Resolve an executable path or name to an absolute path.
1155- open func resolveExecutablePath( _ cbc: CommandBuildContext , _ path: Path ) -> Path {
1161+ open func resolveExecutablePath( _ cbc: CommandBuildContext , _ path: Path , delegate : any CoreClientTargetDiagnosticProducingDelegate ) async -> Path {
11561162 return resolveExecutablePath ( cbc. producer, path)
11571163 }
11581164
@@ -1185,14 +1191,14 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
11851191 return executionDescription
11861192 }
11871193
1188- open func commandLineFromTemplate( _ cbc: CommandBuildContext , _ delegate: any TaskGenerationDelegate , optionContext: ( any DiscoveredCommandLineToolSpecInfo ) ? , specialArgs: [ String ] = [ ] , lookup: ( ( MacroDeclaration ) -> MacroExpression ? ) ? = nil ) -> [ CommandLineArgument ] {
1189- return commandLineArgumentsFromTemplate ( cbc, delegate, optionContext: optionContext, specialArgs: specialArgs, lookup: lookup)
1194+ open func commandLineFromTemplate( _ cbc: CommandBuildContext , _ delegate: any TaskGenerationDelegate , optionContext: ( any DiscoveredCommandLineToolSpecInfo ) ? , specialArgs: [ String ] = [ ] , lookup: ( ( MacroDeclaration ) -> MacroExpression ? ) ? = nil ) async -> [ CommandLineArgument ] {
1195+ return await commandLineArgumentsFromTemplate ( cbc, delegate, optionContext: optionContext, specialArgs: specialArgs, lookup: lookup)
11901196 }
11911197
11921198 /// Creates and returns the command line from the template provided by the specification.
11931199 /// - parameter specialArgs: Used to replace the `special-args` placeholder in the command line template.
11941200 /// - parameter lookup: An optional closure which functionally defined overriding values during build setting evaluation.
1195- public func commandLineArgumentsFromTemplate( _ cbc: CommandBuildContext , _ delegate: any TaskGenerationDelegate , optionContext: ( any DiscoveredCommandLineToolSpecInfo ) ? , specialArgs: [ String ] = [ ] , lookup: ( ( MacroDeclaration ) -> MacroExpression ? ) ? = nil ) -> [ CommandLineArgument ] {
1201+ public func commandLineArgumentsFromTemplate( _ cbc: CommandBuildContext , _ delegate: any TaskGenerationDelegate , optionContext: ( any DiscoveredCommandLineToolSpecInfo ) ? , specialArgs: [ String ] = [ ] , lookup: ( ( MacroDeclaration ) -> MacroExpression ? ) ? = nil ) async -> [ CommandLineArgument ] {
11961202 let commandLineTemplate = self . commandLineTemplate!
11971203 let lookup = { self . lookup ( $0, cbc, delegate, lookup) }
11981204
@@ -1239,13 +1245,13 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
12391245 // Resolve the executable path.
12401246 //
12411247 // FIXME: It would be nice to just move this to a specific handler for this first item in the template array (we could generalize the existing ExecPath key for this purpose).
1242- args [ 0 ] = { path in
1248+ args [ 0 ] = await { path in
12431249 if path. asString. hasPrefix ( " builtin- " ) || ( path. asString. hasPrefix ( " < " ) && path. asString. hasSuffix ( " > " ) ) {
12441250 return path
12451251 }
12461252
12471253 // Otherwise, look up the path if necessary.
1248- return . path( resolveExecutablePath ( cbc, Path ( path. asString) ) )
1254+ return . path( await resolveExecutablePath ( cbc, Path ( path. asString) , delegate : delegate ) )
12491255 } ( args [ 0 ] )
12501256
12511257 return args
0 commit comments