File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -333,8 +333,8 @@ class ExecuteJobRule: LLBuildRule {
333
333
private func executeJob( _ engine: LLTaskBuildEngine ) {
334
334
let context = engine. jobExecutorContext
335
335
let resolver = context. argsResolver
336
- let env = context. env
337
336
let job = key. job
337
+ let env = context. env. merging ( job. extraEnvironment, uniquingKeysWith: { $1 } )
338
338
339
339
let value : DriverBuildValue
340
340
var pid = 0
Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ public struct Job: Codable, Equatable {
45
45
46
46
/// The outputs produced by the job.
47
47
public var outputs : [ TypedVirtualPath ]
48
+
49
+ /// Any extra environment variables which should be set while running the job.
50
+ public var extraEnvironment : [ String : String ]
48
51
49
52
/// The kind of job.
50
53
public var kind : Kind
@@ -55,14 +58,16 @@ public struct Job: Codable, Equatable {
55
58
commandLine: [ ArgTemplate ] ,
56
59
displayInputs: [ TypedVirtualPath ] ? = nil ,
57
60
inputs: [ TypedVirtualPath ] ,
58
- outputs: [ TypedVirtualPath ]
61
+ outputs: [ TypedVirtualPath ] ,
62
+ extraEnvironment: [ String : String ] = [ : ]
59
63
) {
60
64
self . kind = kind
61
65
self . tool = tool
62
66
self . commandLine = commandLine
63
67
self . displayInputs = displayInputs ?? [ ]
64
68
self . inputs = inputs
65
69
self . outputs = outputs
70
+ self . extraEnvironment = extraEnvironment
66
71
}
67
72
}
68
73
@@ -80,6 +85,13 @@ extension Job: CustomStringConvertible {
80
85
}
81
86
}
82
87
88
+ if !self . extraEnvironment. isEmpty {
89
+ result += " # "
90
+ for (envVar, val) in extraEnvironment {
91
+ result += " \( envVar) = \( val) "
92
+ }
93
+ }
94
+
83
95
return result
84
96
}
85
97
}
You can’t perform that action at this time.
0 commit comments