diff options
| author | Daniel Shaw <t-dansha@microsoft.com> | 2017-06-19 15:06:15 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-06-19 15:06:15 -0700 |
| commit | bca0988023a8c7bfc896d0f5787eb02e74c6fb59 (patch) | |
| tree | 081da47877ef653b27a8a77a33c76575b071de49 /toolsrc/src/Paragraphs.cpp | |
| parent | 73a0161bb13977309209a89ad6328a97b11d28ab (diff) | |
| download | vcpkg-bca0988023a8c7bfc896d0f5787eb02e74c6fb59.tar.gz vcpkg-bca0988023a8c7bfc896d0f5787eb02e74c6fb59.zip | |
[vcpkg] feature packages initial parsing
Diffstat (limited to 'toolsrc/src/Paragraphs.cpp')
| -rw-r--r-- | toolsrc/src/Paragraphs.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/Paragraphs.cpp index 31e8f1da3..440d04ce4 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/Paragraphs.cpp @@ -201,13 +201,22 @@ namespace vcpkg::Paragraphs return Parser(str.c_str(), str.c_str() + str.size()).get_paragraphs(); } - ExpectedT<SourceParagraph, ParseControlErrorInfo> try_load_port(const Files::Filesystem& fs, const fs::path& path) + ExpectedT<SourceControlFile, ParseControlErrorInfo> try_load_port(const Files::Filesystem& fs, const fs::path& path) { ParseControlErrorInfo error_info; - Expected<std::unordered_map<std::string, std::string>> pghs = get_single_paragraph(fs, path / "CONTROL"); - if (auto p = pghs.get()) + Expected<std::vector<std::unordered_map<std::string, std::string>>> pghs = get_paragraphs(fs, path / "CONTROL"); + if (auto vector_pghs = pghs.get()) { - return SourceParagraph::parse_control_file(*p); + auto csf = SourceControlFile::parse_control_file(std::move(*vector_pghs)); + if (!g_feature_packages) + { + if (auto ptr = csf.get()) + { + ptr->core_paragraph.default_features.clear(); + ptr->feature_paragraphs.clear(); + } + } + return csf; } error_info.name = path.filename().generic_u8string(); error_info.error = pghs.error(); @@ -232,7 +241,7 @@ namespace vcpkg::Paragraphs LoadResults ret; for (auto&& path : fs.get_files_non_recursive(ports_dir)) { - ExpectedT<SourceParagraph, ParseControlErrorInfo> source_paragraph = try_load_port(fs, path); + ExpectedT<SourceControlFile, ParseControlErrorInfo> source_paragraph = try_load_port(fs, path); if (auto srcpgh = source_paragraph.get()) { ret.paragraphs.emplace_back(std::move(*srcpgh)); @@ -245,7 +254,7 @@ namespace vcpkg::Paragraphs return ret; } - std::vector<SourceParagraph> load_all_ports(const Files::Filesystem& fs, const fs::path& ports_dir) + std::vector<SourceControlFile> load_all_ports(const Files::Filesystem& fs, const fs::path& ports_dir) { auto results = try_load_all_ports(fs, ports_dir); if (!results.errors.empty()) |
