-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[pigeon] Recursively create output target files #4458
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
[pigeon] Recursively create output target files #4458
Conversation
f0ef9ee
to
c8ae34c
Compare
@stuartmorgan do you think this is something that can be reasonably tested? |
I don't see why not; we have lots of tests that generate output files. All we need is one that does so with a target directory that doesn't exist. |
I'm sorry, but I didn't quite understand your point. Could you please clarify what I need to do? |
c8ae34c
to
e666bb2
Compare
Can you add a test in the pigeon_lib_test.dart file that tests writing a file in a directory that doesn't exist? |
I apologize, but I am having difficulty understanding the approach required to write this test. Could you please provide guidance or instructions on how to proceed? |
49d3fd2
to
fb157be
Compare
|
fb157be
to
1fe6fac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize, but I am having difficulty understanding the approach required to write this test. Could you please provide guidance or instructions on how to proceed?
To test as a unit test, you would create a temp directory (see the logic in withTempFile
for an example) and then call shouldGenerate
on a generator with options that would write to a non-existent subdirectory of that temp directory, then check that it was created.
Alternately it could be done as an end-to-end test here by using an output path that doesn't exist.
c2e3be0
to
1d46423
Compare
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
b5479c5
to
7cd5a2e
Compare
'--input', | ||
'pigeons/message.dart', | ||
'--dart_out', | ||
'$tempDir/subdirectory/message.g.dart', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you change this to '$tempDir/subdirectory/does/not/exist/message.g.dart'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks I just wanted to confirm whether I have to do something like this.
1fba6d5
to
215531c
Compare
215531c
to
2cb30a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits.
packages/pigeon/CHANGELOG.md
Outdated
@@ -1,3 +1,7 @@ | |||
## 10.1.6 | |||
|
|||
* Creates target files before trying to write to it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "Fixes generation failures when an output file is in a directory that doesn't already exist."
packages/pigeon/lib/pigeon_lib.dart
Outdated
@@ -472,6 +473,7 @@ class DartGeneratorAdapter implements GeneratorAdapter { | |||
final DartOptions dartOptionsWithHeader = _dartOptionsWithCopyrightHeader( | |||
options.dartOptions, | |||
options.copyrightHeader, | |||
dartOutPath: options.dartOut, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this change related to the fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this change to investigate something, but then I forgot to revert it. Later, I mistakenly assumed that I had made the change intentionally, and I apologize for that.
@@ -366,6 +366,13 @@ Future<int> _runCommandLineTests() async { | |||
'--ast_out', | |||
tempOutput | |||
], | |||
// Test writing a file in a directory that doesn't exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: missing final period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for putting this together!
@tarrinneal @stuartmorgan I wanted to say a big thank you for your support and guidance during the review and merging of my pull request. Your help has been invaluable, and I'm grateful for the opportunity to contribute to this project. |
flutter/packages@d7ee75a...ac41376 2023-08-08 engine-flutter-autoroll@skia.org Roll Flutter from ad0aa8d to 436df69 (17 revisions) (flutter/packages#4663) 2023-08-08 10687576+bparrishMines@users.noreply.github.com [webview_flutter_wkwebview] Repeatedly pump WebViews until one is garbage collected (flutter/packages#4662) 2023-08-08 erikgerman917@gmail.com [xdg_directories] Add example app (flutter/packages#4554) 2023-08-08 70025277+Nitin-Poojary@users.noreply.github.com [pigeon] Recursively create output target files (flutter/packages#4458) 2023-08-07 jpnurmi@gmail.com [path_provider] Add getApplicationCachePath() (flutter/packages#4483) 2023-08-07 10687576+bparrishMines@users.noreply.github.com [flutter_markdown] Adopt code excerpts in README (flutter/packages#4656) 2023-08-07 reidbaker@google.com [All] Expand artifact hub to all plugins (flutter/packages#4645) 2023-08-07 engine-flutter-autoroll@skia.org Roll Flutter from 2ba9f7b to ad0aa8d (31 revisions) (flutter/packages#4659) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com,rmistry@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
We're always happy to help community members land good pr's! Thank you for putting in the effort and time to get this through to the finish line! |
Recursively creates output target files before trying to write to it.
closes #128820
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).