Skip to content

Commit ec4ad13

Browse files
authored
Add a check to ensure that version.bzl and MODULE.bazel remain in sync. (#697)
* add MODULE.bazel * Add a check to ensure that version.bzl and MODULE.bazel remain in sync.
1 parent 5bf5a90 commit ec4ad13

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module(
22
name = "rules_pkg",
3-
version = "0.9.0", # Must sync with version.bzl.
3+
version = "0.10.0", # Must sync with version.bzl.
44
repo_name = "rules_pkg",
55
compatibility_level = 1,
66
)

distro/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ py_test(
8787
data = [
8888
"testdata/BUILD.tpl",
8989
":distro",
90+
"//:standard_package",
9091
],
9192
local = True,
9293
python_version = "PY3",

distro/packaging_test.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""Test that the rules_pkg distribution is usable."""
1616

1717
import os
18+
import re
1819
import subprocess
1920
import unittest
2021

@@ -34,6 +35,24 @@ def setUp(self):
3435
self.dest_repo = 'not_named_rules_pkg'
3536
self.version = release_version.RELEASE_VERSION
3637

38+
def testVersionsMatch(self):
39+
"""version.bzl must match MODULE.bazel"""
40+
module_bazel_path = self.data_files.Rlocation(
41+
'rules_pkg/MODULE.bazel')
42+
with open(module_bazel_path, encoding="utf-8") as inp:
43+
want = 'version = "%s"' % self.version
44+
content = inp.read()
45+
if _VERBOSE:
46+
print('=== Expect', want)
47+
module_block_re = re.compile
48+
m = re.search(
49+
r"""module\([^)]+\)""",
50+
content,
51+
flags=re.MULTILINE|re.DOTALL)
52+
self.assertTrue(m)
53+
got = m.group()
54+
self.assertIn(want, got, 'Expected <%s>, got <%s>' % (want, got))
55+
3756
def testBuild(self):
3857
# Set up a fresh Bazel workspace using the currently build repo.
3958
tempdir = os.path.join(os.environ['TEST_TMPDIR'], 'build')

version.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# limitations under the License.
1414
"""The version of rules_pkg."""
1515

16-
version = "0.9.0"
16+
version = "0.10.0"

0 commit comments

Comments
 (0)