Unverified Commit 38ef9410 authored by Kevin Moore's avatar Kevin Moore Committed by GitHub

dev/bots/prepare_packages: cleanup (#113717)

parent 83a9858f
...@@ -55,17 +55,6 @@ class PreparePackageException implements Exception { ...@@ -55,17 +55,6 @@ class PreparePackageException implements Exception {
enum Branch { enum Branch {
beta, beta,
stable; stable;
static Branch fromName(String name) {
switch (name) {
case 'beta':
return Branch.beta;
case 'stable':
return Branch.stable;
default:
throw ArgumentError('Invalid branch name.');
}
}
} }
/// A helper class for classes that want to run a process, optionally have the /// A helper class for classes that want to run a process, optionally have the
...@@ -860,10 +849,10 @@ Future<void> main(List<String> rawArguments) async { ...@@ -860,10 +849,10 @@ Future<void> main(List<String> rawArguments) async {
exit(exitCode); exit(exitCode);
} }
final String revision = parsedArguments['revision'] as String;
if (!parsedArguments.wasParsed('revision')) { if (!parsedArguments.wasParsed('revision')) {
errorExit('Invalid argument: --revision must be specified.'); errorExit('Invalid argument: --revision must be specified.');
} }
final String revision = parsedArguments['revision'] as String;
if (revision.length != 40) { if (revision.length != 40) {
errorExit('Invalid argument: --revision must be the entire hash, not just a prefix.'); errorExit('Invalid argument: --revision must be the entire hash, not just a prefix.');
} }
...@@ -872,7 +861,7 @@ Future<void> main(List<String> rawArguments) async { ...@@ -872,7 +861,7 @@ Future<void> main(List<String> rawArguments) async {
errorExit('Invalid argument: --branch must be specified.'); errorExit('Invalid argument: --branch must be specified.');
} }
final String tempDirArg = parsedArguments['temp_dir'] as String; final String? tempDirArg = parsedArguments['temp_dir'] as String?;
Directory tempDir; Directory tempDir;
bool removeTempDir = false; bool removeTempDir = false;
if (tempDirArg == null || tempDirArg.isEmpty) { if (tempDirArg == null || tempDirArg.isEmpty) {
...@@ -897,7 +886,7 @@ Future<void> main(List<String> rawArguments) async { ...@@ -897,7 +886,7 @@ Future<void> main(List<String> rawArguments) async {
final bool publish = parsedArguments['publish'] as bool; final bool publish = parsedArguments['publish'] as bool;
final bool dryRun = parsedArguments['dry_run'] as bool; final bool dryRun = parsedArguments['dry_run'] as bool;
final Branch branch = Branch.fromName(parsedArguments['branch'] as String); final Branch branch = Branch.values.byName(parsedArguments['branch'] as String);
final ArchiveCreator creator = ArchiveCreator( final ArchiveCreator creator = ArchiveCreator(
tempDir, tempDir,
outputDir, outputDir,
......
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