Skip to content

Commit 43b5e92

Browse files
committed
Warn about problems determining bazel version
Instead of exiting silently, inform the user about the problem and carry on. Do not require a Bazel executable up front so we are still able to generate a project.
1 parent 5e0f91b commit 43b5e92

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: start

+10-3
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,22 @@ have () {
126126
check_bazel_version () {
127127
if ! have bazel; then
128128
# shellcheck disable=SC2016
129-
stderr 'Warning: cannot find `bazel` executable in $PATH'
129+
stderr 'Warning: cannot find `bazel` executable in $PATH (skipping version check)'
130+
return
131+
fi
132+
if ! actual_raw=$(bazel version | grep -E '^Build label:' | grep -Eo '[0-9.]+'); then
133+
stderr 'Warning: cannot determine bazel version (skipping version check)'
130134
return
131135
fi
132-
actual_raw=$(bazel version | grep -E '^Build label:' | grep -Eo '[0-9.]+')
133136

134137
# shellcheck disable=SC2034
135-
IFS=. read -r actual_major actual_minor actual_patch <<-EOF
138+
if ! IFS=. read -r actual_major actual_minor actual_patch <<-EOF
136139
${actual_raw}
137140
EOF
141+
then
142+
stderr "Warning: cannot parse version from bazel output (skipping version check)"
143+
return
144+
fi
138145

139146
expected_min="${MIN_BAZEL_MAJOR}.${MIN_BAZEL_MINOR}.0"
140147
expected_max="${MAX_BAZEL_MAJOR}.${MAX_BAZEL_MINOR}.x"

0 commit comments

Comments
 (0)