2016-09-23 14:28:50 +08:00
|
|
|
#pragma once
|
|
|
|
#include <vector>
|
2017-04-04 05:45:00 +08:00
|
|
|
#include "PackageSpec.h"
|
2016-09-23 14:28:50 +08:00
|
|
|
#include "StatusParagraphs.h"
|
|
|
|
#include "vcpkg_paths.h"
|
2017-01-31 08:14:48 +08:00
|
|
|
#include "vcpkg_optional.h"
|
2016-09-23 14:28:50 +08:00
|
|
|
|
2017-01-06 06:14:11 +08:00
|
|
|
namespace vcpkg::Dependencies
|
2016-09-23 14:28:50 +08:00
|
|
|
{
|
2017-04-04 07:21:46 +08:00
|
|
|
enum class RequestType
|
2017-01-31 05:57:43 +08:00
|
|
|
{
|
2017-01-31 09:52:53 +08:00
|
|
|
UNKNOWN,
|
2017-01-31 05:57:43 +08:00
|
|
|
USER_REQUESTED,
|
|
|
|
AUTO_SELECTED
|
|
|
|
};
|
|
|
|
|
2017-04-04 07:22:32 +08:00
|
|
|
enum class InstallPlanType
|
2016-11-16 03:56:46 +08:00
|
|
|
{
|
2017-01-31 09:52:53 +08:00
|
|
|
UNKNOWN,
|
2016-11-16 03:56:46 +08:00
|
|
|
BUILD_AND_INSTALL,
|
|
|
|
INSTALL,
|
|
|
|
ALREADY_INSTALLED
|
|
|
|
};
|
2016-09-23 14:28:50 +08:00
|
|
|
|
2017-04-04 07:22:51 +08:00
|
|
|
struct InstallPlanAction
|
2016-11-16 03:56:46 +08:00
|
|
|
{
|
2017-04-04 07:22:51 +08:00
|
|
|
InstallPlanAction();
|
|
|
|
InstallPlanAction(const InstallPlanType& plan_type, optional<BinaryParagraph> binary_pgh, optional<SourceParagraph> source_pgh);
|
|
|
|
InstallPlanAction(const InstallPlanAction&) = delete;
|
|
|
|
InstallPlanAction(InstallPlanAction&&) = default;
|
|
|
|
InstallPlanAction& operator=(const InstallPlanAction&) = delete;
|
|
|
|
InstallPlanAction& operator=(InstallPlanAction&&) = default;
|
2017-01-31 09:52:53 +08:00
|
|
|
|
2017-04-04 07:22:32 +08:00
|
|
|
InstallPlanType plan_type;
|
2017-01-31 08:14:48 +08:00
|
|
|
optional<BinaryParagraph> binary_pgh;
|
|
|
|
optional<SourceParagraph> source_pgh;
|
2016-11-16 03:56:46 +08:00
|
|
|
};
|
2016-11-08 08:38:49 +08:00
|
|
|
|
2017-04-04 07:23:23 +08:00
|
|
|
struct PackageSpecWithInstallPlan
|
2016-11-16 03:56:46 +08:00
|
|
|
{
|
2017-04-04 07:23:23 +08:00
|
|
|
PackageSpecWithInstallPlan(const PackageSpec& spec, InstallPlanAction&& plan);
|
2017-01-31 09:52:53 +08:00
|
|
|
|
2017-04-04 05:45:00 +08:00
|
|
|
PackageSpec spec;
|
2017-04-04 07:22:51 +08:00
|
|
|
InstallPlanAction plan;
|
2016-11-16 03:56:46 +08:00
|
|
|
};
|
|
|
|
|
2017-04-04 07:23:46 +08:00
|
|
|
enum class RemovePlanType
|
2017-01-27 06:25:36 +08:00
|
|
|
{
|
2017-01-31 09:52:53 +08:00
|
|
|
UNKNOWN,
|
2017-01-27 06:25:36 +08:00
|
|
|
NOT_INSTALLED,
|
2017-01-31 05:57:43 +08:00
|
|
|
REMOVE
|
2017-01-27 06:25:36 +08:00
|
|
|
};
|
|
|
|
|
2017-01-27 09:53:45 +08:00
|
|
|
struct remove_plan_action
|
|
|
|
{
|
2017-01-31 09:52:53 +08:00
|
|
|
remove_plan_action();
|
2017-04-04 07:23:46 +08:00
|
|
|
remove_plan_action(const RemovePlanType& plan_type, const RequestType& request_type);
|
2017-01-31 09:52:53 +08:00
|
|
|
remove_plan_action(const remove_plan_action&) = delete;
|
|
|
|
remove_plan_action(remove_plan_action&&) = default;
|
|
|
|
remove_plan_action& operator=(const remove_plan_action&) = delete;
|
|
|
|
remove_plan_action& operator=(remove_plan_action&&) = default;
|
|
|
|
|
|
|
|
|
2017-04-04 07:23:46 +08:00
|
|
|
RemovePlanType plan_type;
|
2017-04-04 07:21:46 +08:00
|
|
|
RequestType request_type;
|
2017-01-27 09:53:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct package_spec_with_remove_plan
|
|
|
|
{
|
2017-04-04 05:45:00 +08:00
|
|
|
package_spec_with_remove_plan(const PackageSpec& spec, remove_plan_action&& plan);
|
2017-01-31 09:52:53 +08:00
|
|
|
|
2017-04-04 05:45:00 +08:00
|
|
|
PackageSpec spec;
|
2017-01-27 09:53:45 +08:00
|
|
|
remove_plan_action plan;
|
|
|
|
};
|
2017-01-27 06:25:36 +08:00
|
|
|
|
2017-04-04 07:23:23 +08:00
|
|
|
std::vector<PackageSpecWithInstallPlan> create_install_plan(const vcpkg_paths& paths, const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
|
2017-01-27 09:53:45 +08:00
|
|
|
|
2017-04-04 05:45:00 +08:00
|
|
|
std::vector<package_spec_with_remove_plan> create_remove_plan(const std::vector<PackageSpec>& specs, const StatusParagraphs& status_db);
|
2017-01-06 06:14:11 +08:00
|
|
|
}
|