mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 01:24:47 +08:00
Add type field
This commit is contained in:
parent
58958eb0ea
commit
f18ffe9968
@ -31,6 +31,7 @@ namespace vcpkg
|
||||
std::vector<std::string> default_features;
|
||||
std::vector<std::string> depends;
|
||||
std::string abi;
|
||||
SourceParagraph::TYPE type;
|
||||
};
|
||||
|
||||
struct BinaryControlFile
|
||||
|
@ -23,6 +23,7 @@ namespace vcpkg
|
||||
static const std::string MAINTAINER = "Maintainer";
|
||||
static const std::string DEPENDS = "Depends";
|
||||
static const std::string DEFAULTFEATURES = "Default-Features";
|
||||
static const std::string TYPE = "Type";
|
||||
}
|
||||
|
||||
BinaryParagraph::BinaryParagraph() = default;
|
||||
@ -60,6 +61,9 @@ namespace vcpkg
|
||||
this->default_features = parse_comma_list(parser.optional_field(Fields::DEFAULTFEATURES));
|
||||
}
|
||||
|
||||
this->type =
|
||||
SourceParagraph::type_from_string(parser.optional_field(Fields::TYPE));
|
||||
|
||||
if (const auto err = parser.error_info(this->spec.to_string()))
|
||||
{
|
||||
System::print2(System::Color::error, "Error: while parsing the Binary Paragraph for ", this->spec, '\n');
|
||||
@ -72,14 +76,14 @@ namespace vcpkg
|
||||
}
|
||||
|
||||
BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const Triplet& triplet, const std::string& abi_tag)
|
||||
: version(spgh.version), description(spgh.description), maintainer(spgh.maintainer), abi(abi_tag)
|
||||
: version(spgh.version), description(spgh.description), maintainer(spgh.maintainer), abi(abi_tag), type(spgh.type)
|
||||
{
|
||||
this->spec = PackageSpec::from_name_and_triplet(spgh.name, triplet).value_or_exit(VCPKG_LINE_INFO);
|
||||
this->depends = filter_dependencies(spgh.depends, triplet);
|
||||
}
|
||||
|
||||
BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const FeatureParagraph& fpgh, const Triplet& triplet)
|
||||
: version(), description(fpgh.description), maintainer(), feature(fpgh.name)
|
||||
: version(), description(fpgh.description), maintainer(), feature(fpgh.name), type(spgh.type)
|
||||
{
|
||||
this->spec = PackageSpec::from_name_and_triplet(spgh.name, triplet).value_or_exit(VCPKG_LINE_INFO);
|
||||
this->depends = filter_dependencies(fpgh.depends, triplet);
|
||||
@ -119,5 +123,7 @@ namespace vcpkg
|
||||
if (!pgh.maintainer.empty()) out_str.append("Maintainer: ").append(pgh.maintainer).push_back('\n');
|
||||
if (!pgh.abi.empty()) out_str.append("Abi: ").append(pgh.abi).push_back('\n');
|
||||
if (!pgh.description.empty()) out_str.append("Description: ").append(pgh.description).push_back('\n');
|
||||
|
||||
out_str.append("Type: ").append(SourceParagraph::string_from_type(pgh.type)).push_back('\n');
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ namespace vcpkg
|
||||
}
|
||||
}
|
||||
|
||||
static SourceParagraph::TYPE type_from_string(const std::string& in)
|
||||
SourceParagraph::TYPE SourceParagraph::type_from_string(const std::string& in)
|
||||
{
|
||||
if (Strings::equals(in, "port") || Strings::equals(in, ""))
|
||||
{
|
||||
@ -119,7 +119,7 @@ namespace vcpkg
|
||||
Checks::exit_fail(VCPKG_LINE_INFO);
|
||||
}
|
||||
|
||||
static std::string string_from_type(const SourceParagraph::TYPE& in)
|
||||
std::string SourceParagraph::string_from_type(const SourceParagraph::TYPE& in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
@ -145,7 +145,7 @@ namespace vcpkg
|
||||
parse_comma_list(parser.optional_field(SourceParagraphFields::BUILD_DEPENDS)));
|
||||
spgh->supports = parse_comma_list(parser.optional_field(SourceParagraphFields::SUPPORTS));
|
||||
spgh->default_features = parse_comma_list(parser.optional_field(SourceParagraphFields::DEFAULTFEATURES));
|
||||
spgh->type = type_from_string(parser.optional_field(SourceParagraphFields::TYPE));
|
||||
spgh->type = SourceParagraph::type_from_string(parser.optional_field(SourceParagraphFields::TYPE));
|
||||
|
||||
auto err = parser.error_info(spgh->name);
|
||||
if (err)
|
||||
|
Loading…
Reference in New Issue
Block a user