diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-12-05 13:07:05 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-12-06 11:57:16 +0100 |
commit | ef2da9cbe1d55fd9667ad7fe42792ffd8ed0ec50 (patch) | |
tree | 1480f7e0b8a074ac307201aa50553aa20c757544 /src/buildtool/main/build_utils.cpp | |
parent | 4402929b8956561255754bc610734a84974e997f (diff) | |
download | justbuild-ef2da9cbe1d55fd9667ad7fe42792ffd8ed0ec50.tar.gz |
Add CLI option to set write strategy for target-level cache
Diffstat (limited to 'src/buildtool/main/build_utils.cpp')
-rw-r--r-- | src/buildtool/main/build_utils.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/buildtool/main/build_utils.cpp b/src/buildtool/main/build_utils.cpp index 46773ca2..50557b71 100644 --- a/src/buildtool/main/build_utils.cpp +++ b/src/buildtool/main/build_utils.cpp @@ -48,6 +48,20 @@ auto CollectNonKnownArtifacts( std::make_move_iterator(cache_artifacts.end())}; } +auto ToTargetCacheWriteStrategy(std::string const& strategy) + -> std::optional<TargetCacheWriteStrategy> { + if (strategy == "disable") { + return TargetCacheWriteStrategy::Disable; + } + if (strategy == "sync") { + return TargetCacheWriteStrategy::Sync; + } + if (strategy == "split") { + return TargetCacheWriteStrategy::Split; + } + return std::nullopt; +} + #ifndef BOOTSTRAP_BUILD_TOOL void WriteTargetCacheEntries( std::unordered_map<TargetCacheKey, AnalysedTargetPtr> const& cache_targets, |