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 <rnystrom@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nate Bosch <nbosch@google.com>
This commit is contained in:
Robert Nystrom
2025-04-29 10:40:59 -07:00
committed by Commit Queue
parent fac5fec88a
commit e5194dae87
4 changed files with 86 additions and 86 deletions
+61 -66
View File
@@ -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<String> args) async {
if (Platform.isWindows) {
@@ -115,8 +109,7 @@ void main(List<String> 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<String> 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<String> args) async {
}
Future<void> _resetLocalFlutterSdk(ArgResults options) async {
var localFlutterSdk =
options.option(_localFlutter) ??
var localFlutterSdk = options.option(_localFlutter) ??
Platform.environment['LOCAL_FLUTTER_SDK'];
if (localFlutterSdk == null) {
stderr.writeln(
+9 -9
View File
@@ -27,11 +27,10 @@ Future<void> main(List<String> 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<Map<String, dynamic>> _configurationDocuments() async* {
Future<Map<String, String>> _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,
};
}
+14 -10
View File
@@ -25,7 +25,8 @@ main(List<String> 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<WorkResponse> 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;
+2 -1
View File
@@ -27,7 +27,8 @@ Future<String> getVersion(var rootPath, bool noGitHash) {
Future<String> 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<String> arguments) {