diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2025-06-23 12:09:21 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2025-06-24 12:56:57 +0200 |
commit | 95f230b3a755f66183ce5c27e929ed6ae3838977 (patch) | |
tree | b84ced1cbb6ba97984780434eaf525d843a67bba | |
parent | c49f9e8a16997d7dc4cad691a249741146101be0 (diff) | |
download | justbuild-95f230b3a755f66183ce5c27e929ed6ae3838977.tar.gz |
ExecutionApi: Drop DirectorySymlinks from common api
... as it is only needed for local execution, there is no
need to provide it in the common api interface.
7 files changed, 15 insertions, 25 deletions
diff --git a/src/buildtool/execution_api/common/execution_response.hpp b/src/buildtool/execution_api/common/execution_response.hpp index 65fd0ba9..552e52a6 100644 --- a/src/buildtool/execution_api/common/execution_response.hpp +++ b/src/buildtool/execution_api/common/execution_response.hpp @@ -75,8 +75,6 @@ class IExecutionResponse { [[nodiscard]] virtual auto Artifacts() noexcept -> expected<gsl::not_null<ArtifactInfos const*>, std::string> = 0; - [[nodiscard]] virtual auto DirectorySymlinks() noexcept - -> expected<gsl::not_null<DirSymlinks const*>, std::string> = 0; [[nodiscard]] virtual auto HasUpwardsSymlinks() noexcept -> expected<bool, std::string> = 0; }; diff --git a/src/buildtool/execution_api/local/local_response.hpp b/src/buildtool/execution_api/local/local_response.hpp index f5ed3e94..7f50b2fc 100644 --- a/src/buildtool/execution_api/local/local_response.hpp +++ b/src/buildtool/execution_api/local/local_response.hpp @@ -112,7 +112,7 @@ class LocalResponse final : public IExecutionResponse { } auto DirectorySymlinks() noexcept - -> expected<gsl::not_null<DirSymlinks const*>, std::string> final { + -> expected<gsl::not_null<DirSymlinks const*>, std::string> { if (auto error_msg = Populate()) { return unexpected{*std::move(error_msg)}; } diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp index e11a3b7f..5d826a1b 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.cpp @@ -88,15 +88,6 @@ auto BazelResponse::Artifacts() noexcept &artifacts_); // explicit type needed for expected } -auto BazelResponse::DirectorySymlinks() noexcept - -> expected<gsl::not_null<DirSymlinks const*>, std::string> { - if (auto error_msg = Populate()) { - return unexpected{*std::move(error_msg)}; - } - return gsl::not_null<DirSymlinks const*>( - &dir_symlinks_); // explicit type needed for expected -} - auto BazelResponse::HasUpwardsSymlinks() noexcept -> expected<bool, std::string> { if (auto error_msg = Populate()) { diff --git a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp index 55f45236..8504ae59 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_response.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_response.hpp @@ -89,8 +89,6 @@ class BazelResponse final : public IExecutionResponse { auto Artifacts() noexcept -> expected<gsl::not_null<ArtifactInfos const*>, std::string> final; - auto DirectorySymlinks() noexcept - -> expected<gsl::not_null<DirSymlinks const*>, std::string> final; auto HasUpwardsSymlinks() noexcept -> expected<bool, std::string> final; private: diff --git a/test/buildtool/execution_api/common/TARGETS b/test/buildtool/execution_api/common/TARGETS index 96750753..e47ac9fa 100644 --- a/test/buildtool/execution_api/common/TARGETS +++ b/test/buildtool/execution_api/common/TARGETS @@ -13,6 +13,7 @@ , ["@", "src", "src/buildtool/crypto", "hash_function"] , ["@", "src", "src/buildtool/execution_api/common", "common"] , ["@", "src", "src/buildtool/execution_api/local", "config"] + , ["@", "src", "src/buildtool/execution_api/local", "local_api"] , ["@", "src", "src/buildtool/execution_engine/dag", "dag"] , ["@", "src", "src/buildtool/file_system", "file_system_manager"] , ["@", "src", "src/buildtool/file_system", "object_type"] diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp index 6ff56308..34fbb29a 100644 --- a/test/buildtool/execution_api/common/api_test.hpp +++ b/test/buildtool/execution_api/common/api_test.hpp @@ -42,6 +42,7 @@ #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_api/common/execution_response.hpp" #include "src/buildtool/execution_api/local/config.hpp" +#include "src/buildtool/execution_api/local/local_response.hpp" #include "src/buildtool/execution_engine/dag/dag.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -763,9 +764,12 @@ TestRetrieveFileAndSymlinkWithSameContentToPath(ApiFactory const& api_factory, CHECK(IsTreeObject(artifacts.value()->at("baz").type)); // check if bar was correctly detected as directory symlink - auto dir_symlinks = response->DirectorySymlinks(); - REQUIRE(dir_symlinks); - CHECK((*dir_symlinks)->contains("bar")); + auto* local_response = dynamic_cast<LocalResponse*>(response.get()); + if (local_response != nullptr) { + auto dir_symlinks = local_response->DirectorySymlinks(); + REQUIRE(dir_symlinks); + CHECK((*dir_symlinks)->contains("bar")); + } SECTION("consuming dangling symlinks") { auto dangling_symlinks_tree = artifacts.value()->at("baz"); @@ -826,9 +830,12 @@ TestRetrieveFileAndSymlinkWithSameContentToPath(ApiFactory const& api_factory, CHECK(IsTreeObject(artifacts.value()->at("baz").type)); // check if bar was correctly detected as directory symlink - auto dir_symlinks = response->DirectorySymlinks(); - REQUIRE(dir_symlinks); - CHECK((*dir_symlinks)->contains("bar")); + auto* local_response = dynamic_cast<LocalResponse*>(response.get()); + if (local_response != nullptr) { + auto dir_symlinks = local_response->DirectorySymlinks(); + REQUIRE(dir_symlinks); + CHECK((*dir_symlinks)->contains("bar")); + } SECTION("consuming upwards symlinks") { auto upwards_symlinks_tree = artifacts.value()->at("baz"); diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index cba6c977..0db5501a 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -134,11 +134,6 @@ class TestResponse : public IExecutionResponse { } return gsl::not_null<ArtifactInfos const*>(&artifacts_); } - [[nodiscard]] auto DirectorySymlinks() noexcept - -> expected<gsl::not_null<DirSymlinks const*>, std::string> final { - static const DirSymlinks kEmptySymlinks{}; - return gsl::not_null<DirSymlinks const*>(&kEmptySymlinks); - } [[nodiscard]] auto HasUpwardsSymlinks() noexcept -> expected<bool, std::string> final { return false; |