Unverified Commit ad470f6b authored by Alex's avatar Alex Committed by GitHub

[conductor] channel constants refactor (#94220)

parent ed8468b9
......@@ -12,12 +12,11 @@ const String gsutilBinary = 'gsutil.py';
const String kFrameworkDefaultBranch = 'master';
const String kForceFlag = 'force';
const List<String> kReleaseChannels = <String>[
'stable',
'beta',
'dev',
FrameworkRepository.defaultBranch,
];
const List<String> kBaseReleaseChannels = <String>['stable', 'beta', 'dev'];
const List<String> kReleaseChannels = <String>[...kBaseReleaseChannels, FrameworkRepository.defaultBranch];
const List<String> KReleaseIncrements = <String>['y', 'z', 'm', 'n'];
const String kReleaseDocumentationUrl = 'https://github.com/flutter/flutter/wiki/Flutter-Cherrypick-Process';
......@@ -80,9 +79,8 @@ String? getValueFromEnvOrArgs(
if (allowNull) {
return null;
}
throw ConductorException(
'Expected either the CLI arg --$name or the environment variable $envName '
'to be provided!');
throw ConductorException('Expected either the CLI arg --$name or the environment variable $envName '
'to be provided!');
}
bool getBoolFromEnvOrArgs(
......@@ -120,9 +118,8 @@ List<String> getValuesFromEnvOrArgs(
return argValues;
}
throw ConductorException(
'Expected either the CLI arg --$name or the environment variable $envName '
'to be provided!');
throw ConductorException('Expected either the CLI arg --$name or the environment variable $envName '
'to be provided!');
}
/// Translate CLI arg names to env variable names.
......
......@@ -48,7 +48,7 @@ class StartCommand extends Command<void> {
argParser.addOption(
kReleaseOption,
help: 'The target release channel for the release.',
allowed: <String>['stable', 'beta', 'dev'],
allowed: kBaseReleaseChannels,
);
argParser.addOption(
kFrameworkUpstreamOption,
......@@ -93,7 +93,7 @@ class StartCommand extends Command<void> {
kIncrementOption,
help: 'Specifies which part of the x.y.z version number to increment. Required.',
valueHelp: 'level',
allowed: <String>['y', 'z', 'm', 'n'],
allowed: KReleaseIncrements,
allowedHelp: <String, String>{
'y': 'Indicates the first dev release after a beta release.',
'z': 'Indicates a hotfix to a stable release.',
......
......@@ -15,7 +15,7 @@ const String kStateFileName = '.flutter_conductor_state.json';
String luciConsoleLink(String channel, String groupName) {
assert(
<String>['stable', 'beta', 'dev', 'master'].contains(channel),
kReleaseChannels.contains(channel),
'channel $channel not recognized',
);
assert(
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import './globals.dart' show releaseCandidateBranchRegex, ConductorException;
import './globals.dart' show ConductorException, KReleaseIncrements, releaseCandidateBranchRegex;
/// Possible string formats that `flutter --version` can return.
enum VersionType {
......@@ -262,7 +262,7 @@ class Version {
/// Will throw a [ConductorException] if the version is not possible given the
/// [candidateBranch] and [incrementLetter].
void ensureValid(String candidateBranch, String incrementLetter) {
if (!const <String>{'y', 'z', 'm', 'n'}.contains(incrementLetter)) {
if (!KReleaseIncrements.contains(incrementLetter)) {
throw ConductorException('Invalid incrementLetter: $incrementLetter');
}
final RegExpMatch? branchMatch = releaseCandidateBranchRegex.firstMatch(candidateBranch);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment