2016-09-22 23:28:50 -07:00
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
2017-04-03 14:45:00 -07:00
|
|
|
#include "PackageSpec.h"
|
2016-09-22 23:28:50 -07:00
|
|
|
#include "StatusParagraphs.h"
|
2017-04-03 16:29:11 -07:00
|
|
|
#include "VcpkgPaths.h"
|
2017-01-30 16:14:48 -08:00
|
|
|
#include "vcpkg_optional.h"
|
2017-04-11 19:37:38 -07:00
|
|
|
#include "Paragraphs.h"
|
2016-09-22 23:28:50 -07:00
|
|
|
|
2017-01-05 14:14:11 -08:00
|
|
|
namespace vcpkg::Dependencies
|
2016-09-22 23:28:50 -07:00
|
|
|
{
|
2017-04-11 19:37:38 -07:00
|
|
|
struct AnyParagraph
|
|
|
|
{
|
|
|
|
std::vector<PackageSpec> edges() const;
|
|
|
|
|
|
|
|
PackageSpec spec;
|
|
|
|
Optional<StatusParagraph> status_paragraph;
|
|
|
|
Optional<BinaryParagraph> binary_paragraph;
|
|
|
|
Optional<SourceParagraph> source_paragraph;
|
|
|
|
};
|
|
|
|
|
2017-04-03 16:21:46 -07:00
|
|
|
enum class RequestType
|
2017-01-30 13:57:43 -08:00
|
|
|
{
|
2017-01-30 17:52:53 -08:00
|
|
|
UNKNOWN,
|
2017-01-30 13:57:43 -08:00
|
|
|
USER_REQUESTED,
|
|
|
|
AUTO_SELECTED
|
|
|
|
};
|
|
|
|
|
2017-04-06 18:57:17 -07:00
|
|
|
std::string to_output_string(RequestType request_type, const CStringView s);
|
|
|
|
|
2017-04-03 16:22:32 -07:00
|
|
|
enum class InstallPlanType
|
2016-11-15 11:56:46 -08:00
|
|
|
{
|
2017-01-30 17:52:53 -08:00
|
|
|
UNKNOWN,
|
2016-11-15 11:56:46 -08:00
|
|
|
BUILD_AND_INSTALL,
|
|
|
|
INSTALL,
|
|
|
|
ALREADY_INSTALLED
|
|
|
|
};
|
2016-09-22 23:28:50 -07:00
|
|
|
|
2017-04-03 16:22:51 -07:00
|
|
|
struct InstallPlanAction
|
2016-11-15 11:56:46 -08:00
|
|
|
{
|
2017-04-03 16:22:51 -07:00
|
|
|
InstallPlanAction();
|
2017-04-11 19:37:38 -07:00
|
|
|
explicit InstallPlanAction(const AnyParagraph& any_paragraph, const RequestType& request_type);
|
2017-04-07 13:03:11 -07:00
|
|
|
InstallPlanAction(const InstallPlanType& plan_type, const RequestType& request_type, Optional<BinaryParagraph> binary_pgh, Optional<SourceParagraph> source_pgh);
|
2017-04-03 16:22:51 -07:00
|
|
|
InstallPlanAction(const InstallPlanAction&) = delete;
|
|
|
|
InstallPlanAction(InstallPlanAction&&) = default;
|
|
|
|
InstallPlanAction& operator=(const InstallPlanAction&) = delete;
|
|
|
|
InstallPlanAction& operator=(InstallPlanAction&&) = default;
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-03 16:22:32 -07:00
|
|
|
InstallPlanType plan_type;
|
2017-04-07 13:03:11 -07:00
|
|
|
RequestType request_type;
|
2017-04-03 16:27:51 -07:00
|
|
|
Optional<BinaryParagraph> binary_pgh;
|
|
|
|
Optional<SourceParagraph> source_pgh;
|
2016-11-15 11:56:46 -08:00
|
|
|
};
|
2016-11-07 16:38:49 -08:00
|
|
|
|
2017-04-03 16:23:23 -07:00
|
|
|
struct PackageSpecWithInstallPlan
|
2016-11-15 11:56:46 -08:00
|
|
|
{
|
2017-04-07 13:02:50 -07:00
|
|
|
static bool compare_by_name(const PackageSpecWithInstallPlan* left, const PackageSpecWithInstallPlan* right);
|
|
|
|
|
2017-04-03 16:23:23 -07:00
|
|
|
PackageSpecWithInstallPlan(const PackageSpec& spec, InstallPlanAction&& plan);
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-03 14:45:00 -07:00
|
|
|
PackageSpec spec;
|
2017-04-03 16:22:51 -07:00
|
|
|
InstallPlanAction plan;
|
2016-11-15 11:56:46 -08:00
|
|
|
};
|
|
|
|
|
2017-04-03 16:23:46 -07:00
|
|
|
enum class RemovePlanType
|
2017-01-26 14:25:36 -08:00
|
|
|
{
|
2017-01-30 17:52:53 -08:00
|
|
|
UNKNOWN,
|
2017-01-26 14:25:36 -08:00
|
|
|
NOT_INSTALLED,
|
2017-01-30 13:57:43 -08:00
|
|
|
REMOVE
|
2017-01-26 14:25:36 -08:00
|
|
|
};
|
|
|
|
|
2017-04-03 16:24:18 -07:00
|
|
|
struct RemovePlanAction
|
2017-01-26 17:53:45 -08:00
|
|
|
{
|
2017-04-03 16:24:18 -07:00
|
|
|
RemovePlanAction();
|
|
|
|
RemovePlanAction(const RemovePlanType& plan_type, const RequestType& request_type);
|
|
|
|
RemovePlanAction(const RemovePlanAction&) = delete;
|
|
|
|
RemovePlanAction(RemovePlanAction&&) = default;
|
|
|
|
RemovePlanAction& operator=(const RemovePlanAction&) = delete;
|
|
|
|
RemovePlanAction& operator=(RemovePlanAction&&) = default;
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-03 16:23:46 -07:00
|
|
|
RemovePlanType plan_type;
|
2017-04-03 16:21:46 -07:00
|
|
|
RequestType request_type;
|
2017-01-26 17:53:45 -08:00
|
|
|
};
|
|
|
|
|
2017-04-03 16:24:44 -07:00
|
|
|
struct PackageSpecWithRemovePlan
|
2017-01-26 17:53:45 -08:00
|
|
|
{
|
2017-04-06 17:37:19 -07:00
|
|
|
static bool compare_by_name(const PackageSpecWithRemovePlan* left, const PackageSpecWithRemovePlan* right);
|
|
|
|
|
2017-04-03 16:24:44 -07:00
|
|
|
PackageSpecWithRemovePlan(const PackageSpec& spec, RemovePlanAction&& plan);
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-03 14:45:00 -07:00
|
|
|
PackageSpec spec;
|
2017-04-03 16:24:18 -07:00
|
|
|
RemovePlanAction plan;
|
2017-01-26 17:53:45 -08:00
|
|
|
};
|
2017-01-26 14:25:36 -08:00
|
|
|
|
2017-04-03 16:29:11 -07:00
|
|
|
std::vector<PackageSpecWithInstallPlan> create_install_plan(const VcpkgPaths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
|
2017-01-26 17:53:45 -08:00
|
|
|
|
2017-04-03 16:24:44 -07:00
|
|
|
std::vector<PackageSpecWithRemovePlan> create_remove_plan(const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
|
2017-01-05 14:14:11 -08:00
|
|
|
}
|