-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[vcpkg registries] support versions #15114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
ba17714
96b9c30
e0b0ddd
b2cdfd1
ac58c58
4f36960
e1562bf
7dcc5eb
fdf651f
916f6e7
9e31ad8
31ea1d5
1b8f839
360217b
1ca69d6
64556b3
260d25e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,9 +13,11 @@ namespace vcpkg | |
|
|
||
| bool registries_feature_flags_warning = false; | ||
|
|
||
| auto impl_des = get_registry_implementation_deserializer(configuration_directory); | ||
|
|
||
| { | ||
| std::unique_ptr<RegistryImpl> default_registry; | ||
| if (r.optional_object_field(obj, DEFAULT_REGISTRY, default_registry, RegistryImplDeserializer::instance)) | ||
| std::unique_ptr<RegistryImplementation> default_registry; | ||
| if (r.optional_object_field(obj, DEFAULT_REGISTRY, default_registry, *impl_des)) | ||
| { | ||
| if (!registries_enabled) | ||
| { | ||
|
|
@@ -28,17 +30,21 @@ namespace vcpkg | |
| } | ||
| } | ||
|
|
||
| static Json::ArrayDeserializer<RegistryDeserializer> array_of_registries{"an array of registries"}; | ||
|
|
||
| auto reg_des = get_registry_array_deserializer(configuration_directory); | ||
| std::vector<Registry> regs; | ||
| r.optional_object_field(obj, REGISTRIES, regs, array_of_registries); | ||
| r.optional_object_field(obj, REGISTRIES, regs, *reg_des); | ||
|
|
||
| if (!regs.empty() && !registries_enabled) | ||
| { | ||
| registries_feature_flags_warning = true; | ||
| regs.clear(); | ||
| } | ||
|
|
||
| if (!r.errors().empty()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is almost certainly not the right condition -- this will test whether any errors have occurred anywhere in the reader to this point, not just in child objects. If you need to detect errors in child objects and return early, you'll need to check those objects for an appropriate error state (empty collection, etc). |
||
| { | ||
| return nullopt; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
However, in this case, you're (presumably?) trying to test for whether an error was emitted above as part of parsing the optional object fields. If one of those did result in an error, then the user will already see that more specific error and does not need the generic one. This is fixed by returning a default constructed object of some kind; the code consuming this deserializer should handle this case accordingly (either by testing |
||
| } | ||
|
strega-nil marked this conversation as resolved.
Outdated
|
||
|
|
||
| for (Registry& reg : regs) | ||
| { | ||
| registries.add_registry(std::move(reg)); | ||
|
|
@@ -58,7 +64,9 @@ namespace vcpkg | |
| constexpr StringLiteral ConfigurationDeserializer::DEFAULT_REGISTRY; | ||
| constexpr StringLiteral ConfigurationDeserializer::REGISTRIES; | ||
|
|
||
| ConfigurationDeserializer::ConfigurationDeserializer(const VcpkgCmdArguments& args) | ||
| ConfigurationDeserializer::ConfigurationDeserializer(const VcpkgCmdArguments& args, | ||
| const fs::path& configuration_directory) | ||
| : configuration_directory(configuration_directory) | ||
| { | ||
| registries_enabled = args.registries_enabled(); | ||
| print_json = args.output_json(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.