2016-09-19 11:50:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
2017-08-20 10:27:34 +08:00
|
|
|
#include "PackageSpec.h"
|
2017-06-08 15:36:17 +08:00
|
|
|
#include "Span.h"
|
2017-06-17 17:39:14 +08:00
|
|
|
#include "vcpkg_Parse.h"
|
2017-06-07 07:08:36 +08:00
|
|
|
#include "vcpkg_System.h"
|
2017-06-06 06:58:47 +08:00
|
|
|
#include "vcpkg_expected.h"
|
2017-06-07 07:08:36 +08:00
|
|
|
|
|
|
|
#include <string>
|
2017-04-28 08:56:06 +08:00
|
|
|
#include <vector>
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
2017-07-26 12:29:31 +08:00
|
|
|
struct Dependency
|
|
|
|
{
|
|
|
|
Features depend;
|
2016-11-05 16:02:15 +08:00
|
|
|
std::string qualifier;
|
2017-07-26 12:29:31 +08:00
|
|
|
|
|
|
|
std::string name() const;
|
|
|
|
static Dependency parse_dependency(std::string name, std::string qualifier);
|
2016-11-05 16:02:15 +08:00
|
|
|
};
|
|
|
|
|
2017-08-21 10:36:43 +08:00
|
|
|
std::vector<std::string> filter_dependencies(const std::vector<Dependency>& deps, const Triplet& t);
|
|
|
|
std::vector<FeatureSpec> filter_dependencies_to_specs(const std::vector<Dependency>& deps, const Triplet& t);
|
|
|
|
|
|
|
|
// zlib[uwp] becomes Dependency{"zlib", "uwp"}
|
|
|
|
std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends);
|
|
|
|
|
2017-09-02 08:13:45 +08:00
|
|
|
std::string to_string(const Dependency& dep);
|
2016-11-05 16:02:15 +08:00
|
|
|
|
2017-06-20 06:06:15 +08:00
|
|
|
struct FeatureParagraph
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string description;
|
|
|
|
std::vector<Dependency> depends;
|
|
|
|
};
|
|
|
|
|
2017-05-25 06:54:12 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Port metadata (CONTROL file)
|
|
|
|
/// </summary>
|
2016-09-19 11:50:08 +08:00
|
|
|
struct SourceParagraph
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string version;
|
|
|
|
std::string description;
|
|
|
|
std::string maintainer;
|
2017-06-07 07:08:36 +08:00
|
|
|
std::vector<std::string> supports;
|
2017-04-04 06:12:42 +08:00
|
|
|
std::vector<Dependency> depends;
|
2017-06-17 17:39:14 +08:00
|
|
|
std::vector<std::string> default_features;
|
2016-09-19 11:50:08 +08:00
|
|
|
};
|
2017-06-20 06:06:15 +08:00
|
|
|
struct SourceControlFile
|
|
|
|
{
|
2017-06-17 17:39:14 +08:00
|
|
|
static Parse::ParseExpected<SourceControlFile> parse_control_file(
|
|
|
|
std::vector<Parse::RawParagraph>&& control_paragraphs);
|
2017-06-20 06:06:15 +08:00
|
|
|
|
2017-06-17 17:39:14 +08:00
|
|
|
std::unique_ptr<SourceParagraph> core_paragraph;
|
2017-06-20 06:06:15 +08:00
|
|
|
std::vector<std::unique_ptr<FeatureParagraph>> feature_paragraphs;
|
|
|
|
};
|
|
|
|
|
2017-06-17 17:39:14 +08:00
|
|
|
void print_error_message(span<const std::unique_ptr<Parse::ParseControlErrorInfo>> error_info_list);
|
|
|
|
inline void print_error_message(const std::unique_ptr<Parse::ParseControlErrorInfo>& error_info_list)
|
2017-06-08 15:36:17 +08:00
|
|
|
{
|
|
|
|
return print_error_message({&error_info_list, 1});
|
|
|
|
}
|
2017-06-06 06:58:47 +08:00
|
|
|
|
2017-06-07 07:08:36 +08:00
|
|
|
struct Supports
|
|
|
|
{
|
|
|
|
static ExpectedT<Supports, std::vector<std::string>> parse(const std::vector<std::string>& strs);
|
|
|
|
|
|
|
|
using Architecture = System::CPUArchitecture;
|
|
|
|
|
|
|
|
enum class Platform
|
|
|
|
{
|
|
|
|
WINDOWS,
|
|
|
|
UWP,
|
|
|
|
};
|
|
|
|
enum class Linkage
|
|
|
|
{
|
|
|
|
DYNAMIC,
|
|
|
|
STATIC,
|
|
|
|
};
|
|
|
|
enum class ToolsetVersion
|
|
|
|
{
|
|
|
|
V140,
|
|
|
|
V141,
|
|
|
|
};
|
|
|
|
|
2017-06-08 19:36:11 +08:00
|
|
|
bool is_supported(Architecture arch, Platform plat, Linkage crt, ToolsetVersion tools);
|
2017-06-07 07:08:36 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<Architecture> architectures;
|
|
|
|
std::vector<Platform> platforms;
|
|
|
|
std::vector<Linkage> crt_linkages;
|
|
|
|
std::vector<ToolsetVersion> toolsets;
|
|
|
|
};
|
2016-09-19 11:50:08 +08:00
|
|
|
}
|