diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-11-14 15:27:12 -0800 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-11-14 15:27:12 -0800 |
| commit | ca1aa816d2af1b600f68b1c965bed5bd180d829a (patch) | |
| tree | 17527fc633722391e9ad1357ea08e224e140144c /toolsrc/src | |
| parent | 5c9f0ff47324634a9796ed5d6cd7350cb06022c2 (diff) | |
| download | vcpkg-ca1aa816d2af1b600f68b1c965bed5bd180d829a.tar.gz vcpkg-ca1aa816d2af1b600f68b1c965bed5bd180d829a.zip | |
[vcpkg-ci] Clean up buildtrees during build to avoid consuming 200+ Gb of SSD
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ci.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 65adade1a..3c1c443f0 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -49,7 +49,7 @@ namespace vcpkg::Commands::CI return Dependencies::AnyAction(std::move(install_action)); }); - return Install::perform(action_plan, Install::KeepGoing::YES, paths, status_db); + return Install::perform(action_plan, Install::KeepGoing::YES, Install::CleanBuildtrees::YES, paths, status_db); } struct TripletAndSummary diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 20ffd3164..88ef5c73d 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -481,6 +481,7 @@ namespace vcpkg::Install InstallSummary perform(const std::vector<AnyAction>& action_plan, const KeepGoing keep_going, + const CleanBuildtrees clean_buildtrees, const VcpkgPaths& paths, StatusParagraphs& status_db) { @@ -504,6 +505,21 @@ namespace vcpkg::Install if (const auto install_action = action.install_plan.get()) { const BuildResult result = perform_install_plan_action(paths, *install_action, status_db); + if (clean_buildtrees == CleanBuildtrees::YES) + { + auto& fs = paths.get_filesystem(); + auto buildtrees_dir = paths.buildtrees / install_action->spec.name(); + auto buildtree_files = fs.get_files_non_recursive(buildtrees_dir); + for (auto&& file : buildtree_files) + { + if (fs.is_directory(file) && file.filename() != "src") + { + std::error_code ec; + fs.remove_all(file, ec); + } + } + } + if (result != BuildResult::SUCCEEDED && keep_going == KeepGoing::NO) { System::println(Build::create_user_troubleshooting_message(install_action->spec)); @@ -645,7 +661,7 @@ namespace vcpkg::Install Checks::exit_success(VCPKG_LINE_INFO); } - const InstallSummary summary = perform(action_plan, keep_going, paths, status_db); + const InstallSummary summary = perform(action_plan, keep_going, Install::CleanBuildtrees::NO, paths, status_db); System::println("\nTotal elapsed time: %s", summary.total_elapsed_time); |
