aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/SourceParagraph.cpp
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2016-11-03 15:43:09 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2016-11-03 17:32:00 -0700
commit90876a3bfef586a20e475d5ef812bac843e7a1a8 (patch)
tree236c8dafcf64d2ed84377520c73abcffa0fc1032 /toolsrc/src/SourceParagraph.cpp
parent5b60e134665cdb33bd1f01f17e61c5b9ba4ad137 (diff)
downloadvcpkg-90876a3bfef586a20e475d5ef812bac843e7a1a8.tar.gz
vcpkg-90876a3bfef586a20e475d5ef812bac843e7a1a8.zip
SourceParagraph checks fields at construction time
Diffstat (limited to 'toolsrc/src/SourceParagraph.cpp')
-rw-r--r--toolsrc/src/SourceParagraph.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/SourceParagraph.cpp
index 34d2a8170..1fa50e233 100644
--- a/toolsrc/src/SourceParagraph.cpp
+++ b/toolsrc/src/SourceParagraph.cpp
@@ -1,5 +1,7 @@
#include "SourceParagraph.h"
#include "vcpkglib_helpers.h"
+#include "vcpkg_System.h"
+#include "vcpkg_Maps.h"
namespace vcpkg
{
@@ -45,6 +47,18 @@ namespace vcpkg
std::string deps = remove_optional_field(&fields, SourceParagraphOptionalField::BUILD_DEPENDS);
this->depends = parse_depends(deps);
- this->unparsed_fields = std::move(fields);
+ if (!fields.empty())
+ {
+ const std::vector<std::string> remaining_fields = Maps::extract_keys(fields);
+ const std::vector<std::string>& valid_fields = get_list_of_valid_fields();
+
+ const std::string remaining_fields_as_string = Strings::join(remaining_fields, "\n ");
+ const std::string valid_fields_as_string = Strings::join(valid_fields, "\n ");
+
+ System::println(System::color::error, "Error: There are invalid fields in the Source Paragraph of %s", this->name);
+ System::println("The following fields were not expected:\n\n %s\n\n", remaining_fields_as_string);
+ System::println("This is the list of valid fields (case-sensitive): \n\n %s\n", valid_fields_as_string);
+ exit(EXIT_FAILURE);
+ }
}
}