2016-09-19 11:50:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
2017-06-08 15:36:17 +08:00
|
|
|
#include "Span.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>
|
2016-09-19 11:50:08 +08:00
|
|
|
#include <unordered_map>
|
2017-04-28 08:56:06 +08:00
|
|
|
#include <vector>
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
2017-04-04 06:02:45 +08:00
|
|
|
struct Triplet;
|
2016-11-05 16:02:15 +08:00
|
|
|
|
2017-04-04 06:12:42 +08:00
|
|
|
struct Dependency
|
2016-11-05 16:02:15 +08:00
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string qualifier;
|
|
|
|
};
|
|
|
|
|
2017-04-13 13:48:52 +08:00
|
|
|
const std::string& to_string(const Dependency& dep);
|
2016-11-05 16:02:15 +08:00
|
|
|
|
2017-06-06 06:58:47 +08:00
|
|
|
struct ParseControlErrorInfo
|
|
|
|
{
|
|
|
|
std::string name;
|
|
|
|
std::string remaining_fields_as_string;
|
|
|
|
std::error_code error;
|
|
|
|
};
|
|
|
|
|
2017-05-25 06:54:12 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Port metadata (CONTROL file)
|
|
|
|
/// </summary>
|
2016-09-19 11:50:08 +08:00
|
|
|
struct SourceParagraph
|
|
|
|
{
|
2017-06-06 06:58:47 +08:00
|
|
|
static ExpectedT<SourceParagraph, ParseControlErrorInfo> parse_control_file(
|
|
|
|
std::unordered_map<std::string, std::string> fields);
|
2016-09-19 11:50:08 +08:00
|
|
|
|
2017-06-06 08:55:06 +08:00
|
|
|
SourceParagraph() = default;
|
2016-09-19 11:50:08 +08:00
|
|
|
|
|
|
|
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;
|
2016-09-19 11:50:08 +08:00
|
|
|
};
|
2016-11-05 16:02:15 +08:00
|
|
|
|
2017-06-08 15:36:17 +08:00
|
|
|
void print_error_message(span<const ParseControlErrorInfo> error_info_list);
|
|
|
|
inline void print_error_message(const ParseControlErrorInfo& error_info_list)
|
|
|
|
{
|
|
|
|
return print_error_message({&error_info_list, 1});
|
|
|
|
}
|
2017-06-06 06:58:47 +08:00
|
|
|
|
2017-04-04 06:12:42 +08:00
|
|
|
std::vector<std::string> filter_dependencies(const std::vector<Dependency>& deps, const Triplet& t);
|
2016-11-05 16:02:15 +08:00
|
|
|
|
2017-04-04 06:12:42 +08:00
|
|
|
std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends);
|
2017-06-07 07:08:36 +08:00
|
|
|
std::vector<std::string> parse_comma_list(const std::string& str);
|
|
|
|
|
|
|
|
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
|
|
|
}
|