vcpkg/toolsrc/include/vcpkg_Dependencies.h

97 lines
3.0 KiB
C
Raw Normal View History

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