[flutter_tools] add --dart-define option for fuchsia build#55715
Conversation
|
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. Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
|
@jonahwilliams @zanderso please have a look at this. This is just a trivial change so that I can set -Ddart.vm.product=true |
|
|
|
Also - yes we should add dart-defines! Thanks for getting started with the PR here. It does need to be tested, let me take a look at the existing build_fuchsia code and get back to you |
|
Ahh, just looked - seems we're not passing the same arguments to the fuchsia kernel compiler that we are to the others: The fix for release mode would probably be to change this line to dart.vm.product instead of release |
|
This is also where you would need to add the dart-defines from the In the list of command line arguments |
|
Oops, but it seems that there are no arguments passed to the kernel compiler command here |
Oh my bad here, I thought that |
|
The arguments are the flag list here: |
|
@jonahwilliams I wrote the code to add those flags into the kernel compiler, also refactored it to allow easier testing. Please kindly have a look at it. |
|
I think the remaining test does not have much to do with my patch? Are there any further problem? |
|
|
||
| testUsingContext('parse device-finder output', () async { | ||
| const String example = '2001:0db8:85a3:0000:0000:8a2e:0370:7334 paper-pulp-bush-angel'; | ||
| const String example = |
There was a problem hiding this comment.
Could you revert the formatting changes in this file?
| '--drop-ast', | ||
| ], | ||
|
|
||
| for (final Object dartDefine in buildInfo.dartDefines) '-D$dartDefine', |
There was a problem hiding this comment.
I would move '-D$dartDefine', to the next line
| } | ||
|
|
||
| /// Provide flags that are affected by [BuildInfo] | ||
| List<String> getBuildInfoFlags({ |
There was a problem hiding this comment.
I would make this method static and annotate it with @visibleForTesting from package:meta/meta.dart
|
@jonahwilliams Please have a look at this, I have apply the fixes as requested except the contains one. |
| import '../../src/common.dart'; | ||
|
|
||
| void main() { | ||
| group('Fuchsia Kernel Compiler', () { |
There was a problem hiding this comment.
Prefer 2 space indents in this file
There was a problem hiding this comment.
I don't understand this one, what should I do? It should be 2 space indents already.
Co-Authored-By: Jonah Williams <[email protected]>
jonahwilliams
left a comment
There was a problem hiding this comment.
LGTM with a minor formatting nit
FYI @zanderso
|
Thank you for fixing this @michaellee8 ! |
…el_compiler_test.dart Co-Authored-By: Jonah Williams <[email protected]>
…el_compiler_test.dart Co-Authored-By: Jonah Williams <[email protected]>
|
Umm are there any formatter config I can use? I just use Crtl+Shift+I in VS Code which should be using dartfmt. |
|
Unfortunately we don't use autoformatting for the But general, format in way that is readable, don't go too long, and intent things 2 spaces instead of 4 |
|
@jonahwilliams Oh i can get it. Are there any problems left? |
…el_compiler_test.dart Co-Authored-By: Jonah Williams <[email protected]>
…el_compiler_test.dart Co-Authored-By: Jonah Williams <[email protected]>
|
Hey please don't merge this right now. Let me revert all the bad things caused by auto formatter first. |
|
All damages are cleaned and looks good to merge now. LGTM |
Description
add ability to use --dart-define for fuchsia build
Related Issues
Didn't open an issue for trivial changes.
Tests
I added the following tests:
Didn't add tests for trivial changes
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.