Skip to content

Commit 1313c80

Browse files
authored
Move test support logic out of the default Dart output. (#246)
This will allow us to move the mock logic out of the core framework.
1 parent 3e9c51d commit 1313c80

11 files changed

Lines changed: 446 additions & 241 deletions

File tree

packages/pigeon/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ doesn't need to worry about conflicting versions of Pigeon.
2323

2424
1) Add Pigeon as a dev_dependency.
2525
1) Make a ".dart" file outside of your "lib" directory for defining the communication interface.
26-
1) Run pigeon on your ".dart" file to generate the required Dart and Objective-C code.
26+
1) Run pigeon on your ".dart" file to generate the required Dart and Objective-C code:
27+
`flutter pub get` then `flutter pub run pigeon` with suitable arguments.
2728
1) Add the generated Dart code to `lib` for compilation.
2829
1) Add the generated Objective-C code to your Xcode project for compilation
2930
(e.g. `ios/Runner.xcworkspace` or `.podspec`).
@@ -36,6 +37,7 @@ doesn't need to worry about conflicting versions of Pigeon.
3637
1) Add Pigeon as a dev_dependency.
3738
1) Make a ".dart" file outside of your "lib" directory for defining the communication interface.
3839
1) Run pigeon on your ".dart" file to generate the required Dart and Java code.
40+
`flutter pub get` then `flutter pub run pigeon` with suitable arguments.
3941
1) Add the generated Dart code to `./lib` for compilation.
4042
1) Add the generated Java code to your `./android/app/src/main/java` directory for compilation.
4143
1) Implement the generated Java interface for handling the calls on Android, set it up

packages/pigeon/bin/pigeon.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Copyright 2020 The Flutter Authors. All rights reserved.
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
4+
45
// @dart = 2.2
6+
57
import 'dart:async';
68
import 'dart:io';
79
import 'dart:isolate';
@@ -26,7 +28,9 @@ String _posixRelative(String input, {String from}) {
2628

2729
Future<void> main(List<String> args) async {
2830
final PigeonOptions opts = Pigeon.parseArgs(args);
29-
final Directory tempDir = Directory.systemTemp.createTempSync();
31+
final Directory tempDir = Directory.systemTemp.createTempSync(
32+
'flutter_pigeon.',
33+
);
3034

3135
String importLine = '';
3236
if (opts.input != null) {
@@ -43,7 +47,6 @@ void main(List<String> args, SendPort sendPort) async {
4347
sendPort.send(await Pigeon.run(args));
4448
}
4549
""";
46-
4750
final File tempFile = File(path.join(tempDir.path, '_pigeon_temp_.dart'));
4851
await tempFile.writeAsString(code);
4952
final ReceivePort receivePort = ReceivePort();

packages/pigeon/lib/ast.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Method extends Node {
3232
bool isAsynchronous;
3333
}
3434

35-
/// Represents a collection of [Method]s that are hosted ona given [location].
35+
/// Represents a collection of [Method]s that are hosted on a given [location].
3636
class Api extends Node {
3737
/// Parametric constructor for [Api].
3838
Api({this.name, this.location, this.methods, this.dartHostTestHandler});

0 commit comments

Comments
 (0)