Skip to content

Commit 632f8e0

Browse files
committed
check: Update expected format of Flutter version name
These changed in a recent upstream PR to look a bit more like the output of `git describe`: flutter/flutter#172141 That causes an upgrade by `tools/upgrade flutter-local` past that upstream change to break an assumption made by this check; the check notices that up front, and sensibly fails. So update the check to accept both ways.
1 parent dc01e0a commit 632f8e0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tools/check

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ run_flutter_version() {
261261
# If we find cases where it fails, we can study
262262
# how the `flutter` tool actually decides the version name.
263263
<^(\d+\.\d+\.\d+-) (\d+) (\.\d+\.pre) -(\d+) -g[0-9a-f]+$>
264-
<$1 . ($2 + 1) . $3 . "." . $4>xe)'
264+
<$1 . ($2 + 1) . $3 . "-" . $4>xe)'
265265
) || return
266266
if [ -z "${predicted_version}" ]; then
267267
cat >&2 <<EOF
@@ -271,13 +271,19 @@ EOF
271271
return 1
272272
fi
273273
if [ "${flutter_version}" != "${predicted_version}" ]; then
274-
cat >&2 <<EOF
274+
# Before 2025-07 (https://github.com/flutter/flutter/pull/172141),
275+
# the version name ended like ".123" instead of "-123".
276+
local alternate_predicted_version;
277+
alternate_predicted_version="${predicted_version%-*}.${predicted_version##*-}"
278+
if [ "${flutter_version}" != "${alternate_predicted_version}" ]; then
279+
cat >&2 <<EOF
275280
error: Flutter commit in pubspec.yaml seems to differ from version bound
276281
Commit ${flutter_commit} was described as: ${commit_described}
277282
We therefore expect the Flutter version name to be: ${predicted_version}
278283
But the Flutter version bound in pubspec.yaml is: ${flutter_version}
279284
EOF
280-
return 1
285+
return 1
286+
fi
281287
fi
282288

283289
# Check the commit is an acceptable commit.

0 commit comments

Comments
 (0)