Skip to content

[pigeon] Added test and fixed bug where running without arguments would crash. #212

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 3 commits into from
Sep 26, 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: 4 additions & 0 deletions packages/pigeon/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be 0.1.9+1? I think that's the convention for plugins for a patch version bump when < 0.x.x

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The +X is used for changes that change the repository, but don't change the binary in anyway, like updating a README.md.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I thought, but I don't think that's how the ecosystem team does it when it's < 1.0
flutter/plugins#2090 (comment)


* Fixed bug where executing pigeon without arguments would crash (introduced in 0.1.8).

## 0.1.8

* Started spawning pigeon_lib in an isolate instead of a subprocess. The
Expand Down
13 changes: 7 additions & 6 deletions packages/pigeon/bin/pigeon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ import 'package:pigeon/pigeon_lib.dart';

Future<void> main(List<String> args) async {
final PigeonOptions opts = Pigeon.parseArgs(args);
assert(opts.input != null);
final String rawInputPath = opts.input;
final Directory tempDir = Directory.systemTemp.createTempSync();
final String absInputPath = File(rawInputPath).absolute.path;
final String relInputPath = path.relative(absInputPath, from: tempDir.path);

final String importLine =
(opts.input != null) ? 'import \'$relInputPath\';\n' : '';
String importLine = '';
if (opts.input != null) {
final String rawInputPath = opts.input;
final String absInputPath = File(rawInputPath).absolute.path;
final String relInputPath = path.relative(absInputPath, from: tempDir.path);
importLine = 'import \'$relInputPath\';\n';
}
final String code = """$importLine
import 'dart:io';
import 'dart:isolate';
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/lib/generator_tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'dart:mirrors';
import 'ast.dart';

/// The current version of pigeon.
const String pigeonVersion = '0.1.8';
const String pigeonVersion = '0.1.9';

/// Read all the content from [stdin] to a String.
String readStdin() {
Expand Down
2 changes: 1 addition & 1 deletion packages/pigeon/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: pigeon
version: 0.1.8
version: 0.1.9
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
homepage: https://github.com/flutter/packages/tree/master/packages/pigeon
dependencies:
Expand Down
5 changes: 5 additions & 0 deletions packages/pigeon/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ test_pigeon_android() {
pub get
pub run test test/

###############################################################################
# Execute without arguments test
###############################################################################
pub run pigeon

###############################################################################
# Compilation tests (Code is generated and compiled)
###############################################################################
Expand Down