From a7462a787fc45bee5e8010686333d1edbf7f3963 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 5 Jul 2022 16:13:59 +0200 Subject: Remove option --persistent ... as the --request-action-input option provides a clean way of restoring the inputs to a specific action, without the need of interacting with the internal directory structure of the tool. In particular, the new option also works for remote builds. --- src/buildtool/common/cli.hpp | 5 ----- src/buildtool/execution_api/local/config.hpp | 13 ------------- src/buildtool/execution_api/local/local_action.cpp | 3 +-- src/buildtool/main/main.cpp | 3 +-- 4 files changed, 2 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 4d5df1bf..e677924c 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -70,7 +70,6 @@ struct BuildArguments { std::size_t build_jobs{}; std::optional dump_artifacts{std::nullopt}; std::optional print_to_stdout{std::nullopt}; - bool persistent_build_dir{false}; bool show_runfiles{false}; }; @@ -260,10 +259,6 @@ static inline auto SetupEndpointArguments( static inline auto SetupBuildArguments( gsl::not_null const& app, gsl::not_null const& clargs) { - app->add_flag("-p,--persistent", - clargs->persistent_build_dir, - "Do not clean build directory after execution."); - app->add_option_function( "-L,--local-launcher", [clargs](auto const& launcher_raw) { diff --git a/src/buildtool/execution_api/local/config.hpp b/src/buildtool/execution_api/local/config.hpp index 5ce8b9ef..71a4941e 100644 --- a/src/buildtool/execution_api/local/config.hpp +++ b/src/buildtool/execution_api/local/config.hpp @@ -37,9 +37,6 @@ class LocalExecutionConfig { // Launcher to be prepended to action's command before executed. // Default: ["env", "--"] std::vector launcher{"env", "--"}; - - // Persistent build directory option - bool keep_build_dir{false}; }; // different folder for different caching protocol @@ -77,12 +74,6 @@ class LocalExecutionConfig { return true; } - [[nodiscard]] static auto SetKeepBuildDir(bool is_persistent) noexcept - -> bool { - Data().keep_build_dir = is_persistent; - return true; - } - /// \brief User directory. [[nodiscard]] static auto GetUserDir() noexcept -> std::filesystem::path { return GetUserHome() / ".cache" / "just"; @@ -134,10 +125,6 @@ class LocalExecutionConfig { return Data().launcher; } - [[nodiscard]] static auto KeepBuildDir() noexcept -> bool { - return Data().keep_build_dir; - } - private: [[nodiscard]] static auto Data() noexcept -> ConfigData& { static ConfigData instance{}; diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index 74f90258..3ccc58eb 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -22,8 +22,7 @@ class BuildCleanupAnchor { auto operator=(BuildCleanupAnchor const&) -> BuildCleanupAnchor& = delete; auto operator=(BuildCleanupAnchor&&) -> BuildCleanupAnchor& = delete; ~BuildCleanupAnchor() { - if (not LocalExecutionConfig::KeepBuildDir() and - not FileSystemManager::RemoveDirectory(build_path, true)) { + if (not FileSystemManager::RemoveDirectory(build_path, true)) { Logger::Log(LogLevel::Error, "Could not cleanup build directory {}", build_path.string()); diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index dbb6fcf1..6d7be359 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -222,8 +222,7 @@ void SetupExecutionConfig(EndpointArguments const& eargs, RebuildArguments const& rargs) { using LocalConfig = LocalExecutionConfig; using RemoteConfig = RemoteExecutionConfig; - if (not LocalConfig::SetKeepBuildDir(bargs.persistent_build_dir) or - not(not eargs.local_root or + if (not(not eargs.local_root or (LocalConfig::SetBuildRoot(*eargs.local_root))) or not(not bargs.local_launcher or LocalConfig::SetLauncher(*bargs.local_launcher))) { -- cgit v1.2.3