@@ -876,7 +876,13 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
876
876
let optionContext = await discoveredCommandLineToolSpecInfo ( cbc. producer, cbc. scope, delegate)
877
877
878
878
// 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
+ }
880
886
881
887
// Compute the environment variables to set.
882
888
var environment : [ ( String , String ) ] = environmentFromSpec ( cbc, delegate, lookup: lookup)
@@ -1152,7 +1158,7 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
1152
1158
}
1153
1159
1154
1160
/// 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 {
1156
1162
return resolveExecutablePath ( cbc. producer, path)
1157
1163
}
1158
1164
@@ -1185,14 +1191,14 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
1185
1191
return executionDescription
1186
1192
}
1187
1193
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)
1190
1196
}
1191
1197
1192
1198
/// Creates and returns the command line from the template provided by the specification.
1193
1199
/// - parameter specialArgs: Used to replace the `special-args` placeholder in the command line template.
1194
1200
/// - 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 ] {
1196
1202
let commandLineTemplate = self . commandLineTemplate!
1197
1203
let lookup = { self . lookup ( $0, cbc, delegate, lookup) }
1198
1204
@@ -1239,13 +1245,13 @@ open class CommandLineToolSpec : PropertyDomainSpec, SpecType, TaskTypeDescripti
1239
1245
// Resolve the executable path.
1240
1246
//
1241
1247
// 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
1243
1249
if path. asString. hasPrefix ( " builtin- " ) || ( path. asString. hasPrefix ( " < " ) && path. asString. hasSuffix ( " > " ) ) {
1244
1250
return path
1245
1251
}
1246
1252
1247
1253
// 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 ) )
1249
1255
} ( args [ 0 ] )
1250
1256
1251
1257
return args
0 commit comments