[tool] Add support for .java, .gradle, .sh, and .m files…#5567
[tool] Add support for .java, .gradle, .sh, and .m files…#5567auto-submit[bot] merged 9 commits intoflutter:mainfrom
.java, .gradle, .sh, and .m files…#5567Conversation
|
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 or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use 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. |
|
The existing test file |
What do you mean by "totally reworked"? It looks like the existing test structure would just need one more parameter (for the file path to write |
Update test helper function to accept fileName parameter so that tests may use arbitrary file types Remove extra line in tool file that prevents language from being properly set in cc files
|
Ah sorry, I should've figured that out. Thanks for pointing me in the right direction! |
Group file type tests
| }); | ||
| } | ||
|
|
||
| // ignore: prefer_foreach |
There was a problem hiding this comment.
Two conflicting lint rules here: avoid_function_literals_in_foreach_calls and prefer_foreach. The latter aims to make the code more terse but the formatter uses the same number of lines with forEach as it does with for...in.
There was a problem hiding this comment.
There's not a conflict, the linter just gives a misleading suggestion for what you probably wrote as your other version. The version of this that's compliant with all of our lints is testCases.forEach(runTest);.
| case '.kt': | ||
| language = 'kotlin'; | ||
| break; | ||
| case '.cc': |
There was a problem hiding this comment.
Why was this removed?
There was a problem hiding this comment.
Shoot, there was a problem with my test case for .cc files. My mistake.
|
|
||
| Future<void> testInjection(String before, String source, String after, | ||
| Future<void> testInjection( | ||
| String before, String source, String after, String fileName, |
There was a problem hiding this comment.
This is a lot of positional arguments with the same type; ideally they should all be named, but lets at least name the new one.
|
|
||
| Future<void> testInjection(String before, String source, String after, | ||
| Future<void> testInjection( | ||
| String before, String source, String after, String fileName, |
There was a problem hiding this comment.
Nit throughout the PR: "filename" is generally a single word in programming, so the variable would just be filename.
| }); | ||
| } | ||
|
|
||
| // ignore: prefer_foreach |
There was a problem hiding this comment.
There's not a conflict, the linter just gives a misleading suggestion for what you probably wrote as your other version. The version of this that's compliant with all of our lints is testCases.forEach(runTest);.
tarrinneal
left a comment
There was a problem hiding this comment.
Do you think there's a good way to handle .h files for c++ and objc?
| case '.cpp': | ||
| language = 'c++'; | ||
| break; | ||
| case '.m': | ||
| language = 'objectivec'; | ||
| break; |
There was a problem hiding this comment.
@stuartmorgan Seems like we don't have support for header files for either language. I'm not sure there's a simple solution though.
There was a problem hiding this comment.
Good point. That would need either more special casing here, or a more generalized solution (like a mapping from extensions to the set of allowed languages).
| required String source, | ||
| required String after, | ||
| required String filename, | ||
| bool failOnChange = false}) async { |
There was a problem hiding this comment.
nit: add a trailing comma false,})
tarrinneal
left a comment
There was a problem hiding this comment.
Changed my mind, merging now
flutter/packages@b5958e2...1151191 2023-12-14 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.22.8 to 3.22.11 (flutter/packages#5674) 2023-12-13 ditman@gmail.com [ci][web] Ignore always_specify_types for JSArray. (flutter/packages#5669) 2023-12-13 mikemcguiness@protonmail.com [tool] Add support for `.java`, `.gradle`, `.sh`, and `.m` files� (flutter/packages#5567) 2023-12-13 ditman@gmail.com [google_sign_in] Update (web) example app. (flutter/packages#5634) 2023-12-13 34871572+gmackall@users.noreply.github.com [path_provider] De-flake getExternalStorageDirectories test (flutter/packages#5628) 2023-12-13 ditman@gmail.com [google_sign_in_web] Stop relying on framework internals. (flutter/packages#5660) 2023-12-13 43054281+camsim99@users.noreply.github.com [Android] Bump Gradle version to 7.6.3 (flutter/packages#5522) 2023-12-13 mikemcguiness@protonmail.com [google_sign_in] Adopt code excerpts in README (flutter/packages#5521) 2023-12-13 mikemcguiness@protonmail.com [css_colors] Adopt code excerpts in README (flutter/packages#5478) 2023-12-13 JeroenWeener@users.noreply.github.com [webview_flutter] Support for handling basic authentication requests (Android) (flutter/packages#5454) 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://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
… to
update-excerptstoolNeed this tool to recognize
.java,.gradle, and.shfiles in order to complete flutter/flutter#102679. TheREADME.mdfor theespressopackage contains code from.java,.gradle, and.shfiles.Support for
.mfiles was requested by @tarrinneal.Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.