Skip to content

Commit 24ada2c

Browse files
meteorcloudycopybara-github
authored andcommitted
Bazel bootstrap: use MODULE.bazel to get the version
This is more reliable than parsing CHANGELOG.md, which is not always the latest. This requires us to maintain the Bazel version number in MODULE.bazel, which should be updated once a year on the master branch, but every time we do a minor/patch release. PiperOrigin-RevId: 695747413 Change-Id: I63d572445d8cb6a76a3e079c2ea6f083257216b0
1 parent a1af43c commit 24ada2c

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
module(
77
name = "bazel",
8+
version = "9.0.0-prerelease",
89
repo_name = "io_bazel",
910
)
1011

MODULE.bazel.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/bootstrap/buildenv.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,8 @@ function git_date() {
265265
# Get the latest release version and append the date of
266266
# the last commit if any.
267267
function get_last_version() {
268-
if [ -f "CHANGELOG.md" ]; then
269-
local version="$(fgrep -m 1 '## Release' CHANGELOG.md \
270-
| sed -E 's|.*Release (.*) \(.*\)|\1|')"
268+
if [ -f "MODULE.bazel" ]; then
269+
local version=$(grep "version =" MODULE.bazel | head -n 1 | sed 's/.*version = "\(.*\)".*/\1/' | cut -d '"' -f2)
271270
else
272271
local version=""
273272
fi

src/test/shell/bazel/bazel_bootstrap_distfile_test.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,14 @@ default_java_toolchain(
145145
)
146146
EOF
147147

148-
# TODO(pcloudy): Uncomment this once the bootstrap test is fixed.
149-
# ./output/bazel \
150-
# --server_javabase=$JAVABASE --host_jvm_args=--add-opens=java.base/java.nio=ALL-UNNAMED \
151-
# build --nobuild --repository_cache=derived/repository_cache \
152-
# --override_repository=$(cat derived/maven/MAVEN_CANONICAL_REPO_NAME)=derived/maven \
153-
# --java_language_version=${JAVA_VERSION} --tool_java_language_version=${JAVA_VERSION} \
154-
# --tool_java_runtime_version=local_jdk \
155-
# --extra_toolchains=fake_java_toolchain:all \
156-
# src:bazel_nojdk &> "${TEST_log}" || fail "analysis with bootstrapped Bazel failed"
148+
./output/bazel \
149+
--server_javabase=$JAVABASE --host_jvm_args=--add-opens=java.base/java.nio=ALL-UNNAMED \
150+
build --nobuild --repository_cache=derived/repository_cache \
151+
--override_repository=$(cat derived/maven/MAVEN_CANONICAL_REPO_NAME)=derived/maven \
152+
--java_language_version=${JAVA_VERSION} --tool_java_language_version=${JAVA_VERSION} \
153+
--tool_java_runtime_version=local_jdk \
154+
--extra_toolchains=fake_java_toolchain:all \
155+
src:bazel_nojdk &> "${TEST_log}" || fail "analysis with bootstrapped Bazel failed"
157156
}
158157

159158
run_suite "bootstrap test"

0 commit comments

Comments
 (0)