[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 kFrameworkDefaultBranch = 'master';
|
||||||
const String kForceFlag = 'force';
|
const String kForceFlag = 'force';
|
||||||
|
|
||||||
const List<String> kReleaseChannels = <String>[
|
const List<String> kBaseReleaseChannels = <String>['stable', 'beta', 'dev'];
|
||||||
'stable',
|
|
||||||
'beta',
|
const List<String> kReleaseChannels = <String>[...kBaseReleaseChannels, FrameworkRepository.defaultBranch];
|
||||||
'dev',
|
|
||||||
FrameworkRepository.defaultBranch,
|
const List<String> KReleaseIncrements = <String>['y', 'z', 'm', 'n'];
|
||||||
];
|
|
||||||
|
|
||||||
const String kReleaseDocumentationUrl = 'https://github.com/flutter/flutter/wiki/Flutter-Cherrypick-Process';
|
const String kReleaseDocumentationUrl = 'https://github.com/flutter/flutter/wiki/Flutter-Cherrypick-Process';
|
||||||
|
|
||||||
@ -80,8 +79,7 @@ String? getValueFromEnvOrArgs(
|
|||||||
if (allowNull) {
|
if (allowNull) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
throw ConductorException(
|
throw ConductorException('Expected either the CLI arg --$name or the environment variable $envName '
|
||||||
'Expected either the CLI arg --$name or the environment variable $envName '
|
|
||||||
'to be provided!');
|
'to be provided!');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,8 +118,7 @@ List<String> getValuesFromEnvOrArgs(
|
|||||||
return argValues;
|
return argValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw ConductorException(
|
throw ConductorException('Expected either the CLI arg --$name or the environment variable $envName '
|
||||||
'Expected either the CLI arg --$name or the environment variable $envName '
|
|
||||||
'to be provided!');
|
'to be provided!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class StartCommand extends Command<void> {
|
|||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
kReleaseOption,
|
kReleaseOption,
|
||||||
help: 'The target release channel for the release.',
|
help: 'The target release channel for the release.',
|
||||||
allowed: <String>['stable', 'beta', 'dev'],
|
allowed: kBaseReleaseChannels,
|
||||||
);
|
);
|
||||||
argParser.addOption(
|
argParser.addOption(
|
||||||
kFrameworkUpstreamOption,
|
kFrameworkUpstreamOption,
|
||||||
@ -93,7 +93,7 @@ class StartCommand extends Command<void> {
|
|||||||
kIncrementOption,
|
kIncrementOption,
|
||||||
help: 'Specifies which part of the x.y.z version number to increment. Required.',
|
help: 'Specifies which part of the x.y.z version number to increment. Required.',
|
||||||
valueHelp: 'level',
|
valueHelp: 'level',
|
||||||
allowed: <String>['y', 'z', 'm', 'n'],
|
allowed: KReleaseIncrements,
|
||||||
allowedHelp: <String, String>{
|
allowedHelp: <String, String>{
|
||||||
'y': 'Indicates the first dev release after a beta release.',
|
'y': 'Indicates the first dev release after a beta release.',
|
||||||
'z': 'Indicates a hotfix to a stable 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) {
|
String luciConsoleLink(String channel, String groupName) {
|
||||||
assert(
|
assert(
|
||||||
<String>['stable', 'beta', 'dev', 'master'].contains(channel),
|
kReleaseChannels.contains(channel),
|
||||||
'channel $channel not recognized',
|
'channel $channel not recognized',
|
||||||
);
|
);
|
||||||
assert(
|
assert(
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// 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.
|
/// Possible string formats that `flutter --version` can return.
|
||||||
enum VersionType {
|
enum VersionType {
|
||||||
@ -262,7 +262,7 @@ class Version {
|
|||||||
/// Will throw a [ConductorException] if the version is not possible given the
|
/// Will throw a [ConductorException] if the version is not possible given the
|
||||||
/// [candidateBranch] and [incrementLetter].
|
/// [candidateBranch] and [incrementLetter].
|
||||||
void ensureValid(String candidateBranch, String 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');
|
throw ConductorException('Invalid incrementLetter: $incrementLetter');
|
||||||
}
|
}
|
||||||
final RegExpMatch? branchMatch = releaseCandidateBranchRegex.firstMatch(candidateBranch);
|
final RegExpMatch? branchMatch = releaseCandidateBranchRegex.firstMatch(candidateBranch);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user