#pragma once #include "Span.h" #include "vcpkg_System.h" #include "vcpkg_expected.h" #include #include #include namespace vcpkg { extern bool g_feature_packages; struct Triplet; struct Dependency { std::string name; std::string qualifier; }; const std::string& to_string(const Dependency& dep); struct ParseControlErrorInfo { std::string name; std::string remaining_fields_as_string; std::error_code error; }; struct FeatureParagraph { std::string name; std::string description; std::vector depends; }; /// /// Port metadata (CONTROL file) /// struct SourceParagraph { std::string name; std::string version; std::string description; std::string maintainer; std::vector supports; std::vector depends; std::string default_features; }; struct SourceControlFile { static ExpectedT parse_control_file( std::vector>&& control_paragraphs); SourceParagraph core_paragraph; std::vector> feature_paragraphs; std::vector errors; }; std::vector getSourceParagraphs(const std::vector& control_files); void print_error_message(span error_info_list); inline void print_error_message(const ParseControlErrorInfo& error_info_list) { return print_error_message({&error_info_list, 1}); } std::vector filter_dependencies(const std::vector& deps, const Triplet& t); std::vector expand_qualified_dependencies(const std::vector& depends); std::vector parse_comma_list(const std::string& str); struct Supports { static ExpectedT> parse(const std::vector& strs); using Architecture = System::CPUArchitecture; enum class Platform { WINDOWS, UWP, }; enum class Linkage { DYNAMIC, STATIC, }; enum class ToolsetVersion { V140, V141, }; bool is_supported(Architecture arch, Platform plat, Linkage crt, ToolsetVersion tools); private: std::vector architectures; std::vector platforms; std::vector crt_linkages; std::vector toolsets; }; }