17
17
import com .google .common .collect .ImmutableList ;
18
18
import com .google .common .collect .ImmutableMap ;
19
19
import com .google .devtools .build .lib .actions .AbstractAction ;
20
+ import com .google .devtools .build .lib .actions .ActionEnvironment ;
20
21
import com .google .devtools .build .lib .actions .ActionExecutionContext ;
21
22
import com .google .devtools .build .lib .actions .ActionExecutionException ;
22
23
import com .google .devtools .build .lib .actions .ActionKeyContext ;
26
27
import com .google .devtools .build .lib .concurrent .ThreadSafety .Immutable ;
27
28
import com .google .devtools .build .lib .skyframe .serialization .autocodec .AutoCodec ;
28
29
import com .google .devtools .build .lib .util .Fingerprint ;
30
+ import java .util .LinkedHashMap ;
31
+ import java .util .Map ;
29
32
30
33
/**
31
34
* Action responsible for the symlink tree creation.
@@ -40,7 +43,6 @@ public final class SymlinkTreeAction extends AbstractAction {
40
43
private final Artifact inputManifest ;
41
44
private final Artifact outputManifest ;
42
45
private final boolean filesetTree ;
43
- private final ImmutableMap <String , String > shellEnvironment ;
44
46
private final boolean enableRunfiles ;
45
47
46
48
/**
@@ -59,14 +61,13 @@ public SymlinkTreeAction(
59
61
Artifact inputManifest ,
60
62
Artifact outputManifest ,
61
63
boolean filesetTree ,
62
- ImmutableMap < String , String > shellEnvironment ,
64
+ ActionEnvironment env ,
63
65
boolean enableRunfiles ) {
64
- super (owner , ImmutableList .of (inputManifest ), ImmutableList .of (outputManifest ));
66
+ super (owner , ImmutableList .of (inputManifest ), ImmutableList .of (outputManifest ), env );
65
67
Preconditions .checkArgument (outputManifest .getPath ().getBaseName ().equals ("MANIFEST" ));
66
68
this .inputManifest = inputManifest ;
67
69
this .outputManifest = outputManifest ;
68
70
this .filesetTree = filesetTree ;
69
- this .shellEnvironment = shellEnvironment ;
70
71
this .enableRunfiles = enableRunfiles ;
71
72
}
72
73
@@ -96,15 +97,21 @@ protected String getRawProgressMessage() {
96
97
@ Override
97
98
protected void computeKey (ActionKeyContext actionKeyContext , Fingerprint fp ) {
98
99
fp .addString (GUID );
99
- fp .addInt (filesetTree ? 1 : 0 );
100
+ fp .addBoolean (filesetTree );
101
+ fp .addBoolean (enableRunfiles );
102
+ fp .addStringMap (env .getFixedEnv ());
103
+ fp .addStrings (env .getInheritedEnv ());
100
104
}
101
105
102
106
@ Override
103
107
public ActionResult execute (ActionExecutionContext actionExecutionContext )
104
108
throws ActionExecutionException , InterruptedException {
109
+ Map <String , String > resolvedEnv = new LinkedHashMap <>();
110
+ env .resolve (resolvedEnv , actionExecutionContext .getClientEnv ());
105
111
actionExecutionContext
106
112
.getContext (SymlinkTreeActionContext .class )
107
- .createSymlinks (this , actionExecutionContext , shellEnvironment , enableRunfiles );
113
+ .createSymlinks (
114
+ this , actionExecutionContext , ImmutableMap .copyOf (resolvedEnv ), enableRunfiles );
108
115
return ActionResult .EMPTY ;
109
116
}
110
117
}
0 commit comments