aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis.Bezault <curtbezault@gmail.com>2019-07-17 16:04:05 -0700
committerCurtis.Bezault <curtbezault@gmail.com>2019-07-17 16:04:05 -0700
commitf18ffe996877a058da9e0208f92331c83517f6a0 (patch)
tree437d3eac0573dff43f97b2abb126cfd42f4b8bdf
parent58958eb0ea47c6c423fe78f2cd6fd1e31cbcb082 (diff)
downloadvcpkg-f18ffe996877a058da9e0208f92331c83517f6a0.tar.gz
vcpkg-f18ffe996877a058da9e0208f92331c83517f6a0.zip
Add type field
-rw-r--r--toolsrc/include/vcpkg/binaryparagraph.h1
-rw-r--r--toolsrc/src/vcpkg/binaryparagraph.cpp10
-rw-r--r--toolsrc/src/vcpkg/sourceparagraph.cpp6
3 files changed, 12 insertions, 5 deletions
diff --git a/toolsrc/include/vcpkg/binaryparagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h
index 3315151c6..fa49edaba 100644
--- a/toolsrc/include/vcpkg/binaryparagraph.h
+++ b/toolsrc/include/vcpkg/binaryparagraph.h
@@ -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
diff --git a/toolsrc/src/vcpkg/binaryparagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp
index 4b80debab..ad7790fe1 100644
--- a/toolsrc/src/vcpkg/binaryparagraph.cpp
+++ b/toolsrc/src/vcpkg/binaryparagraph.cpp
@@ -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');
}
}
diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp
index 26a7ab118..6af93a99b 100644
--- a/toolsrc/src/vcpkg/sourceparagraph.cpp
+++ b/toolsrc/src/vcpkg/sourceparagraph.cpp
@@ -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)