#pragma once #include #include #include #include #include #include #include #include namespace vcpkg { std::vector filter_dependencies(const std::vector& deps, Triplet t, const std::unordered_map& cmake_vars); struct Type { enum { UNKNOWN, PORT, ALIAS, } type; static std::string to_string(const Type&); static Type from_string(const std::string&); }; /// /// Port metadata of additional feature in a package (part of CONTROL file) /// struct FeatureParagraph { std::string name; std::string description; std::vector depends; }; /// /// Port metadata of the core feature of a package (part of CONTROL file) /// struct SourceParagraph { std::string name; std::string version; std::string description; std::string maintainer; std::string homepage; std::vector depends; std::vector default_features; Type type; std::string supports_expression; }; /// /// Full metadata of a package: core and other features. /// struct SourceControlFile { SourceControlFile() = default; SourceControlFile(const SourceControlFile& scf) : core_paragraph(std::make_unique(*scf.core_paragraph)) { for (const auto& feat_ptr : scf.feature_paragraphs) { feature_paragraphs.emplace_back(std::make_unique(*feat_ptr)); } } static Parse::ParseExpected parse_control_file( const fs::path& path_to_control, std::vector&& control_paragraphs); std::unique_ptr core_paragraph; std::vector> feature_paragraphs; Optional find_feature(const std::string& featurename) const; Optional&> find_dependencies_for_feature(const std::string& featurename) const; }; /// /// Full metadata of a package: core and other features. As well as the location the SourceControlFile was /// loaded from. /// struct SourceControlFileLocation { SourceControlFileLocation(const SourceControlFileLocation& scfl) : source_control_file(std::make_unique(*scfl.source_control_file)) , source_location(scfl.source_location) { } SourceControlFileLocation(std::unique_ptr&& scf, fs::path&& source) : source_control_file(std::move(scf)), source_location(std::move(source)) { } SourceControlFileLocation(std::unique_ptr&& scf, const fs::path& source) : source_control_file(std::move(scf)), source_location(source) { } std::unique_ptr source_control_file; fs::path source_location; }; void print_error_message(Span> error_info_list); inline void print_error_message(const std::unique_ptr& error_info_list) { return print_error_message({&error_info_list, 1}); } }