mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 03:03:05 +08:00
Place command_cache in a separate cpp file
This commit is contained in:
parent
f03590eeb7
commit
03b43aad42
39
toolsrc/src/commands_cache.cpp
Normal file
39
toolsrc/src/commands_cache.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#include "vcpkg_Commands.h"
|
||||||
|
#include "vcpkg_System.h"
|
||||||
|
#include "vcpkg_Files.h"
|
||||||
|
#include "vcpkg.h"
|
||||||
|
|
||||||
|
namespace vcpkg
|
||||||
|
{
|
||||||
|
void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
|
||||||
|
{
|
||||||
|
args.check_max_args(0);
|
||||||
|
|
||||||
|
auto begin_it = fs::directory_iterator(paths.packages);
|
||||||
|
auto end_it = fs::directory_iterator();
|
||||||
|
|
||||||
|
if (begin_it == end_it)
|
||||||
|
{
|
||||||
|
System::println("No packages are cached.");
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; begin_it != end_it; ++begin_it)
|
||||||
|
{
|
||||||
|
const auto& path = begin_it->path();
|
||||||
|
|
||||||
|
auto file_contents = Files::get_contents(path / "CONTROL");
|
||||||
|
if (auto text = file_contents.get())
|
||||||
|
{
|
||||||
|
auto pghs = parse_paragraphs(*text);
|
||||||
|
if (pghs.size() != 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
auto src = BinaryParagraph(pghs[0]);
|
||||||
|
System::println(src.displayname().c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
@ -109,38 +109,6 @@ namespace vcpkg
|
|||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
|
|
||||||
{
|
|
||||||
args.check_max_args(0);
|
|
||||||
|
|
||||||
auto begin_it = fs::directory_iterator(paths.packages);
|
|
||||||
auto end_it = fs::directory_iterator();
|
|
||||||
|
|
||||||
if (begin_it == end_it)
|
|
||||||
{
|
|
||||||
System::println("No packages are cached.");
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; begin_it != end_it; ++begin_it)
|
|
||||||
{
|
|
||||||
const auto& path = begin_it->path();
|
|
||||||
|
|
||||||
auto file_contents = Files::get_contents(path / "CONTROL");
|
|
||||||
if (auto text = file_contents.get())
|
|
||||||
{
|
|
||||||
auto pghs = parse_paragraphs(*text);
|
|
||||||
if (pghs.size() != 1)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
auto src = BinaryParagraph(pghs[0]);
|
|
||||||
System::println(src.displayname().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit(EXIT_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
|
void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
|
||||||
{
|
{
|
||||||
std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet);
|
std::vector<package_spec> specs = args.parse_all_arguments_as_package_specs(default_target_triplet);
|
||||||
|
@ -128,6 +128,7 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\src\commands_cache.cpp" />
|
||||||
<ClCompile Include="..\src\commands_remove.cpp" />
|
<ClCompile Include="..\src\commands_remove.cpp" />
|
||||||
<ClCompile Include="..\src\commands_search.cpp" />
|
<ClCompile Include="..\src\commands_search.cpp" />
|
||||||
<ClCompile Include="..\src\vcpkg_cmd_arguments.cpp" />
|
<ClCompile Include="..\src\vcpkg_cmd_arguments.cpp" />
|
||||||
|
@ -45,6 +45,9 @@
|
|||||||
<ClCompile Include="..\src\commands_search.cpp">
|
<ClCompile Include="..\src\commands_search.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\src\commands_cache.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\include\post_build_lint.h">
|
<ClInclude Include="..\include\post_build_lint.h">
|
||||||
|
Loading…
Reference in New Issue
Block a user