[vm] Add the channel name to the VM/dart:io version string

Dev and beta version strings will look very look very similar, so adding
the channel name will make it easy for users to see if they are on be,
dev, beta, or stable. This will change both the output of
`dart --version` as well as the value of `Platform.version`.

This also removes the Flutter stable release version hack.

Fixes https://github.com/dart-lang/sdk/issues/40993

Change-Id: Iceb8e84a9cf4d0bfb7659669878e42d0a59febc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140287
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This commit is contained in:
Alexander Thomas 2020-03-23 10:00:03 +00:00 committed by commit-bot@chromium.org
parent 0e75a0650f
commit 8350f423ee
2 changed files with 3 additions and 12 deletions

View file

@ -39,7 +39,7 @@ int Version::OldestSupportedAbiVersion() {
}
const char* Version::snapshot_hash_ = "{{SNAPSHOT_HASH}}";
const char* Version::str_ = "{{VERSION_STR}} ({{COMMIT_TIME}})";
const char* Version::str_ = "{{VERSION_STR}} ({{CHANNEL}}) ({{COMMIT_TIME}})";
const char* Version::commit_ = "{{VERSION_STR}}";
} // namespace dart

View file

@ -47,17 +47,6 @@ VM_SNAPSHOT_FILES = [
def MakeVersionString(quiet, no_git_hash, custom_for_pub=None):
channel = utils.GetChannel()
if custom_for_pub:
# TODO(athom): remove the custom 2.7.0 logic post release.
# For 2.7.0, we want flutter to claim Dart is 2.7.0 even before it is
# decided what exactly 2.7.0 will be. Dart & Flutter stable releases
# will be synced, so that what will be released as Dart 2.7.0 will also
# be what will be packaged with Flutter.
version = utils.ReadVersionFile()
custom_version_string = "%s.%s.%s" % (version.major, version.minor,
version.patch)
if custom_version_string == "2.7.0" and custom_for_pub == "flutter":
return "2.7.0"
if custom_for_pub and channel == 'be':
latest = utils.GetLatestDevTag()
@ -98,6 +87,8 @@ def MakeFile(quiet,
version_cc_text = open(input_file).read()
version_cc_text = version_cc_text.replace("{{VERSION_STR}}", version_string)
channel = utils.GetChannel()
version_cc_text = version_cc_text.replace("{{CHANNEL}}", channel)
version_time = utils.GetGitTimestamp()
if no_git_hash or version_time == None:
version_time = "Unknown timestamp"