Skip to content

[pigeon] Move test support logic out of the default Dart output. #246

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

Merged
merged 1 commit into from
Dec 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/pigeon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ doesn't need to worry about conflicting versions of Pigeon.

1) Add Pigeon as a dev_dependency.
1) Make a ".dart" file outside of your "lib" directory for defining the communication interface.
1) Run pigeon on your ".dart" file to generate the required Dart and Objective-C code.
1) Run pigeon on your ".dart" file to generate the required Dart and Objective-C code:
`flutter pub get` then `flutter pub run pigeon` with suitable arguments.
1) Add the generated Dart code to `lib` for compilation.
1) Add the generated Objective-C code to your Xcode project for compilation
(e.g. `ios/Runner.xcworkspace` or `.podspec`).
Expand All @@ -36,6 +37,7 @@ doesn't need to worry about conflicting versions of Pigeon.
1) Add Pigeon as a dev_dependency.
1) Make a ".dart" file outside of your "lib" directory for defining the communication interface.
1) Run pigeon on your ".dart" file to generate the required Dart and Java code.
`flutter pub get` then `flutter pub run pigeon` with suitable arguments.
1) Add the generated Dart code to `./lib` for compilation.
1) Add the generated Java code to your `./android/app/src/main/java` directory for compilation.
1) Implement the generated Java interface for handling the calls on Android, set it up
Expand Down
7 changes: 5 additions & 2 deletions packages/pigeon/bin/pigeon.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright 2020 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.2

import 'dart:async';
import 'dart:io';
import 'dart:isolate';
Expand All @@ -26,7 +28,9 @@ String _posixRelative(String input, {String from}) {

Future<void> main(List<String> args) async {
final PigeonOptions opts = Pigeon.parseArgs(args);
final Directory tempDir = Directory.systemTemp.createTempSync();
final Directory tempDir = Directory.systemTemp.createTempSync(
'flutter_pigeon.',
);

String importLine = '';
if (opts.input != null) {
Expand All @@ -43,7 +47,6 @@ void main(List<String> args, SendPort sendPort) async {
sendPort.send(await Pigeon.run(args));
}
""";

final File tempFile = File(path.join(tempDir.path, '_pigeon_temp_.dart'));
await tempFile.writeAsString(code);
final ReceivePort receivePort = ReceivePort();
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/ast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Method extends Node {
bool isAsynchronous;
}

/// Represents a collection of [Method]s that are hosted ona given [location].
/// Represents a collection of [Method]s that are hosted on a given [location].
class Api extends Node {
/// Parametric constructor for [Api].
Api({this.name, this.location, this.methods, this.dartHostTestHandler});
Expand Down
Loading