diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-12-13 12:34:27 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-12-14 17:08:51 +0100 |
commit | f4b43e21b238e383b171fcd520806d77cffa24dc (patch) | |
tree | 472805a21748e77a440d5056473d171a1bcba66d | |
parent | a08dbdcf39cd2824527d153f490514087b70d1c8 (diff) | |
download | justbuild-f4b43e21b238e383b171fcd520806d77cffa24dc.tar.gz |
target_map: Remove unneeded method to perform endpoint consistency check
As we already have a good enough API call and in order to improve
specificity in log messages, there is no need for one more level of
abstraction. This will also make it easier to drop in the future
this check (if deemed unnecessary anymore), while keeping in place
the mandatory check that a serve endpoint has been configured.
-rw-r--r-- | src/buildtool/build_engine/target_map/target_map.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp index 805a0d50..ebb07a91 100644 --- a/src/buildtool/build_engine/target_map/target_map.cpp +++ b/src/buildtool/build_engine/target_map/target_map.cpp @@ -1633,21 +1633,6 @@ void GlobTargetWithDirEntry( }); } -#ifndef BOOTSTRAP_BUILD_TOOL -// The remote execution endpoint specified on the command line must be the same -// used by the provided just serve instance. -[[nodiscard]] auto CheckServeAndExecutionEndpoints() -> bool { - auto sadd = RemoteServeConfig::RemoteAddress(); - if (!sadd) { - Logger::Log(LogLevel::Error, - "Absent root detected. Please provide " - "--remote-serve-address and retry."); - return false; - } - return ServeApi::CheckServeRemoteExecution(); -} -#endif // BOOTSTRAP_BUILD_TOOL - } // namespace namespace BuildMaps::Target { @@ -1769,13 +1754,20 @@ auto CreateTargetMap( #ifndef BOOTSTRAP_BUILD_TOOL else if (repo_config->TargetRoot(key.target.ToModule().repository) ->IsAbsent()) { - static auto consistent_serve_and_remote_execution = - CheckServeAndExecutionEndpoints(); - if (!consistent_serve_and_remote_execution) { + if (not RemoteServeConfig::RemoteAddress()) { + (*logger)( + fmt::format("Root for target {} is absent, but no serve " + "endpoint was configured. Please provide " + "--remote-serve=address and retry.", + key.target.ToJson().dump()), + /*is_fatal=*/true); + return; + } + if (not ServeApi::CheckServeRemoteExecution()) { (*logger)( "Inconsistent remote execution endpoint and just serve " "configuration detected.", - true); + /*is_fatal=*/true); return; } absent_target_map->ConsumeAfterKeysReady( |