mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
Change references to "dartfmt" in runtime and tools to "dart format".
In Dart 2.15, we're removing "dartfmt" in favor of "dart format", so I'm going through and fixing all the dangling references to the old name. TEST=Only changing tools Change-Id: I83a5c00be925fdb536014a47dff2b488ed9f478b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215186 Auto-Submit: Bob Nystrom <rnystrom@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
bc5a1138e0
commit
3ac34f791d
|
@ -16,4 +16,4 @@ GENERATED_DIR=$DIR/lib/generated
|
|||
protoc --dart_out=$GENERATED_DIR -I$DIR/protos $DIR/protos/*.proto
|
||||
rm $GENERATED_DIR/*.pbenum.dart $GENERATED_DIR/*.pbjson.dart $GENERATED_DIR/*.pbserver.dart
|
||||
|
||||
dartfmt -w $DIR/lib/generated
|
||||
dart format $DIR/lib/generated
|
||||
|
|
|
@ -46,9 +46,9 @@ Future _generateDart(String appDirPath, List<Node> nodes) async {
|
|||
dart.api.parse(nodes);
|
||||
dart.api.generate(generator);
|
||||
outputFile.writeAsStringSync(generator.toString());
|
||||
ProcessResult result = Process.runSync('dartfmt', ['-w', outDirPath]);
|
||||
ProcessResult result = Process.runSync('dart', ['format', outDirPath]);
|
||||
if (result.exitCode != 0) {
|
||||
print('dartfmt: ${result.stdout}\n${result.stderr}');
|
||||
print('dart format: ${result.stdout}\n${result.stderr}');
|
||||
throw result.exitCode;
|
||||
}
|
||||
|
||||
|
@ -103,9 +103,9 @@ Future _generateAsserts(String appDirPath, List<Node> nodes) async {
|
|||
dart.api.parse(nodes);
|
||||
dart.api.generateAsserts(generator);
|
||||
outputFile.writeAsStringSync(generator.toString());
|
||||
ProcessResult result = Process.runSync('dartfmt', ['-w', outDirPath]);
|
||||
ProcessResult result = Process.runSync('dart', ['format', outDirPath]);
|
||||
if (result.exitCode != 0) {
|
||||
print('dartfmt: ${result.stdout}\n${result.stderr}');
|
||||
print('dart format: ${result.stdout}\n${result.stderr}');
|
||||
throw result.exitCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
dart_files=$(find lib web -name "*.dart")
|
||||
[ -z "$dart_files" ] && exit 0
|
||||
|
||||
unformatted=$(dartfmt -n $dart_files)
|
||||
unformatted=$(dart format -o none $dart_files)
|
||||
[ -z "$unformatted" ] && exit 0
|
||||
|
||||
# Some files are not dartfmt'd. Print message and fail.
|
||||
echo >&2 "dart files must be formatted with dartfmt. Please run:"
|
||||
# Some files are not dart formatted. Print message and fail.
|
||||
echo >&2 "dart files must be formatted with dart format. Please run:"
|
||||
for fn in $unformatted; do
|
||||
echo >&2 " dartfmt -w $PWD/$fn"
|
||||
echo >&2 " dart format $PWD/$fn"
|
||||
done
|
||||
|
||||
exit 1
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
dart_files=$(find lib web -name "*.dart")
|
||||
[ -z "$dart_files" ] && exit 0
|
||||
|
||||
unformatted=$(dartfmt -n $dart_files)
|
||||
unformatted=$(dart format -o none $dart_files)
|
||||
[ -z "$unformatted" ] && exit 0
|
||||
|
||||
# Some files are not dartfmt'd. Print message and fail.
|
||||
echo >&2 "dart files must be formatted with dartfmt. Please run:"
|
||||
# Some files are not dart formatted. Print message and fail.
|
||||
echo >&2 "dart files must be formatted with dart format. Please run:"
|
||||
for fn in $unformatted; do
|
||||
echo >&2 " dartfmt -w $PWD/$fn"
|
||||
echo >&2 " dart format $PWD/$fn"
|
||||
done
|
||||
|
||||
exit 1
|
||||
|
|
|
@ -17,7 +17,7 @@ final generatedNnbdTest =
|
|||
final Map testMap = json.decode(File(stressTestListJson).readAsStringSync());
|
||||
final testFiles = testMap['non-nnbd'].cast<String>();
|
||||
final testFilesNnbd = testMap['nnbd'].cast<String>();
|
||||
final dartfmt = 'tools/sdks/dart-sdk/bin/dartfmt';
|
||||
final dart = 'tools/sdks/dart-sdk/bin/dart';
|
||||
|
||||
main(List<String> args) async {
|
||||
File(generatedNnbdTest)
|
||||
|
@ -188,7 +188,7 @@ main() async {
|
|||
|
||||
Future<String> format(String generatedSource) async {
|
||||
try {
|
||||
final result = await Process.start(dartfmt, []);
|
||||
final result = await Process.start(dart, ['format']);
|
||||
result.stdin.writeln(generatedSource);
|
||||
|
||||
final results = await Future.wait([
|
||||
|
@ -200,13 +200,14 @@ Future<String> format(String generatedSource) async {
|
|||
|
||||
final exitCode = results[3] as int;
|
||||
if (exitCode != 0) {
|
||||
print('Note: Failed to format source code. Dartfmt exited non-0.');
|
||||
print('Note: Failed to format source code. Dart format exited non-0.');
|
||||
return generatedSource;
|
||||
}
|
||||
final stdout = results[1] as String;
|
||||
final stderr = results[2] as String;
|
||||
if (stderr.trim().length != 0) {
|
||||
print('Note: Failed to format source code. Dartfmt had stderr: $stderr');
|
||||
print('Note: Failed to format source code. Dart format had stderr: '
|
||||
'$stderr');
|
||||
return generatedSource;
|
||||
}
|
||||
return stdout;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// dart gen_type_table.dart > dartfuzz_type_table.dart
|
||||
//
|
||||
// Reformat:
|
||||
// tools/sdks/dart-sdk/bin/dartfmt -w \
|
||||
// tools/sdks/dart-sdk/bin/dart format \
|
||||
// runtime/tools/dartfuzz/dartfuzz_type_table.dart
|
||||
//
|
||||
// Then send out modified dartfuzz_type_table.dart for review together
|
||||
|
|
Loading…
Reference in a new issue