Skip to content

Commit

Permalink
fix(builtin): allow bazel version to have semver build metadata (#2624)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle authored Apr 25, 2021
1 parent ec3d22f commit 6a2e136
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/common/check_version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def parse_version(version_string):
# Remove commit from version.
version = version_string.split(" ", 1)[0]

# Remove semver "build metadata" tag
version = version.split("+", 1)[0]

# Split into (release, date) parts and only return the release
# as a tuple of integers.
parts = version.split("-", 1)
Expand Down
1 change: 1 addition & 0 deletions internal/common/check_version_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def _check_version_test_impl(ctx):
asserts.equals(env, False, check_version("1.2.2", "1.2.3"))
asserts.equals(env, True, check_version("1.12.3", "1.2.1"))
asserts.equals(env, True, check_version("0.8.0rc2", "0.8.0"))
asserts.equals(env, True, check_version("0.8.0+custombuild", "0.8.0"))
asserts.equals(env, True, check_version_range("1.2.2", "1.2.1", "1.2.3"))
asserts.equals(env, False, check_version_range("1.2.0", "1.2.1", "1.2.3"))
asserts.equals(env, False, check_version_range("1.2.4", "1.2.1", "1.2.3"))
Expand Down

0 comments on commit 6a2e136

Please sign in to comment.