Skip to content

Add Bazel version scheme - #43

Open
andrew wants to merge 2 commits into
mainfrom
bazel-version-support
Open

Add Bazel version scheme#43
andrew wants to merge 2 commits into
mainfrom
bazel-version-support

Conversation

@andrew

@andrew andrew commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Add an implementation-defined bazel version scheme based on Bazel module version ordering. The scheme handles alphanumeric release identifiers, arbitrary release segment counts, BCR .bcr.N releases, classification, validation, normalization, ranges, and highest-version selection. Generic version comparison stays unchanged, and registry consumers remain responsible for yanked versions. It supports the version selection needed by ecosyste-ms/packages#1810 and git-pkgs/enrichment#65.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new bazel versioning scheme to the vers library, implementing Bazel module version ordering so consumers can correctly validate, normalize, compare, range-match, and select highest satisfying Bazel versions.

Changes:

  • Introduces the bazel scheme and wires it into scheme-aware comparison (CompareWithScheme) and normalization/validation paths.
  • Adds Bazel-specific parsing/comparison logic (including BCR .bcr.N releases and prerelease/build handling).
  • Adds public API helpers and tests covering Bazel validation, normalization, classification, ranges, and highest-version selection.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
version.go Registers the bazel scheme and routes comparison through compareBazel.
vers.go Documents bazel in ParseNative and adds scheme-aware stable/prerelease helpers.
range.go Prevents Bazel ranges from matching invalid candidate versions.
parser.go Rejects invalid Bazel constraint versions during constraint parsing.
normalization.go Adds Bazel scheme validation and normalization (dropping build metadata).
constraint.go Preserves v prefix for Bazel constraints (like Go).
bazel.go Implements Bazel version parsing, normalization, and ordering.
bazel_test.go Adds end-to-end tests for Bazel behavior via the public API.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread vers.go
Comment on lines +149 to +156
func classifyVersionWithScheme(version, scheme string) (bool, bool) {
if scheme == schemeBazel {
parsed, ok := parseBazelVersion(version)
return ok && version != "", len(parsed.prerelease) != 0
}
parsed, err := ParseVersion(version)
return err == nil, err == nil && parsed.IsPrerelease()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants