Skip to content

Commit

Permalink
Validate versions in metadata.json files are sorted (#1431)
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorcloudy authored Feb 5, 2024
1 parent 3cc45a5 commit 87c1e07
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions modules/buildozer/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"github:fmeum/buildozer"
],
"versions": [
"6.4.0.2",
"6.4.0"
"6.4.0",
"6.4.0.2"
],
"yanked_versions": {}
}
6 changes: 3 additions & 3 deletions modules/rules_xcodeproj/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"github:MobileNativeFoundation/rules_xcodeproj"
],
"versions": [
"1.0.0rc1",
"1.0.0rc2",
"1.0.0rc3",
"0.12.0",
"0.12.2",
"0.12.3",
"1.0.1",
"1.0.0rc1",
"1.0.0rc2",
"1.0.0rc3",
"1.1.0",
"1.2.0",
"1.3.0",
Expand Down
6 changes: 6 additions & 0 deletions tools/bcr_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ def validate_all_metadata(self):
self.report(BcrValidationResult.FAILED, f"Failed to load {module_name}'s metadata.json file: " + str(e))
has_error = True
continue

sorted_versions = sorted(metadata["versions"], key=Version)
if sorted_versions != metadata["versions"]:
self.report(BcrValidationResult.FAILED, f"{module_name}'s metadata.json file is not sorted by version.\n Sorted versions: {sorted_versions}.\n Original versions: {metadata['versions']}")
has_error = True

for version in metadata["versions"]:
if not self.registry.contains(module_name, version):
self.report(BcrValidationResult.FAILED, f"{module_name}@{version} doesn't exist, but it's recorded in {module_name}'s metadata.json file.")
Expand Down

0 comments on commit 87c1e07

Please sign in to comment.