aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-10-31 02:13:49 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-10-31 02:13:49 -0700
commit33fc44a0e3ade2c7e9369723b2ee4965ee8795e6 (patch)
treeb31b9f76cd9d7f5ab354e727f9625ed1d6761037 /toolsrc/src
parentb3fe4462e2e91350f6963180c6d5c7300545e97b (diff)
downloadvcpkg-33fc44a0e3ade2c7e9369723b2ee4965ee8795e6.tar.gz
vcpkg-33fc44a0e3ade2c7e9369723b2ee4965ee8795e6.zip
[vcpkg] Add optional Abi field to BinaryParagraph for future use.
Diffstat (limited to 'toolsrc/src')
-rw-r--r--toolsrc/src/tests.paragraph.cpp30
-rw-r--r--toolsrc/src/vcpkg/binaryparagraph.cpp4
2 files changed, 34 insertions, 0 deletions
diff --git a/toolsrc/src/tests.paragraph.cpp b/toolsrc/src/tests.paragraph.cpp
index d9301abd0..13052610f 100644
--- a/toolsrc/src/tests.paragraph.cpp
+++ b/toolsrc/src/tests.paragraph.cpp
@@ -190,6 +190,20 @@ namespace UnitTest1
Assert::AreEqual("c", pgh.depends[2].c_str());
}
+ TEST_METHOD(BinaryParagraph_Abi)
+ {
+ vcpkg::BinaryParagraph pgh({
+ {"Package", "zlib"},
+ {"Version", "1.2.8"},
+ {"Architecture", "x86-windows"},
+ {"Multi-Arch", "same"},
+ {"Abi", "abcd123"},
+ });
+
+ Assert::AreEqual(size_t(0), pgh.depends.size());
+ Assert::IsTrue(pgh.abi == "abcd123");
+ }
+
TEST_METHOD(parse_paragraphs_empty)
{
const char* str = "";
@@ -385,5 +399,21 @@ namespace UnitTest1
Assert::AreEqual(size_t(1), pghs.size());
Assert::AreEqual("a, b, c", pghs[0]["Depends"].c_str());
}
+
+ TEST_METHOD(BinaryParagraph_serialize_abi)
+ {
+ vcpkg::BinaryParagraph pgh({
+ {"Package", "zlib"},
+ {"Version", "1.2.8"},
+ {"Architecture", "x86-windows"},
+ {"Multi-Arch", "same"},
+ {"Depends", "a, b, c"},
+ {"Abi", "123abc"},
+ });
+ std::string ss = Strings::serialize(pgh);
+ auto pghs = vcpkg::Paragraphs::parse_paragraphs(ss).value_or_exit(VCPKG_LINE_INFO);
+ Assert::AreEqual(size_t(1), pghs.size());
+ Assert::AreEqual("123abc", pghs[0]["Abi"].c_str());
+ }
};
}
diff --git a/toolsrc/src/vcpkg/binaryparagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp
index 3a493eb4c..c7136b713 100644
--- a/toolsrc/src/vcpkg/binaryparagraph.cpp
+++ b/toolsrc/src/vcpkg/binaryparagraph.cpp
@@ -16,6 +16,7 @@ namespace vcpkg
namespace Fields
{
+ static const std::string ABI = "Abi";
static const std::string FEATURE = "Feature";
static const std::string DESCRIPTION = "Description";
static const std::string MAINTAINER = "Maintainer";
@@ -47,6 +48,8 @@ namespace vcpkg
this->description = parser.optional_field(Fields::DESCRIPTION);
this->maintainer = parser.optional_field(Fields::MAINTAINER);
+ this->abi = parser.optional_field(Fields::ABI);
+
std::string multi_arch;
parser.required_field(Fields::MULTI_ARCH, multi_arch);
@@ -118,6 +121,7 @@ namespace vcpkg
out_str.append("Multi-Arch: same\n");
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');
}
}