1111//===----------------------------------------------------------------------===//
1212
1313public import SWBUtil
14- import SWBMacro
14+ public import SWBMacro
1515
1616public final class DsymutilToolSpec : GenericCommandLineToolSpec , SpecIdentifierType , @unchecked Sendable {
1717 public static let identifier = " com.apple.tools.dsymutil "
@@ -21,6 +21,13 @@ public final class DsymutilToolSpec : GenericCommandLineToolSpec, SpecIdentifier
2121 fatalError ( " unexpected direct invocation " )
2222 }
2323
24+ public override func environmentFromSpec( _ cbc: CommandBuildContext , _ delegate: any DiagnosticProducingDelegate , lookup: ( ( MacroDeclaration ) -> MacroExpression ? ) ? = nil ) -> [ ( String , String ) ] {
25+ var env : [ ( String , String ) ] = super. environmentFromSpec ( cbc, delegate, lookup: lookup)
26+ // dsymutil may need to lookup lipo, which is not necessarily in the same toolchain.
27+ env. append ( ( " PATH " , cbc. producer. executableSearchPaths. environmentRepresentation) )
28+ return env
29+ }
30+
2431 /// Override construction to patch the inputs.
2532 public func constructTasks( _ cbc: CommandBuildContext , _ delegate: any TaskGenerationDelegate , dsymBundle: Path , buildVariant: String = " " , dsymSearchPaths: [ String ] = [ ] , quietOperation: Bool = false ) async {
2633 let output = cbc. output
@@ -51,6 +58,6 @@ public final class DsymutilToolSpec : GenericCommandLineToolSpec, SpecIdentifier
5158
5259 let inputs : [ any PlannedNode ] = cbc. inputs. map ( { delegate. createNode ( $0. absolutePath) } ) + cbc. commandOrderingInputs
5360 let outputs : [ any PlannedNode ] = [ delegate. createNode ( output) , orderingOutputNode] + cbc. commandOrderingOutputs
54- delegate. createTask ( type: self , ruleInfo: ruleInfo, commandLine: commandLine, environment: EnvironmentBindings ( ) , workingDirectory: cbc. producer. defaultWorkingDirectory, inputs: inputs, outputs: outputs, action: nil , execDescription: resolveExecutionDescription ( templateBuildContext, delegate) , enableSandboxing: enableSandboxing)
61+ delegate. createTask ( type: self , ruleInfo: ruleInfo, commandLine: commandLine, environment: environmentFromSpec ( cbc , delegate ) , workingDirectory: cbc. producer. defaultWorkingDirectory, inputs: inputs, outputs: outputs, action: nil , execDescription: resolveExecutionDescription ( templateBuildContext, delegate) , enableSandboxing: enableSandboxing)
5562 }
5663}
0 commit comments