Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.0.0] Move CacheSalt into a separate proto definition file. #20184

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/google/devtools/build/lib/remote/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ java_library(
"//src/main/java/com/google/devtools/build/skyframe",
"//src/main/java/com/google/devtools/build/skyframe:skyframe-objects",
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:cache_salt_java_proto",
"//src/main/protobuf:failure_details_java_proto",
"//src/main/protobuf:spawn_java_proto",
"//third_party:auth",
"//third_party:caffeine",
"//third_party:flogger",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
import com.google.devtools.build.lib.buildtool.buildevent.BuildInterruptedEvent;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.exec.Protos.CacheSalt;
import com.google.devtools.build.lib.exec.SpawnInputExpander.InputWalker;
import com.google.devtools.build.lib.exec.SpawnRunner.SpawnExecutionContext;
import com.google.devtools.build.lib.exec.local.LocalEnvProvider;
Expand All @@ -100,6 +99,7 @@
import com.google.devtools.build.lib.remote.common.RemotePathResolver;
import com.google.devtools.build.lib.remote.merkletree.MerkleTree;
import com.google.devtools.build.lib.remote.options.RemoteOptions;
import com.google.devtools.build.lib.remote.salt.CacheSalt;
import com.google.devtools.build.lib.remote.util.DigestUtil;
import com.google.devtools.build.lib.remote.util.TempPathGenerator;
import com.google.devtools.build.lib.remote.util.TracingMetadataUtils;
Expand Down
16 changes: 16 additions & 0 deletions src/main/protobuf/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,21 @@ java_library_srcs(
deps = [":remote_execution_log_java_proto"],
)

proto_library(
name = "cache_salt_proto",
srcs = ["cache_salt.proto"],
)

java_proto_library(
name = "cache_salt_java_proto",
deps = [":cache_salt_proto"],
)

java_library_srcs(
name = "cache_salt_java_proto_srcs",
deps = [":cache_salt_java_proto"],
)

proto_library(
name = "remote_scrubbing_proto",
srcs = ["remote_scrubbing.proto"],
Expand Down Expand Up @@ -284,6 +299,7 @@ filegroup(
name = "dist_jars",
srcs = [s + "_java_proto_srcs" for s in FILES] + [
":analysis_v2_java_proto_srcs",
":cache_salt_java_proto_srcs",
":command_line_java_proto_srcs",
":command_server_java_grpc_srcs",
":command_server_java_proto_srcs",
Expand Down
43 changes: 43 additions & 0 deletions src/main/protobuf/cache_salt.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2023 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package tools.protos;

option java_package = "com.google.devtools.build.lib.remote.salt";
option java_multiple_files = true;

// Additional information that should be taken into account when computing the
// disk or remote cache key for a spawn, thereby ensuring that spawns remain
// distinct.
message CacheSalt {
// Whether or not the spawn may be executed remotely, if remote
// execution were to be enabled. This ensures that adding/removing the
// "no-remote-exec" tag from a target forces a local/remote rebuild.
bool may_be_executed_remotely = 1;

// Requires the execution service do NOT share caches across different
// workspaces.
string workspace = 2;

message ScrubSalt {
// A unique value used to bust the cache for scrubbed spawns.
string salt = 1;
}

// Ensures that a scrubbed spawn can never collide with a non-scrubbed one.
// See the documentation for the --experimental_remote_scrub_config flag.
ScrubSalt scrub_salt = 3;
}
23 changes: 0 additions & 23 deletions src/main/protobuf/spawn.proto
Original file line number Diff line number Diff line change
Expand Up @@ -192,26 +192,3 @@ message SpawnExec {
// Timing, size and memory statistics.
SpawnMetrics metrics = 20;
}

// Additional information that should be taken into account when
// computing the key of an action, thereby ensuring that actions remain
// distinct.
message CacheSalt {
// Whether or not the action may be executed remotely, if remote
// execution were to be enabled. This ensures that adding/removing the
// "no-remote-exec" tag from a target forces a local/remote rebuild.
bool may_be_executed_remotely = 1;

// Requires the execution service do NOT share caches across different
// workspace.
string workspace = 2;

message ScrubSalt {
// A unique value used to bust the cache for scrubbed actions.
string salt = 1;
}

// Ensures that a scrubbed action can never collide with a non-scrubbed one.
// See the documentation for the --experimental_remote_scrub_config flag.
ScrubSalt scrub_salt = 3;
}
1 change: 1 addition & 0 deletions src/test/java/com/google/devtools/build/lib/remote/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ java_library(
"//src/main/java/com/google/devtools/build/lib/vfs/bazel",
"//src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs",
"//src/main/java/com/google/devtools/common/options",
"//src/main/protobuf:cache_salt_java_proto",
"//src/main/protobuf:failure_details_java_proto",
"//src/main/protobuf:remote_scrubbing_java_proto",
"//src/main/protobuf:spawn_java_proto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.events.StoredEventHandler;
import com.google.devtools.build.lib.exec.Protos.CacheSalt;
import com.google.devtools.build.lib.exec.util.FakeOwner;
import com.google.devtools.build.lib.exec.util.SpawnBuilder;
import com.google.devtools.build.lib.remote.RemoteExecutionService.RemoteActionResult;
Expand All @@ -97,6 +96,7 @@
import com.google.devtools.build.lib.remote.common.RemotePathResolver.SiblingRepositoryLayoutResolver;
import com.google.devtools.build.lib.remote.merkletree.MerkleTree;
import com.google.devtools.build.lib.remote.options.RemoteOptions;
import com.google.devtools.build.lib.remote.salt.CacheSalt;
import com.google.devtools.build.lib.remote.util.DigestUtil;
import com.google.devtools.build.lib.remote.util.FakeSpawnExecutionContext;
import com.google.devtools.build.lib.remote.util.InMemoryCacheClient;
Expand Down
Loading