Respect the distribution manifest ordering when listing distributions by OneBlue · Pull Request #13561 · microsoft/WSL
Conversation
Summary of the Pull Request
PR Checklist
- Closes: Link to issue #xxx
- Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- Tests: Added/updated if needed and all pass
- Localization: All end user facing strings can be localized
- Dev docs: Added/updated if needed
- Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds preservation of manifest-defined distribution ordering by switching to nlohmann::ordered_json / ordered_map and introducing tests to validate ordering.
- Replaces std::map with nlohmann::ordered_map and custom from_json to retain insertion order.
- Updates JSON parsing utilities to allow using ordered_json.
- Adds tests asserting distribution listing respects manifest order.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/UnitTests.cpp | Adds test cases to verify manifest ordering of distributions. |
| src/windows/common/Distribution.h | Changes ModernDistributions to ordered_map and implements custom from_json to preserve order. |
| src/windows/common/Distribution.cpp | Uses ordered_json in manifest parsing. |
| src/shared/inc/JsonUtils.h | Generalizes FromJson to accept a JSON type parameter. |
| CMakeLists.txt | Updates nlohmann/json dependency version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters