summaryrefslogtreecommitdiff
path: root/src/other_tools/just_mr/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/other_tools/just_mr/main.cpp')
-rw-r--r--src/other_tools/just_mr/main.cpp37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp
index dfe705d2..bcc42bac 100644
--- a/src/other_tools/just_mr/main.cpp
+++ b/src/other_tools/just_mr/main.cpp
@@ -206,15 +206,14 @@ void SetupLogging(MultiRepoLogArguments const& clargs) {
}
}
-[[nodiscard]] auto CreateStorageConfig(
- MultiRepoCommonArguments const& args) noexcept
+[[nodiscard]] auto CreateStorageConfig(MultiRepoCommonArguments const& args,
+ HashFunction::Type hash_type) noexcept
-> std::optional<StorageConfig> {
StorageConfig::Builder builder;
if (args.just_mr_paths->root.has_value()) {
builder.SetBuildRoot(*args.just_mr_paths->root);
}
- // For now just-mr uses only the native storage.
- builder.SetHashType(HashFunction::Type::GitSHA1);
+ builder.SetHashType(hash_type);
// As just-mr does not require the TargetCache, we do not need to set any of
// the remote execution fields for the backend description.
@@ -317,9 +316,11 @@ auto main(int argc, char* argv[]) -> int {
arguments.common.explicit_distdirs.end());
// Setup LocalStorageConfig to store the local_build_root properly
- // and make the cas and git cache roots available
- auto const storage_config = CreateStorageConfig(arguments.common);
- if (not storage_config) {
+ // and make the cas and git cache roots available. A native storage is
+ // always instantiated, while a compatible one only if needed.
+ auto const native_storage_config =
+ CreateStorageConfig(arguments.common, HashFunction::Type::GitSHA1);
+ if (not native_storage_config) {
Logger::Log(LogLevel::Error,
"Failed to configure local build root.");
return kExitGenericFailure;
@@ -327,12 +328,12 @@ auto main(int argc, char* argv[]) -> int {
if (arguments.cmd == SubCommand::kGcRepo) {
return RepositoryGarbageCollector::TriggerGarbageCollection(
- *storage_config)
+ *native_storage_config)
? kExitSuccess
: kExitBuiltinCommandFailure;
}
- auto const storage = Storage::Create(&*storage_config);
+ auto const native_storage = Storage::Create(&*native_storage_config);
// check for conflicts in main repo name
if ((not arguments.setup.sub_all) and arguments.common.main and
@@ -379,17 +380,17 @@ auto main(int argc, char* argv[]) -> int {
arguments.auth,
arguments.retry,
arguments.launch_fwd,
- *storage_config,
- storage,
+ *native_storage_config,
+ native_storage,
forward_build_root,
my_name);
}
auto repo_lock =
- RepositoryGarbageCollector::SharedLock(*storage_config);
+ RepositoryGarbageCollector::SharedLock(*native_storage_config);
if (not repo_lock) {
return kExitGenericFailure;
}
- auto lock = GarbageCollector::SharedLock(*storage_config);
+ auto lock = GarbageCollector::SharedLock(*native_storage_config);
if (not lock) {
return kExitGenericFailure;
}
@@ -415,8 +416,8 @@ auto main(int argc, char* argv[]) -> int {
arguments.just_cmd,
arguments.auth,
arguments.retry,
- *storage_config,
- storage,
+ *native_storage_config,
+ native_storage,
/*interactive=*/(arguments.cmd == SubCommand::kSetupEnv),
my_name);
// dump resulting config to stdout
@@ -435,7 +436,7 @@ auto main(int argc, char* argv[]) -> int {
return MultiRepoUpdate(config,
arguments.common,
arguments.update,
- *storage_config,
+ *native_storage_config,
my_name);
}
@@ -464,8 +465,8 @@ auto main(int argc, char* argv[]) -> int {
arguments.fetch,
arguments.auth,
arguments.retry,
- *storage_config,
- storage,
+ *native_storage_config,
+ native_storage,
my_name);
}