[conductor] channel constants refactor (#94220)
This commit is contained in:
parent
ed8468b9f0
commit
ad470f6bae
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user