Skip to content

Commit 4b576c0

Browse files
authored
[pigeon] Added test and fixed bug where running without arguments would crash. (#212)
* Added test and fixed bug where running without arguments would crash. * removed extra code * removed assert
1 parent 306bc50 commit 4b576c0

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

packages/pigeon/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.9
2+
3+
* Fixed bug where executing pigeon without arguments would crash (introduced in 0.1.8).
4+
15
## 0.1.8
26

37
* Started spawning pigeon_lib in an isolate instead of a subprocess. The

packages/pigeon/bin/pigeon.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ import 'package:pigeon/pigeon_lib.dart';
1010

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

19-
final String importLine =
20-
(opts.input != null) ? 'import \'$relInputPath\';\n' : '';
15+
String importLine = '';
16+
if (opts.input != null) {
17+
final String rawInputPath = opts.input;
18+
final String absInputPath = File(rawInputPath).absolute.path;
19+
final String relInputPath = path.relative(absInputPath, from: tempDir.path);
20+
importLine = 'import \'$relInputPath\';\n';
21+
}
2122
final String code = """$importLine
2223
import 'dart:io';
2324
import 'dart:isolate';

packages/pigeon/lib/generator_tools.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'dart:mirrors';
88
import 'ast.dart';
99

1010
/// The current version of pigeon.
11-
const String pigeonVersion = '0.1.8';
11+
const String pigeonVersion = '0.1.9';
1212

1313
/// Read all the content from [stdin] to a String.
1414
String readStdin() {

packages/pigeon/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: pigeon
2-
version: 0.1.8
2+
version: 0.1.9
33
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
44
homepage: https://github.com/flutter/packages/tree/master/packages/pigeon
55
dependencies:

packages/pigeon/run_tests.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ test_pigeon_android() {
7373
pub get
7474
pub run test test/
7575

76+
###############################################################################
77+
# Execute without arguments test
78+
###############################################################################
79+
pub run pigeon
80+
7681
###############################################################################
7782
# Compilation tests (Code is generated and compiled)
7883
###############################################################################

0 commit comments

Comments
 (0)