From 8739f2bb6e07321c4e92e5610f92785cae950ff7 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 5 Dec 2023 17:29:30 +0100 Subject: just serve: make tc write strategy configurable --- src/buildtool/main/serve.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/buildtool/main/serve.cpp') diff --git a/src/buildtool/main/serve.cpp b/src/buildtool/main/serve.cpp index 1c079032..32da7801 100644 --- a/src/buildtool/main/serve.cpp +++ b/src/buildtool/main/serve.cpp @@ -399,6 +399,27 @@ void ReadJustServeConfig(gsl::not_null const& clargs) { clargs->build.timeout = std::size_t(timeout->Number()) * std::chrono::seconds{1}; } + auto strategy = build_args->Get("target-cache write strategy", + Expression::none_t{}); + if (strategy.IsNotNull()) { + if (not strategy->IsString()) { + Logger::Log( + LogLevel::Error, + "just serve: configuration-file provided target-cache " + "write strategy has to be a string, but found {}", + strategy->ToString()); + std::exit(kExitFailure); + } + auto s_value = ToTargetCacheWriteStrategy(strategy->String()); + if (not s_value) { + Logger::Log(LogLevel::Error, + "just serve: configuration-file provided unknown " + "target-cache write strategy {}", + strategy->ToString()); + std::exit(kExitFailure); + } + clargs->tc.target_cache_write_strategy = *s_value; + } } } -- cgit v1.2.3