-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[pigeon] Added non-null fields #549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bace56a
8152b68
b4b3f41
de9d289
d0846e3
9add911
6d53f1b
a58bd5f
055f654
52da433
049053b
bb6bfa0
d8afee5
33bbf86
74cb6fe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,53 +87,47 @@ Future<int> _runDartUnitTests() async { | |
| return exitCode; | ||
| } | ||
|
|
||
| /// Generates multiple dart files based on the jobs defined in [jobs] which is | ||
| /// in the format of (key: input pigeon file path, value: output dart file | ||
| /// path). | ||
| Future<int> _generateDart(Map<String, String> jobs) async { | ||
|
||
| for (final MapEntry<String, String> job in jobs.entries) { | ||
| // TODO(gaaclarke): Make this run the jobs in parallel. A bug in Dart | ||
| // blocked this (https://github.com/dart-lang/pub/pull/3285). | ||
| final int result = await _runPigeon( | ||
| input: job.key, dartOut: job.value, streamOutput: false); | ||
| if (result != 0) { | ||
| return result; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| Future<int> _runFlutterUnitTests() async { | ||
| const String flutterUnitTestsPath = | ||
| 'platform_tests/flutter_null_safe_unit_tests'; | ||
| int generateCode = await _runPigeon( | ||
| input: 'pigeons/flutter_unittests.dart', | ||
| dartOut: '$flutterUnitTestsPath/lib/null_safe_pigeon.dart', | ||
| ); | ||
| if (generateCode != 0) { | ||
| return generateCode; | ||
| } | ||
| generateCode = await _runPigeon( | ||
| input: 'pigeons/all_datatypes.dart', | ||
| dartOut: '$flutterUnitTestsPath/lib/all_datatypes.dart', | ||
| ); | ||
| if (generateCode != 0) { | ||
| return generateCode; | ||
| } | ||
| generateCode = await _runPigeon( | ||
| input: 'pigeons/primitive.dart', | ||
| dartOut: '$flutterUnitTestsPath/lib/primitive.dart', | ||
| ); | ||
| if (generateCode != 0) { | ||
| return generateCode; | ||
| } | ||
| generateCode = await _runPigeon( | ||
| input: 'pigeons/multiple_arity.dart', | ||
| dartOut: '$flutterUnitTestsPath/lib/multiple_arity.gen.dart', | ||
| ); | ||
| final int generateCode = await _generateDart(<String, String>{ | ||
| 'pigeons/flutter_unittests.dart': | ||
| '$flutterUnitTestsPath/lib/null_safe_pigeon.dart', | ||
| 'pigeons/all_datatypes.dart': | ||
| '$flutterUnitTestsPath/lib/all_datatypes.dart', | ||
| 'pigeons/primitive.dart': '$flutterUnitTestsPath/lib/primitive.dart', | ||
| 'pigeons/multiple_arity.dart': | ||
| '$flutterUnitTestsPath/lib/multiple_arity.gen.dart', | ||
| 'pigeons/non_null_fields.dart': | ||
| '$flutterUnitTestsPath/lib/non_null_fields.gen.dart', | ||
| }); | ||
| if (generateCode != 0) { | ||
| return generateCode; | ||
| } | ||
|
|
||
| const List<String> testFiles = <String>[ | ||
| 'null_safe_test.dart', | ||
| 'all_datatypes_test.dart', | ||
| 'primitive_test.dart', | ||
| 'multiple_arity_test.dart' | ||
| ]; | ||
| for (final String testFile in testFiles) { | ||
| final int testCode = await _runProcess( | ||
| 'flutter', | ||
| <String>['test', 'test/$testFile'], | ||
| workingDirectory: flutterUnitTestsPath, | ||
| ); | ||
| if (testCode != 0) { | ||
| return testCode; | ||
| } | ||
| final int testCode = await _runProcess( | ||
| 'flutter', | ||
| <String>['test'], | ||
| workingDirectory: flutterUnitTestsPath, | ||
| ); | ||
| if (testCode != 0) { | ||
| return testCode; | ||
| } | ||
|
|
||
| return 0; | ||
|
|
@@ -174,14 +168,17 @@ Future<int> _runPigeon( | |
| String? cppHeaderOut, | ||
| String? cppSourceOut, | ||
| String? dartOut, | ||
| String? dartTestOut}) async { | ||
| String? dartTestOut, | ||
| bool streamOutput = true}) async { | ||
| const bool hasDart = false; | ||
| final List<String> args = <String>[ | ||
| 'pub', | ||
| 'run', | ||
| 'pigeon', | ||
| '--input', | ||
| input, | ||
| '--copyright_header', | ||
| './copyright_header.txt', | ||
| ]; | ||
| if (cppHeaderOut != null) { | ||
| args.addAll(<String>[ | ||
|
|
@@ -204,9 +201,16 @@ Future<int> _runPigeon( | |
| if (!hasDart) { | ||
| args.add('--one_language'); | ||
| } | ||
| final Process generate = await _streamOutput(Process.start('dart', args)); | ||
| final Process generate = streamOutput | ||
| ? await _streamOutput(Process.start('dart', args)) | ||
| : await Process.start('dart', args); | ||
| final int generateCode = await generate.exitCode; | ||
| if (generateCode != 0) { | ||
| if (!streamOutput) { | ||
| print('dart $args failed:'); | ||
| generate.stdout.pipe(stdout); | ||
| generate.stderr.pipe(stderr); | ||
| } | ||
| return generateCode; | ||
| } | ||
| return 0; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the README section about NNBD to reflect the state with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done