mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-18 11:43:02 +08:00
Find group_by_plan_type outside of print_plan()
This commit is contained in:
parent
989083caac
commit
6350eddd46
@ -14,13 +14,10 @@ namespace vcpkg::Commands::Export
|
|||||||
using Dependencies::RequestType;
|
using Dependencies::RequestType;
|
||||||
using Dependencies::ExportPlanType;
|
using Dependencies::ExportPlanType;
|
||||||
|
|
||||||
static void print_plan(const std::vector<ExportPlanAction>& plan)
|
static void print_plan(const std::map<ExportPlanType, std::vector<const ExportPlanAction*>>& group_by_plan_type)
|
||||||
{
|
{
|
||||||
static constexpr std::array<ExportPlanType, 2> order = { ExportPlanType::ALREADY_BUILT, ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT };
|
static constexpr std::array<ExportPlanType, 2> order = { ExportPlanType::ALREADY_BUILT, ExportPlanType::PORT_AVAILABLE_BUT_NOT_BUILT };
|
||||||
|
|
||||||
std::map<ExportPlanType, std::vector<const ExportPlanAction*>> group_by_plan_type;
|
|
||||||
Util::group_by(plan, &group_by_plan_type, [](const ExportPlanAction& p) { return p.plan_type; });
|
|
||||||
|
|
||||||
for (const ExportPlanType plan_type : order)
|
for (const ExportPlanType plan_type : order)
|
||||||
{
|
{
|
||||||
auto it = group_by_plan_type.find(plan_type);
|
auto it = group_by_plan_type.find(plan_type);
|
||||||
@ -72,7 +69,9 @@ namespace vcpkg::Commands::Export
|
|||||||
std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(paths, specs, status_db);
|
std::vector<ExportPlanAction> export_plan = Dependencies::create_export_plan(paths, specs, status_db);
|
||||||
Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty");
|
Checks::check_exit(VCPKG_LINE_INFO, !export_plan.empty(), "Export plan cannot be empty");
|
||||||
|
|
||||||
print_plan(export_plan);
|
std::map<ExportPlanType, std::vector<const ExportPlanAction*>> group_by_plan_type;
|
||||||
|
Util::group_by(export_plan, &group_by_plan_type, [](const ExportPlanAction& p) { return p.plan_type; });
|
||||||
|
print_plan(group_by_plan_type);
|
||||||
|
|
||||||
const bool has_non_user_requested_packages = std::find_if(export_plan.cbegin(), export_plan.cend(), [](const ExportPlanAction& package)-> bool
|
const bool has_non_user_requested_packages = std::find_if(export_plan.cbegin(), export_plan.cend(), [](const ExportPlanAction& package)-> bool
|
||||||
{
|
{
|
||||||
@ -93,7 +92,7 @@ namespace vcpkg::Commands::Export
|
|||||||
const fs::path output = paths.root / "exported";
|
const fs::path output = paths.root / "exported";
|
||||||
std::error_code ec;
|
std::error_code ec;
|
||||||
fs.remove_all(output, ec);
|
fs.remove_all(output, ec);
|
||||||
paths.get_filesystem().create_directory(output, ec);
|
fs.create_directory(output, ec);
|
||||||
|
|
||||||
// execute the plan
|
// execute the plan
|
||||||
for (const ExportPlanAction& action : export_plan)
|
for (const ExportPlanAction& action : export_plan)
|
||||||
|
@ -169,13 +169,10 @@ namespace vcpkg::Commands::Install
|
|||||||
return SortedVector<std::string>(std::move(installed_files));
|
return SortedVector<std::string>(std::move(installed_files));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_plan(const std::vector<InstallPlanAction>& plan)
|
static void print_plan(const std::map<InstallPlanType, std::vector<const InstallPlanAction*>>& group_by_plan_type)
|
||||||
{
|
{
|
||||||
static constexpr std::array<InstallPlanType, 3> order = { InstallPlanType::ALREADY_INSTALLED, InstallPlanType::BUILD_AND_INSTALL, InstallPlanType::INSTALL };
|
static constexpr std::array<InstallPlanType, 3> order = { InstallPlanType::ALREADY_INSTALLED, InstallPlanType::BUILD_AND_INSTALL, InstallPlanType::INSTALL };
|
||||||
|
|
||||||
std::map<InstallPlanType, std::vector<const InstallPlanAction*>> group_by_plan_type;
|
|
||||||
Util::group_by(plan, &group_by_plan_type, [](const InstallPlanAction& p) { return p.plan_type; });
|
|
||||||
|
|
||||||
for (const InstallPlanType plan_type : order)
|
for (const InstallPlanType plan_type : order)
|
||||||
{
|
{
|
||||||
auto it = group_by_plan_type.find(plan_type);
|
auto it = group_by_plan_type.find(plan_type);
|
||||||
@ -286,7 +283,9 @@ namespace vcpkg::Commands::Install
|
|||||||
const std::string specs_string = Strings::join(",", install_plan, [](const InstallPlanAction& plan) { return plan.spec.to_string(); });
|
const std::string specs_string = Strings::join(",", install_plan, [](const InstallPlanAction& plan) { return plan.spec.to_string(); });
|
||||||
Metrics::track_property("installplan", specs_string);
|
Metrics::track_property("installplan", specs_string);
|
||||||
|
|
||||||
print_plan(install_plan);
|
std::map<InstallPlanType, std::vector<const InstallPlanAction*>> group_by_plan_type;
|
||||||
|
Util::group_by(install_plan, &group_by_plan_type, [](const InstallPlanAction& p) { return p.plan_type; });
|
||||||
|
print_plan(group_by_plan_type);
|
||||||
|
|
||||||
const bool has_non_user_requested_packages = Util::find_if(install_plan, [](const InstallPlanAction& package)-> bool
|
const bool has_non_user_requested_packages = Util::find_if(install_plan, [](const InstallPlanAction& package)-> bool
|
||||||
{
|
{
|
||||||
|
@ -87,13 +87,10 @@ namespace vcpkg::Commands::Remove
|
|||||||
write_update(paths, pkg);
|
write_update(paths, pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_plan(const std::vector<RemovePlanAction>& plan)
|
static void print_plan(const std::map<RemovePlanType, std::vector<const RemovePlanAction*>>& group_by_plan_type)
|
||||||
{
|
{
|
||||||
static constexpr std::array<RemovePlanType, 2> order = { RemovePlanType::NOT_INSTALLED, RemovePlanType::REMOVE };
|
static constexpr std::array<RemovePlanType, 2> order = { RemovePlanType::NOT_INSTALLED, RemovePlanType::REMOVE };
|
||||||
|
|
||||||
std::map<RemovePlanType, std::vector<const RemovePlanAction*>> group_by_plan_type;
|
|
||||||
Util::group_by(plan, &group_by_plan_type, [](const RemovePlanAction& p) { return p.plan_type; });
|
|
||||||
|
|
||||||
for (const RemovePlanType plan_type : order)
|
for (const RemovePlanType plan_type : order)
|
||||||
{
|
{
|
||||||
auto it = group_by_plan_type.find(plan_type);
|
auto it = group_by_plan_type.find(plan_type);
|
||||||
@ -162,7 +159,9 @@ namespace vcpkg::Commands::Remove
|
|||||||
const std::vector<RemovePlanAction> remove_plan = Dependencies::create_remove_plan(specs, status_db);
|
const std::vector<RemovePlanAction> remove_plan = Dependencies::create_remove_plan(specs, status_db);
|
||||||
Checks::check_exit(VCPKG_LINE_INFO, !remove_plan.empty(), "Remove plan cannot be empty");
|
Checks::check_exit(VCPKG_LINE_INFO, !remove_plan.empty(), "Remove plan cannot be empty");
|
||||||
|
|
||||||
print_plan(remove_plan);
|
std::map<RemovePlanType, std::vector<const RemovePlanAction*>> group_by_plan_type;
|
||||||
|
Util::group_by(remove_plan, &group_by_plan_type, [](const RemovePlanAction& p) { return p.plan_type; });
|
||||||
|
print_plan(group_by_plan_type);
|
||||||
|
|
||||||
const bool has_non_user_requested_packages = Util::find_if(remove_plan, [](const RemovePlanAction& package)-> bool
|
const bool has_non_user_requested_packages = Util::find_if(remove_plan, [](const RemovePlanAction& package)-> bool
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user