aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
diff options
context:
space:
mode:
authorGravatar Dan Fabulich <DanFabulich@gmail.com>2016-07-22 12:46:08 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-07-22 13:44:50 +0000
commit81c9dc946df2abcaa58823b7c78ef04f5cdc3add (patch)
treec26ee5a0d3d6230285ce316ae7435c8b61be6c8b /src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
parenta088d75da21294bc45ef7ef8d5de4327876db85c (diff)
Simple REST URL cache
-- Change-Id: Ied34278c63c74aaf2db5ad90d5f076b3bddbe396 Reviewed-on: https://bazel-review.git.corp.google.com/#/c/4061/ MOS_MIGRATED_REVID=128165927
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
index 32e08615b9..c55a788720 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteModule.java
@@ -24,7 +24,6 @@ import com.google.devtools.build.lib.runtime.BlazeModule;
import com.google.devtools.build.lib.runtime.Command;
import com.google.devtools.build.lib.runtime.CommandEnvironment;
import com.google.devtools.common.options.OptionsBase;
-
import java.net.URI;
import java.net.URISyntaxException;
@@ -62,15 +61,27 @@ public final class RemoteModule extends BlazeModule {
buildRequest = event.getRequest();
RemoteOptions options = buildRequest.getOptions(RemoteOptions.class);
+ MemcacheActionCache cache = null;
+
// Don't provide the remote spawn unless at least action cache is initialized.
- if (actionCache == null
- && (options.hazelcastNode != null || options.hazelcastClientConfig != null)) {
- MemcacheActionCache cache =
- new MemcacheActionCache(
- this.env.getDirectories().getExecRoot(),
- options,
- HazelcastCacheFactory.create(options));
+ if (actionCache == null) {
+ if (options.hazelcastNode != null || options.hazelcastClientConfig != null) {
+ cache =
+ new MemcacheActionCache(
+ this.env.getDirectories().getExecRoot(),
+ options,
+ HazelcastCacheFactory.create(options));
+ } else if (options.restCacheUrl != null) {
+ cache =
+ new MemcacheActionCache(
+ this.env.getDirectories().getExecRoot(),
+ options,
+ RestUrlCacheFactory.create(options));
+ }
actionCache = cache;
+ }
+
+ if (cache != null) {
if (workExecutor == null && options.remoteWorker != null) {
try {
URI uri = new URI("dummy://" + options.remoteWorker);