aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp
diff options
context:
space:
mode:
authorGravatar ccalvarin <ccalvarin@google.com>2018-08-01 19:25:22 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-08-01 19:26:50 -0700
commit78142a6bf3dbf802e3140c1098cf3fda8d4be883 (patch)
tree0cabf6381320a3c39fecbc14926ee1196e1182bf /src/main/cpp
parentc82074a3848e4b7340a85ce855f3d5b9fb157fd7 (diff)
Add a normal startup-option for setting the digest function.
We continue to support the jvm property -Dbazel.DigestFunction, for backwards compatibility, but this will go away. The startup-option is marked experimental for now as we iron out issues. (note: leaving this out of release notes until the experimental tag is removed) As part of this refactor, the default constructor calls for FileSystem and derived classes will now use this default. This should remove the need for constructors that accept custom hash functions. RELNOTES: None. PiperOrigin-RevId: 207035217
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/blaze.cc5
-rw-r--r--src/main/cpp/startup_options.cc6
-rw-r--r--src/main/cpp/startup_options.h3
3 files changed, 14 insertions, 0 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index 12c7cdd1a2..9e7d979855 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -536,6 +536,11 @@ static vector<string> GetArgumentArray(
} else {
result.push_back("--noexpand_configs_in_place");
}
+ if (!globals->options->digest_function.empty()) {
+ // Only include this if a value is requested - we rely on the empty case
+ // being "null" to set the programmatic default in the server.
+ result.push_back("--digest_function=" + globals->options->digest_function);
+ }
if (globals->options->oom_more_eagerly) {
result.push_back("--experimental_oom_more_eagerly");
} else {
diff --git a/src/main/cpp/startup_options.cc b/src/main/cpp/startup_options.cc
index b2db261526..a2d26b74d3 100644
--- a/src/main/cpp/startup_options.cc
+++ b/src/main/cpp/startup_options.cc
@@ -92,6 +92,7 @@ StartupOptions::StartupOptions(const string &product_name,
java_logging_formatter(
"com.google.devtools.build.lib.util.SingleLineFormatter"),
expand_configs_in_place(true),
+ digest_function(),
original_startup_options_(std::vector<RcStartupFlag>()) {
bool testing = !blaze::GetEnv("TEST_TMPDIR").empty();
if (testing) {
@@ -137,6 +138,7 @@ StartupOptions::StartupOptions(const string &product_name,
RegisterNullaryStartupFlag("write_command_log");
RegisterUnaryStartupFlag("command_port");
RegisterUnaryStartupFlag("connect_timeout_secs");
+ RegisterUnaryStartupFlag("digest_function");
RegisterUnaryStartupFlag("experimental_oom_more_eagerly_threshold");
// TODO(b/5568649): remove this deprecated alias for server_javabase
RegisterUnaryStartupFlag("host_javabase");
@@ -343,6 +345,10 @@ blaze_exit_code::ExitCode StartupOptions::ProcessArg(
return blaze_exit_code::BAD_ARGV;
}
option_sources["connect_timeout_secs"] = rcfile;
+ } else if ((value = GetUnaryOption(arg, next_arg, "--digest_function")) !=
+ NULL) {
+ digest_function = value;
+ option_sources["digest_function"] = rcfile;
} else if ((value = GetUnaryOption(arg, next_arg, "--command_port")) !=
NULL) {
if (!blaze_util::safe_strto32(value, &command_port) ||
diff --git a/src/main/cpp/startup_options.h b/src/main/cpp/startup_options.h
index af9f276e24..cca38369c3 100644
--- a/src/main/cpp/startup_options.h
+++ b/src/main/cpp/startup_options.h
@@ -298,6 +298,9 @@ class StartupOptions {
bool expand_configs_in_place;
+ // The hash function to use when computing file digests.
+ std::string digest_function;
+
// The startup options as received from the user and rc files, tagged with
// their origin. This is populated by ProcessArgs.
std::vector<RcStartupFlag> original_startup_options_;