11
11
//===----------------------------------------------------------------------===//
12
12
13
13
public import SWBUtil
14
- import SWBMacro
14
+ public import SWBMacro
15
15
16
16
public final class DsymutilToolSpec : GenericCommandLineToolSpec , SpecIdentifierType , @unchecked Sendable {
17
17
public static let identifier = " com.apple.tools.dsymutil "
@@ -21,6 +21,13 @@ public final class DsymutilToolSpec : GenericCommandLineToolSpec, SpecIdentifier
21
21
fatalError ( " unexpected direct invocation " )
22
22
}
23
23
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
+
24
31
/// Override construction to patch the inputs.
25
32
public func constructTasks( _ cbc: CommandBuildContext , _ delegate: any TaskGenerationDelegate , dsymBundle: Path , buildVariant: String = " " , dsymSearchPaths: [ String ] = [ ] , quietOperation: Bool = false ) async {
26
33
let output = cbc. output
@@ -51,6 +58,6 @@ public final class DsymutilToolSpec : GenericCommandLineToolSpec, SpecIdentifier
51
58
52
59
let inputs : [ any PlannedNode ] = cbc. inputs. map ( { delegate. createNode ( $0. absolutePath) } ) + cbc. commandOrderingInputs
53
60
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)
55
62
}
56
63
}
0 commit comments