Skip to content

Commit

Permalink
Merge two experimental_local_disk_cache options to one
Browse files Browse the repository at this point in the history
Fixes: bazelbuild#4870.

Test Plan:

  $ bazel test src/test/shell/bazel:local_action_cache_test
  • Loading branch information
davido committed Mar 19, 2018
1 parent e2df6e2 commit 791dbaa
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Iterable<? extends ActionContext> getActionContexts() {
String buildRequestId = env.getBuildRequestId().toString();
String commandId = env.getCommandId().toString();

if (remoteOptions.experimentalRemoteSpawnCache || remoteOptions.experimentalLocalDiskCache) {
if (remoteOptions.experimentalRemoteSpawnCache || remoteOptions.localDiskCache != null) {
RemoteSpawnCache spawnCache =
new RemoteSpawnCache(
env.getExecRoot(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,27 +190,17 @@ public final class RemoteOptions extends OptionsBase {
)
public boolean experimentalRemoteSpawnCache;

// TODO(davido): Find a better place for this and the next option.
// TODO(davido): Find a better place for this option.
@Option(
name = "experimental_local_disk_cache",
defaultValue = "false",
category = "remote",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help = "Whether to use the experimental local disk cache."
)
public boolean experimentalLocalDiskCache;

@Option(
name = "experimental_local_disk_cache_path",
name = "local_disk_cache",
defaultValue = "null",
category = "remote",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
converter = OptionsUtils.PathFragmentConverter.class,
help = "A file path to a local disk cache."
)
public PathFragment experimentalLocalDiskCachePath;
public PathFragment localDiskCache;

@Option(
name = "experimental_guard_against_concurrent_changes",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static SimpleBlobStore createRest(RemoteOptions options, Credentials cred
public static SimpleBlobStore createLocalDisk(RemoteOptions options, Path workingDirectory)
throws IOException {
return new OnDiskBlobStore(
workingDirectory.getRelative(checkNotNull(options.experimentalLocalDiskCachePath)));
workingDirectory.getRelative(checkNotNull(options.localDiskCache)));
}

public static SimpleBlobStore create(
Expand All @@ -71,7 +71,7 @@ public static boolean isRemoteCacheOptions(RemoteOptions options) {
}

public static boolean isLocalDiskCache(RemoteOptions options) {
return options.experimentalLocalDiskCache;
return options.localDiskCache != null;
}

private static boolean isRestUrlOptions(RemoteOptions options) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/shell/bazel/local_action_cache_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function test_local_action_cache() {
local execution_file="${TEST_TMPDIR}/run.log"
local input_file="foo.in"
local output_file="bazel-genfiles/foo.txt"
local flags="--experimental_local_disk_cache_path=$cache --experimental_local_disk_cache"
local flags="--local_disk_cache=$cache"

rm -rf $cache
mkdir $cache
Expand Down

0 comments on commit 791dbaa

Please sign in to comment.