Skip to content

Commit 7bfcc0e

Browse files
[pigeon] Recursively create output target files (#4458)
Recursively creates output target files before trying to write to it. closes #[128820](flutter/flutter#128820)
1 parent 31b1849 commit 7bfcc0e

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
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+
## 10.1.6
2+
3+
* Fixes generation failures when an output file is in a directory that doesn't already exist.
4+
15
## 10.1.5
26

37
* Fixes import in generated Dart test output when overriding package name.

packages/pigeon/lib/generator_tools.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import 'ast.dart';
1313
/// The current version of pigeon.
1414
///
1515
/// This must match the version in pubspec.yaml.
16-
const String pigeonVersion = '10.1.5';
16+
const String pigeonVersion = '10.1.6';
1717

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

packages/pigeon/lib/pigeon_lib.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ IOSink? _openSink(String? output, {String basePath = ''}) {
389389
sink = stdout;
390390
} else {
391391
file = File(path.posix.join(basePath, output));
392+
file.createSync(recursive: true);
392393
sink = file.openWrite();
393394
}
394395
return sink;

packages/pigeon/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: pigeon
22
description: Code generator tool to make communication between Flutter and the host platform type-safe and easier.
33
repository: https://github.com/flutter/packages/tree/main/packages/pigeon
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apigeon
5-
version: 10.1.5 # This must match the version in lib/generator_tools.dart
5+
version: 10.1.6 # This must match the version in lib/generator_tools.dart
66

77
environment:
88
sdk: ">=2.19.0 <4.0.0"

packages/pigeon/tool/shared/test_suites.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ Future<int> _runCommandLineTests() async {
366366
'--ast_out',
367367
tempOutput
368368
],
369+
// Test writing a file in a directory that doesn't exist.
370+
<String>[
371+
'--input',
372+
'pigeons/message.dart',
373+
'--dart_out',
374+
'$tempDir/subdirectory/does/not/exist/message.g.dart',
375+
],
369376
];
370377

371378
int exitCode = 0;

0 commit comments

Comments
 (0)