diff options
| author | Billy O'Neal <bion@microsoft.com> | 2020-05-27 18:40:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-27 18:40:23 -0700 |
| commit | d9b4acf02d8c784927f89d23edb677408ec428af (patch) | |
| tree | 305431cf6dcf02cf92ddf83ff3b071e4e49496d6 /toolsrc | |
| parent | 1982faa57b2206fd91e65a9976a67cd294f4918f (diff) | |
| download | vcpkg-d9b4acf02d8c784927f89d23edb677408ec428af.tar.gz vcpkg-d9b4acf02d8c784927f89d23edb677408ec428af.zip | |
[vcpkg] Move CI cleaning back out of the 'ci' command into a separate command to restore cross-compilation preinstalls. (#11545)
Diffstat (limited to 'toolsrc')
| -rw-r--r-- | toolsrc/include/vcpkg/commands.h | 5 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ci.cpp | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ciclean.cpp | 32 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.cpp | 1 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj | 1 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 3 |
6 files changed, 44 insertions, 8 deletions
diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h index 3ce182410..55d6bd7aa 100644 --- a/toolsrc/include/vcpkg/commands.h +++ b/toolsrc/include/vcpkg/commands.h @@ -27,6 +27,11 @@ namespace vcpkg::Commands void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, Triplet default_triplet); } + namespace CIClean + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + namespace Env { extern const CommandStructure COMMAND_STRUCTURE; diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 1e06be37d..336d30cf2 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -397,12 +397,6 @@ namespace vcpkg::Commands::CI const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); - auto& filesystem = paths.get_filesystem(); - if (filesystem.is_directory(paths.installed)) - { - filesystem.remove_all_inside(paths.installed, VCPKG_LINE_INFO); - } - std::set<std::string> exclusions_set; auto it_exclusions = options.settings.find(OPTION_EXCLUDE); if (it_exclusions != options.settings.end()) @@ -558,11 +552,11 @@ namespace vcpkg::Commands::CI System::print2("Total elapsed time: ", result.summary.total_elapsed_time, "\n"); result.summary.print(); } - auto& fs = paths.get_filesystem(); + auto it_xunit = options.settings.find(OPTION_XUNIT); if (it_xunit != options.settings.end()) { - fs.write_contents(fs::u8path(it_xunit->second), xunitTestResults.build_xml(), VCPKG_LINE_INFO); + paths.get_filesystem().write_contents(fs::u8path(it_xunit->second), xunitTestResults.build_xml(), VCPKG_LINE_INFO); } Checks::exit_success(VCPKG_LINE_INFO); diff --git a/toolsrc/src/vcpkg/commands.ciclean.cpp b/toolsrc/src/vcpkg/commands.ciclean.cpp new file mode 100644 index 000000000..9c69d1931 --- /dev/null +++ b/toolsrc/src/vcpkg/commands.ciclean.cpp @@ -0,0 +1,32 @@ +#include "pch.h"
+
+#include <vcpkg/base/checks.h>
+#include <vcpkg/base/files.h>
+#include <vcpkg/commands.h>
+#include <vcpkg/vcpkgcmdarguments.h>
+
+using namespace vcpkg;
+
+namespace vcpkg::Commands::CIClean
+{
+ void perform_and_exit(const VcpkgCmdArguments&, const VcpkgPaths& paths)
+ {
+ auto& fs = paths.get_filesystem();
+ if (fs.is_directory(paths.buildtrees))
+ {
+ fs.remove_all_inside(paths.buildtrees, VCPKG_LINE_INFO);
+ }
+
+ if (fs.is_directory(paths.installed))
+ {
+ fs.remove_all_inside(paths.installed, VCPKG_LINE_INFO);
+ }
+
+ if (fs.is_directory(paths.packages))
+ {
+ fs.remove_all_inside(paths.packages, VCPKG_LINE_INFO);
+ }
+
+ Checks::exit_success(VCPKG_LINE_INFO);
+ }
+}
diff --git a/toolsrc/src/vcpkg/commands.cpp b/toolsrc/src/vcpkg/commands.cpp index 0db6ddb8f..246f7dcdf 100644 --- a/toolsrc/src/vcpkg/commands.cpp +++ b/toolsrc/src/vcpkg/commands.cpp @@ -48,6 +48,7 @@ namespace vcpkg::Commands {"autocomplete", &Autocomplete::perform_and_exit}, {"hash", &Hash::perform_and_exit}, {"fetch", &Fetch::perform_and_exit}, + {"x-ci-clean", &CIClean::perform_and_exit}, {"x-history", &PortHistory::perform_and_exit}, {"x-vsinstances", &X_VSInstances::perform_and_exit}, }; diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 803ecb090..005b1c0dc 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -244,6 +244,7 @@ <ClCompile Include="..\src\vcpkg\commands.buildexternal.cpp" />
<ClCompile Include="..\src\vcpkg\commands.cache.cpp" />
<ClCompile Include="..\src\vcpkg\commands.ci.cpp" />
+ <ClCompile Include="..\src\vcpkg\commands.ciclean.cpp" />
<ClCompile Include="..\src\vcpkg\commands.contact.cpp" />
<ClCompile Include="..\src\vcpkg\commands.cpp" />
<ClCompile Include="..\src\vcpkg\commands.create.cpp" />
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index f0b8eb2e4..3b09b7ab1 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -48,6 +48,9 @@ <ClCompile Include="..\src\vcpkg\commands.ci.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vcpkg\commands.ciclean.cpp">
+ <Filter>Source Files\vcpkg</Filter>
+ </ClCompile>
<ClCompile Include="..\src\vcpkg\commands.contact.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
|
