diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-11-14 10:31:12 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-11-21 11:05:48 +0100 |
commit | 1e1feab4007702a201cec57b2257e60bec070a27 (patch) | |
tree | 1d4d2b2050da6785b66d253fe465abdb23dbd19b /src/buildtool/main/main.cpp | |
parent | 403a794cc7a7b5365b782f56d0d4c7e31e7a0d74 (diff) | |
download | justbuild-1e1feab4007702a201cec57b2257e60bec070a27.tar.gz |
Materialize computed roots before top-level analysis
Add a basic implementation of computed roots. So far we neither
enforce nor make good use of the fact that the underlying target
of a computed root has to be an export target of a content-fixed
repository; instead, we always install the root to a temporary
directory and pick it up from there. Still, the basic functionality
is there, and it is minimally useful.
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r-- | src/buildtool/main/main.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index d14c429c..b1e3dbad 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include <cmath> +#include <cstddef> #include <cstdlib> #include <exception> #include <filesystem> @@ -77,6 +79,7 @@ #include "fmt/core.h" #include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/common/remote/retry_config.hpp" +#include "src/buildtool/computed_roots/evaluate.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" #include "src/buildtool/execution_api/execution_service/server_implementation.hpp" #include "src/buildtool/execution_api/local/config.hpp" @@ -1003,11 +1006,14 @@ auto main(int argc, char* argv[]) -> int { .remote_context = &remote_context, .statistics = &stats, .progress = &progress}; + const GraphTraverser::CommandLineArguments traverse_args{ + jobs, + std::move(arguments.build), + std::move(stage_args), + std::move(rebuild_args)}; + GraphTraverser const traverser{ - {jobs, - std::move(arguments.build), - std::move(stage_args), - std::move(rebuild_args)}, + traverse_args, &exec_context, ProgressReporter::Reporter(&stats, &progress)}; @@ -1032,7 +1038,18 @@ auto main(int argc, char* argv[]) -> int { auto [main_repo, main_ws_root] = DetermineRoots(&repo_config, arguments.common, arguments.analysis); + std::size_t eval_root_jobs = + std::lround(std::ceil(std::sqrt(arguments.common.jobs))); #ifndef BOOTSTRAP_BUILD_TOOL + if (not EvaluateComputedRoots(&repo_config, + main_repo, + *storage_config, + traverse_args, + &exec_context, + eval_root_jobs)) { + return kExitFailure; + } + std::optional<ServeApi> serve = ServeApi::Create( *serve_config, &local_context, &remote_context, &main_apis); #else |