From 6ec16da54dbdfd8e4f73ad08df4e75e4847e98ae Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Thu, 9 Jan 2020 16:04:26 +0000 Subject: [PATCH] Sort declarations in trial_migration.dart Change-Id: I7f8c3db9bc414c6567547e163fd417bc602e4d4a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/130880 Reviewed-by: Janice Collins Commit-Queue: Paul Berry --- pkg/nnbd_migration/tool/trial_migration.dart | 138 +++++++++---------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/pkg/nnbd_migration/tool/trial_migration.dart b/pkg/nnbd_migration/tool/trial_migration.dart index 72d3de3421c..ecefe9d2df5 100644 --- a/pkg/nnbd_migration/tool/trial_migration.dart +++ b/pkg/nnbd_migration/tool/trial_migration.dart @@ -10,9 +10,9 @@ import 'dart:io'; +import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/diagnostic/diagnostic.dart'; import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart'; -import 'package:analyzer/dart/ast/ast.dart'; import 'package:analyzer/src/generated/source.dart'; import 'package:analyzer_plugin/protocol/protocol_common.dart'; import 'package:args/args.dart'; @@ -22,74 +22,6 @@ import 'package:path/path.dart' as path; import 'src/multi_future_tracker.dart'; import 'src/package.dart'; -ArgResults parseArguments(List args) { - ArgParser argParser = ArgParser(); - ArgResults parsedArgs; - - argParser.addFlag('clean', - abbr: 'c', - defaultsTo: false, - help: 'Recursively delete the playground directory before beginning.'); - - argParser.addFlag('help', abbr: 'h', help: 'Display options'); - - argParser.addFlag('exception_node_only', - defaultsTo: false, - negatable: true, - help: 'Only print the exception node instead of the full stack trace.'); - - argParser.addFlag('update', - abbr: 'u', - defaultsTo: false, - negatable: true, - help: 'Auto-update fetched packages in the playground.'); - - argParser.addOption('sdk', - abbr: 's', - defaultsTo: path.dirname(path.dirname(Platform.resolvedExecutable)), - help: 'Select the root of the SDK to analyze against for this run ' - '(compiled with --nnbd). For example: ../../xcodebuild/DebugX64NNBD/dart-sdk'); - - argParser.addMultiOption( - 'git_packages', - abbr: 'g', - defaultsTo: [], - help: 'Shallow-clone the given git repositories into a playground area,' - ' run pub get on them, and migrate them.', - ); - - argParser.addMultiOption( - 'manual_packages', - abbr: 'm', - defaultsTo: [], - help: 'Run migration against packages in these directories. Does not ' - 'run pub get, any git commands, or any other preparation.', - ); - - argParser.addMultiOption( - 'packages', - abbr: 'p', - defaultsTo: [], - help: 'The list of SDK packages to run the migration against.', - ); - - try { - parsedArgs = argParser.parse(args); - } on ArgParserException { - stderr.writeln(argParser.usage); - exit(1); - } - if (parsedArgs['help'] as bool) { - print(argParser.usage); - exit(0); - } - - if (parsedArgs.rest.length > 1) { - throw 'invalid args. Specify *one* argument to get exceptions of interest.'; - } - return parsedArgs; -} - main(List args) async { ArgResults parsedArgs = parseArguments(args); @@ -188,6 +120,74 @@ main(List args) async { } } +ArgResults parseArguments(List args) { + ArgParser argParser = ArgParser(); + ArgResults parsedArgs; + + argParser.addFlag('clean', + abbr: 'c', + defaultsTo: false, + help: 'Recursively delete the playground directory before beginning.'); + + argParser.addFlag('help', abbr: 'h', help: 'Display options'); + + argParser.addFlag('exception_node_only', + defaultsTo: false, + negatable: true, + help: 'Only print the exception node instead of the full stack trace.'); + + argParser.addFlag('update', + abbr: 'u', + defaultsTo: false, + negatable: true, + help: 'Auto-update fetched packages in the playground.'); + + argParser.addOption('sdk', + abbr: 's', + defaultsTo: path.dirname(path.dirname(Platform.resolvedExecutable)), + help: 'Select the root of the SDK to analyze against for this run ' + '(compiled with --nnbd). For example: ../../xcodebuild/DebugX64NNBD/dart-sdk'); + + argParser.addMultiOption( + 'git_packages', + abbr: 'g', + defaultsTo: [], + help: 'Shallow-clone the given git repositories into a playground area,' + ' run pub get on them, and migrate them.', + ); + + argParser.addMultiOption( + 'manual_packages', + abbr: 'm', + defaultsTo: [], + help: 'Run migration against packages in these directories. Does not ' + 'run pub get, any git commands, or any other preparation.', + ); + + argParser.addMultiOption( + 'packages', + abbr: 'p', + defaultsTo: [], + help: 'The list of SDK packages to run the migration against.', + ); + + try { + parsedArgs = argParser.parse(args); + } on ArgParserException { + stderr.writeln(argParser.usage); + exit(1); + } + if (parsedArgs['help'] as bool) { + print(argParser.usage); + exit(0); + } + + if (parsedArgs.rest.length > 1) { + throw 'invalid args. Specify *one* argument to get exceptions of interest.'; + } + return parsedArgs; +} + void printWarning(String warn) { stderr.writeln(''' !!!