2016-09-22 23:28:50 -07:00
|
|
|
#pragma once
|
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-07-12 17:40:41 -07:00
|
|
|
#include "vcpkg_Graphs.h"
|
2017-08-21 20:06:47 -07:00
|
|
|
#include "vcpkg_Util.h"
|
2017-01-30 16:14:48 -08:00
|
|
|
#include "vcpkg_optional.h"
|
2017-04-27 17:56:06 -07:00
|
|
|
#include <vector>
|
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-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-12 21:37:55 -07:00
|
|
|
struct AnyParagraph
|
|
|
|
{
|
|
|
|
std::vector<PackageSpec> dependencies(const Triplet& triplet) const;
|
|
|
|
|
|
|
|
Optional<StatusParagraph> status_paragraph;
|
2017-08-23 15:47:42 -07:00
|
|
|
Optional<BinaryControlFile> binary_control_file;
|
2017-04-12 21:37:55 -07:00
|
|
|
Optional<SourceParagraph> source_paragraph;
|
2017-07-12 17:40:41 -07:00
|
|
|
Optional<const SourceControlFile*> source_control_file;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace vcpkg::Dependencies
|
|
|
|
{
|
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-08-21 20:06:47 -07:00
|
|
|
struct InstallPlanAction : Util::MoveOnlyBase
|
2016-11-15 11:56:46 -08:00
|
|
|
{
|
2017-04-12 21:28:49 -07:00
|
|
|
static bool compare_by_name(const InstallPlanAction* left, const InstallPlanAction* right);
|
|
|
|
|
2017-04-03 16:22:51 -07:00
|
|
|
InstallPlanAction();
|
2017-08-21 20:06:47 -07:00
|
|
|
|
2017-08-28 14:42:44 -07:00
|
|
|
InstallPlanAction(const PackageSpec& spec,
|
|
|
|
const std::unordered_set<std::string>& features,
|
|
|
|
const RequestType& request_type);
|
2017-04-13 17:19:26 -07:00
|
|
|
InstallPlanAction(const PackageSpec& spec, const AnyParagraph& any_paragraph, const RequestType& request_type);
|
2017-07-12 17:40:41 -07:00
|
|
|
InstallPlanAction(const PackageSpec& spec,
|
|
|
|
const SourceControlFile& any_paragraph,
|
2017-07-19 14:19:11 -07:00
|
|
|
const std::unordered_set<std::string>& features,
|
2017-07-12 17:40:41 -07:00
|
|
|
const RequestType& request_type);
|
2017-08-21 20:06:47 -07:00
|
|
|
|
2017-07-25 21:29:31 -07:00
|
|
|
std::string displayname() const;
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-12 21:28:49 -07:00
|
|
|
PackageSpec spec;
|
|
|
|
AnyParagraph any_paragraph;
|
2017-04-03 16:22:32 -07:00
|
|
|
InstallPlanType plan_type;
|
2017-04-07 13:03:11 -07:00
|
|
|
RequestType request_type;
|
2017-07-12 17:40:41 -07:00
|
|
|
std::unordered_set<std::string> feature_list;
|
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-08-22 15:14:15 -07:00
|
|
|
struct RemovePlanAction : Util::MoveOnlyBase
|
2017-01-26 17:53:45 -08:00
|
|
|
{
|
2017-04-12 21:37:55 -07:00
|
|
|
static bool compare_by_name(const RemovePlanAction* left, const RemovePlanAction* right);
|
|
|
|
|
2017-04-03 16:24:18 -07:00
|
|
|
RemovePlanAction();
|
2017-04-12 21:37:55 -07:00
|
|
|
RemovePlanAction(const PackageSpec& spec, const RemovePlanType& plan_type, const RequestType& request_type);
|
2017-01-30 17:52:53 -08:00
|
|
|
|
2017-04-12 21:37:55 -07:00
|
|
|
PackageSpec spec;
|
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-07-12 17:40:41 -07:00
|
|
|
struct AnyAction
|
|
|
|
{
|
2017-08-21 17:16:14 -07:00
|
|
|
AnyAction(InstallPlanAction&& iplan) : install_plan(std::move(iplan)) {}
|
|
|
|
AnyAction(RemovePlanAction&& rplan) : remove_plan(std::move(rplan)) {}
|
|
|
|
|
2017-07-12 17:40:41 -07:00
|
|
|
Optional<InstallPlanAction> install_plan;
|
|
|
|
Optional<RemovePlanAction> remove_plan;
|
2017-09-13 17:23:04 -07:00
|
|
|
|
|
|
|
const PackageSpec& spec() const;
|
2017-07-12 17:40:41 -07:00
|
|
|
};
|
|
|
|
|
2017-04-10 12:57:49 -07:00
|
|
|
enum class ExportPlanType
|
|
|
|
{
|
|
|
|
UNKNOWN,
|
|
|
|
PORT_AVAILABLE_BUT_NOT_BUILT,
|
|
|
|
ALREADY_BUILT
|
|
|
|
};
|
|
|
|
|
2017-08-22 15:14:15 -07:00
|
|
|
struct ExportPlanAction : Util::MoveOnlyBase
|
2017-04-10 12:57:49 -07:00
|
|
|
{
|
|
|
|
static bool compare_by_name(const ExportPlanAction* left, const ExportPlanAction* right);
|
|
|
|
|
|
|
|
ExportPlanAction();
|
|
|
|
ExportPlanAction(const PackageSpec& spec, const AnyParagraph& any_paragraph, const RequestType& request_type);
|
|
|
|
|
|
|
|
PackageSpec spec;
|
|
|
|
AnyParagraph any_paragraph;
|
|
|
|
ExportPlanType plan_type;
|
|
|
|
RequestType request_type;
|
|
|
|
};
|
|
|
|
|
2017-08-21 17:16:14 -07:00
|
|
|
__interface PortFileProvider { virtual const SourceControlFile& get_control_file(const std::string& spec) const; };
|
2017-06-26 13:48:04 -07:00
|
|
|
|
2017-08-22 15:14:15 -07:00
|
|
|
struct MapPortFile : Util::ResourceBase, PortFileProvider
|
2017-06-26 13:48:04 -07:00
|
|
|
{
|
2017-08-21 17:16:14 -07:00
|
|
|
const std::unordered_map<std::string, SourceControlFile>& ports;
|
|
|
|
explicit MapPortFile(const std::unordered_map<std::string, SourceControlFile>& map);
|
|
|
|
const SourceControlFile& get_control_file(const std::string& spec) const override;
|
2017-06-26 13:48:04 -07:00
|
|
|
};
|
|
|
|
|
2017-08-22 15:14:15 -07:00
|
|
|
struct PathsPortFile : Util::ResourceBase, PortFileProvider
|
2017-06-26 13:48:04 -07:00
|
|
|
{
|
|
|
|
const VcpkgPaths& ports;
|
2017-08-21 17:16:14 -07:00
|
|
|
mutable std::unordered_map<std::string, SourceControlFile> cache;
|
2017-06-26 13:48:04 -07:00
|
|
|
explicit PathsPortFile(const VcpkgPaths& paths);
|
2017-08-21 17:16:14 -07:00
|
|
|
const SourceControlFile& get_control_file(const std::string& spec) const override;
|
2017-06-26 13:48:04 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
std::vector<InstallPlanAction> create_install_plan(const PortFileProvider& port_file_provider,
|
2017-04-27 17:56:06 -07:00
|
|
|
const std::vector<PackageSpec>& specs,
|
|
|
|
const StatusParagraphs& status_db);
|
2017-01-26 17:53:45 -08:00
|
|
|
|
2017-04-27 17:56:06 -07:00
|
|
|
std::vector<RemovePlanAction> create_remove_plan(const std::vector<PackageSpec>& specs,
|
|
|
|
const StatusParagraphs& status_db);
|
2017-04-10 12:57:49 -07:00
|
|
|
|
2017-04-27 17:56:06 -07:00
|
|
|
std::vector<ExportPlanAction> create_export_plan(const VcpkgPaths& paths,
|
|
|
|
const std::vector<PackageSpec>& specs,
|
|
|
|
const StatusParagraphs& status_db);
|
2017-07-12 17:40:41 -07:00
|
|
|
|
2017-08-21 17:16:14 -07:00
|
|
|
std::vector<AnyAction> create_feature_install_plan(const std::unordered_map<std::string, SourceControlFile>& map,
|
2017-08-20 19:09:39 -07:00
|
|
|
const std::vector<FeatureSpec>& specs,
|
2017-07-12 17:40:41 -07:00
|
|
|
const StatusParagraphs& status_db);
|
|
|
|
}
|