Inject ResourceManager everywhere
This is in preparation for async local execution, for which we require a
thread pool. My plan is to have the thread pool be part of
ResourceManager, and injecting it avoids having a long-lived thread pool
in Bazel. Even if we didn't inject the RM, we'd still have to inject the
thread pool, so might as well do it now.
PiperOrigin-RevId: 262519813
diff --git a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java
index 6152caf..a8e6682 100644
--- a/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java
+++ b/src/main/java/com/google/devtools/build/lib/buildtool/ExecutionTool.java
@@ -342,7 +342,7 @@
skyframeExecutor.drainChangedFiles();
try (SilentCloseable c = Profiler.instance().profile("configureResourceManager")) {
- configureResourceManager(request);
+ configureResourceManager(env.getLocalResourceManager(), request);
}
Profiler.instance().markPhase(ProfilePhase.EXECUTE);
@@ -616,6 +616,7 @@
ArtifactFactory artifactFactory = env.getSkyframeBuildView().getArtifactFactory();
return new SkyframeBuilder(
skyframeExecutor,
+ env.getLocalResourceManager(),
new ActionCacheChecker(
actionCache,
artifactFactory,
@@ -634,8 +635,7 @@
}
@VisibleForTesting
- public static void configureResourceManager(BuildRequest request) {
- ResourceManager resourceMgr = ResourceManager.instance();
+ public static void configureResourceManager(ResourceManager resourceMgr, BuildRequest request) {
ExecutionOptions options = request.getOptions(ExecutionOptions.class);
ResourceSet resources;
if (options.availableResources != null && !options.removeLocalResources) {