Skip to content

Commit 80b1401

Browse files
authored
Support %bazel_workspace% interpolation in --repo_env. Attempt to support Windows
1 parent c0c98a2 commit 80b1401

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ public class CommandEnvironment {
137137
private final DelegatingDownloader delegatingDownloader;
138138
private final RemoteAnalysisCachingEventListener remoteAnalysisCachingEventListener;
139139
private final ImmutableList.Builder<IdleTask> idleTasks = ImmutableList.builder();
140-
private final ResourceManager resourceManager;
141140

142141
private boolean mergedAnalysisAndExecution;
143142

@@ -234,8 +233,7 @@ public void exit(AbruptExitException exception) {
234233
CommandExtensionReporter commandExtensionReporter,
235234
int attemptNumber,
236235
@Nullable String buildRequestIdOverride,
237-
ConfigFlagDefinitions configFlagDefinitions,
238-
ResourceManager resourceManager) {
236+
ConfigFlagDefinitions configFlagDefinitions) {
239237
checkArgument(attemptNumber >= 1);
240238

241239
this.runtime = runtime;
@@ -256,7 +254,6 @@ public void exit(AbruptExitException exception) {
256254
this.timestampGranularityMonitor = new TimestampGranularityMonitor(runtime.getClock());
257255
this.attemptNumber = attemptNumber;
258256
this.configFlagDefinitions = configFlagDefinitions;
259-
this.resourceManager = resourceManager;
260257

261258
// Record the command's starting time again, for use by
262259
// TimestampGranularityMonitor.waitForTimestampGranularity().
@@ -358,6 +355,9 @@ public void exit(AbruptExitException exception) {
358355
value = clientEnv.get(name);
359356
}
360357
if (value != null) {
358+
if (workspace.getWorkspace() != null) {
359+
value = value.replace("%bazel_workspace%", workspace.getWorkspace().getPathString());
360+
}
361361
repoEnv.put(name, value);
362362
repoEnvFromOptions.put(name, value);
363363
}
@@ -715,7 +715,7 @@ public WorkspaceInfoFromDiff getWorkspaceInfoFromDiff() {
715715
}
716716

717717
public ResourceManager getLocalResourceManager() {
718-
return resourceManager;
718+
return ResourceManager.instance();
719719
}
720720

721721
/**

0 commit comments

Comments
 (0)