Skip to content

Commit

Permalink
Manifests: Remove support for declaring features as lists (#178)
Browse files Browse the repository at this point in the history
It is not used and not described in the docs
  • Loading branch information
autoantwort authored Sep 23, 2021
1 parent 733e90d commit c0485c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 45 deletions.
10 changes: 4 additions & 6 deletions src/vcpkg-test/manifests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,9 +621,8 @@ TEST_CASE ("manifest construct maximum", "[manifests]")
"description": "d",
"dependencies": ["bd"],
"default-features": ["df"],
"features": [
{
"name": "iroh",
"features": {
"iroh" : {
"description": "zuko's uncle",
"dependencies": [
"firebending",
Expand All @@ -637,11 +636,10 @@ TEST_CASE ("manifest construct maximum", "[manifests]")
}
]
},
{
"name": "zuko",
"zuko": {
"description": ["son of the fire lord", "firebending 師父"]
}
]
}
})json");
REQUIRE(m_pgh.has_value());
auto& pgh = **m_pgh.get();
Expand Down
39 changes: 0 additions & 39 deletions src/vcpkg/sourceparagraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,51 +641,12 @@ namespace vcpkg
constexpr StringLiteral FeatureDeserializer::DESCRIPTION;
constexpr StringLiteral FeatureDeserializer::DEPENDENCIES;

struct ArrayFeatureDeserializer : Json::IDeserializer<std::unique_ptr<FeatureParagraph>>
{
virtual StringView type_name() const override { return "a feature"; }

virtual Span<const StringView> valid_fields() const override
{
static const StringView t[] = {
FeatureDeserializer::NAME,
FeatureDeserializer::DESCRIPTION,
FeatureDeserializer::DEPENDENCIES,
};
return t;
}

virtual Optional<std::unique_ptr<FeatureParagraph>> visit_object(Json::Reader& r,
const Json::Object& obj) override
{
std::string name;
r.required_object_field(
type_name(), obj, FeatureDeserializer::NAME, name, Json::IdentifierDeserializer::instance);
auto opt = FeatureDeserializer::instance.visit_object(r, obj);
if (auto p = opt.get())
{
p->get()->name = std::move(name);
}
return opt;
}

static Json::ArrayDeserializer<ArrayFeatureDeserializer> array_instance;
};
Json::ArrayDeserializer<ArrayFeatureDeserializer> ArrayFeatureDeserializer::array_instance{
"an array of feature objects"};

struct FeaturesFieldDeserializer : Json::IDeserializer<std::vector<std::unique_ptr<FeatureParagraph>>>
{
virtual StringView type_name() const override { return "a set of features"; }

virtual Span<const StringView> valid_fields() const override { return {}; }

virtual Optional<std::vector<std::unique_ptr<FeatureParagraph>>> visit_array(Json::Reader& r,
const Json::Array& arr) override
{
return ArrayFeatureDeserializer::array_instance.visit_array(r, arr);
}

virtual Optional<std::vector<std::unique_ptr<FeatureParagraph>>> visit_object(Json::Reader& r,
const Json::Object& obj) override
{
Expand Down

0 comments on commit c0485c3

Please sign in to comment.