From e5194dae87d3d69ce9781b5090cab8526b1bde73 Mon Sep 17 00:00:00 2001 From: Robert Nystrom Date: Tue, 29 Apr 2025 10:40:59 -0700 Subject: [PATCH] Reformat tools/ and utils/ using the 3.8 style. Change-Id: I7b28583eb928f60a45d1f476194d197b4df88062 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425184 Auto-Submit: Bob Nystrom Reviewed-by: Lasse Nielsen Reviewed-by: Nate Bosch Commit-Queue: Nate Bosch --- tools/copy_dart_to_flutter.dart | 127 +++++++++++----------- tools/find_builders.dart | 18 +-- utils/bazel/kernel_worker.dart | 24 ++-- utils/compiler/create_snapshot_entry.dart | 3 +- 4 files changed, 86 insertions(+), 86 deletions(-) diff --git a/tools/copy_dart_to_flutter.dart b/tools/copy_dart_to_flutter.dart index 919237b69e9..aa063e76179 100755 --- a/tools/copy_dart_to_flutter.dart +++ b/tools/copy_dart_to_flutter.dart @@ -35,64 +35,58 @@ const _localFlutter = 'local-flutter'; const _reset = 'reset'; const _verbose = 'verbose'; -final _parser = - ArgParser() - ..addOption( - _architecture, - abbr: 'a', - help: 'Specify your machine\'s architecture.', - allowed: ['ARM64', 'X64'], - defaultsTo: 'ARM64', - ) - ..addFlag( - _buildSdk, - negatable: true, - defaultsTo: true, - help: - 'Whether to build the Dart SDK as part of running this script. ' - 'Negate with --no-$_buildSdk if you have already built the Dart ' - 'SDK locally and want to skip this step.', - ) - ..addOption( - _localDart, - abbr: 'd', - help: - 'Path to your local Dart SDK directory. If unspecified, this value ' - 'will default to the value of the LOCAL_DART_SDK environment ' - 'variable.', - valueHelp: '/Users/me/path/to/dart-sdk/sdk', - ) - ..addOption( - _localFlutter, - abbr: 'f', - help: - 'Path to your local Flutter SDK directory. If unspecified, this ' - 'value will default to the value of the LOCAL_FLUTTER_SDK ' - 'environment variable.', - valueHelp: '/Users/me/path/to/flutter', - ) - ..addFlag( - _verbose, - negatable: false, - abbr: 'v', - help: - 'Run the script with verbose output, which will forward the stdout ' - 'and stderr of all sub-processes.', - ) - ..addFlag( - _help, - negatable: false, - abbr: 'h', - help: 'Show the program usage.', - ) - ..addSeparator('Additional commands') - ..addFlag( - _reset, - negatable: false, - help: - 'Reset your local Flutter SDK cache to undo the effects of running ' - 'this script.', - ); +final _parser = ArgParser() + ..addOption( + _architecture, + abbr: 'a', + help: 'Specify your machine\'s architecture.', + allowed: ['ARM64', 'X64'], + defaultsTo: 'ARM64', + ) + ..addFlag( + _buildSdk, + negatable: true, + defaultsTo: true, + help: 'Whether to build the Dart SDK as part of running this script. ' + 'Negate with --no-$_buildSdk if you have already built the Dart ' + 'SDK locally and want to skip this step.', + ) + ..addOption( + _localDart, + abbr: 'd', + help: 'Path to your local Dart SDK directory. If unspecified, this value ' + 'will default to the value of the LOCAL_DART_SDK environment ' + 'variable.', + valueHelp: '/Users/me/path/to/dart-sdk/sdk', + ) + ..addOption( + _localFlutter, + abbr: 'f', + help: 'Path to your local Flutter SDK directory. If unspecified, this ' + 'value will default to the value of the LOCAL_FLUTTER_SDK ' + 'environment variable.', + valueHelp: '/Users/me/path/to/flutter', + ) + ..addFlag( + _verbose, + negatable: false, + abbr: 'v', + help: 'Run the script with verbose output, which will forward the stdout ' + 'and stderr of all sub-processes.', + ) + ..addFlag( + _help, + negatable: false, + abbr: 'h', + help: 'Show the program usage.', + ) + ..addSeparator('Additional commands') + ..addFlag( + _reset, + negatable: false, + help: 'Reset your local Flutter SDK cache to undo the effects of running ' + 'this script.', + ); void main(List args) async { if (Platform.isWindows) { @@ -115,8 +109,7 @@ void main(List args) async { var localDartSdk = options.option(_localDart) ?? Platform.environment['LOCAL_DART_SDK']; - var localFlutterSdk = - options.option(_localFlutter) ?? + var localFlutterSdk = options.option(_localFlutter) ?? Platform.environment['LOCAL_FLUTTER_SDK']; if (localDartSdk == null || localFlutterSdk == null) { stderr.writeln( @@ -131,10 +124,13 @@ void main(List args) async { if (options.flag(_buildSdk)) { stdout.writeln('Building the Dart SDK...'); - await _runCommand('./tools/build.py', [ - '-mrelease', - 'create_sdk', - ], workingDirectory: localDartSdk); + await _runCommand( + './tools/build.py', + [ + '-mrelease', + 'create_sdk', + ], + workingDirectory: localDartSdk); } await _deleteDartSdkInFlutterCache(localFlutterSdk); @@ -184,8 +180,7 @@ void main(List args) async { } Future _resetLocalFlutterSdk(ArgResults options) async { - var localFlutterSdk = - options.option(_localFlutter) ?? + var localFlutterSdk = options.option(_localFlutter) ?? Platform.environment['LOCAL_FLUTTER_SDK']; if (localFlutterSdk == null) { stderr.writeln( diff --git a/tools/find_builders.dart b/tools/find_builders.dart index 5d9b53e73f4..c2c1ea8bc3b 100755 --- a/tools/find_builders.dart +++ b/tools/find_builders.dart @@ -27,11 +27,10 @@ Future main(List args) async { for (final testName in testNames) ...await _testGetConfigurations(testName), }); final configurationBuilders = await _configurationBuilders(); - final builders = - _filterBuilders({ - for (final config in configurations) configurationBuilders[config]!, - }).toList() - ..sort(); + final builders = _filterBuilders({ + for (final config in configurations) configurationBuilders[config]!, + }).toList() + ..sort(); final gerritTryList = builders.map((b) => '$b-try').join(','); print('Cq-Include-Trybots: dart/try:$gerritTryList'); @@ -116,10 +115,11 @@ Stream> _configurationDocuments() async* { Future> _configurationBuilders() async { return { await for (final document in _configurationDocuments()) - if (document case { - 'name': String fullName, - 'fields': {'builder': {'stringValue': String builder}}, - }) + if (document + case { + 'name': String fullName, + 'fields': {'builder': {'stringValue': String builder}}, + }) fullName.split('/').last: builder, }; } diff --git a/utils/bazel/kernel_worker.dart b/utils/bazel/kernel_worker.dart index bb6ddfb10e7..474e328563e 100644 --- a/utils/bazel/kernel_worker.dart +++ b/utils/bazel/kernel_worker.dart @@ -25,7 +25,8 @@ main(List args, SendPort? sendPort) async { if (args.contains('--persistent_worker')) { if (args.length != 1) { throw new StateError( - "unexpected args, expected only --persistent-worker but got: $args"); + "unexpected args, expected only --persistent-worker but got: $args", + ); } await new KernelWorker(sendPort: sendPort).run(); } else { @@ -43,10 +44,11 @@ class KernelWorker extends AsyncWorkerLoop { /// If [sendPort] is provided it is used for bazel worker communication /// instead of stdin/stdout. KernelWorker({SendPort? sendPort}) - : super( - connection: sendPort == null - ? null - : SendPortAsyncWorkerConnection(sendPort)); + : super( + connection: sendPort == null + ? null + : SendPortAsyncWorkerConnection(sendPort), + ); Future performRequest(WorkRequest request) async { var outputBuffer = new StringBuffer(); @@ -65,11 +67,13 @@ class KernelWorker extends AsyncWorkerLoop { inputDigests[toUri(input.path)] = input.digest; } - var result = await computeKernel(request.arguments, - isWorker: true, - outputBuffer: outputBuffer, - inputDigests: inputDigests, - previousState: previousStateToPass); + var result = await computeKernel( + request.arguments, + isWorker: true, + outputBuffer: outputBuffer, + inputDigests: inputDigests, + previousState: previousStateToPass, + ); previousState = result.previousState; if (!result.succeeded) { response.exitCode = 15; diff --git a/utils/compiler/create_snapshot_entry.dart b/utils/compiler/create_snapshot_entry.dart index b881f596340..b3b7ab3c6b5 100644 --- a/utils/compiler/create_snapshot_entry.dart +++ b/utils/compiler/create_snapshot_entry.dart @@ -27,7 +27,8 @@ Future getVersion(var rootPath, bool noGitHash) { Future getDart2jsSnapshotGenerationFile(var rootPath, bool noGitHash) { return getVersion(rootPath, noGitHash).then((version) { - var snapshotGenerationText = """ + var snapshotGenerationText = + """ import 'package:compiler/src/dart2js.dart' as dart2jsMain; void main(List arguments) {