Convert rebuilding-flutter-tool script to dart#185089
Convert rebuilding-flutter-tool script to dart#185089vashworth wants to merge 3 commits intoflutter:masterfrom
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. 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. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Code Review
This pull request replaces the bash-based rebuild script with a Dart implementation and updates the associated documentation. The review feedback suggests correcting an outdated comment regarding execution directory constraints, adding support for Windows by handling the ".bat" extension, and improving real-time feedback during the rebuild process by switching to Process.start with inherited standard I/O.
|
|
||
| // Go up 4 levels to find the repo root: | ||
| // scripts/ -> rebuilding-flutter-tool/ -> skills/ -> .agents/ -> <repo_root>/ | ||
| final Directory repoRootDir = scriptDir.parent.parent.parent.parent; |
There was a problem hiding this comment.
Not the first time I've seen this :D
|
|
||
| void main() async { | ||
| final String scriptPath = Platform.script.toFilePath(); | ||
| final Directory scriptDir = Directory(scriptPath).parent; |
There was a problem hiding this comment.
not that I think it will fail, but: File(scriptPath).parent?
Platform.script -> file:///full/path/to/script_name.dart
|
|
||
| // Triggers the rebuild by executing any flutter command | ||
| stdout.writeln('Triggering rebuild by running flutter help...'); | ||
| final ProcessResult result = await Process.run('flutter', <String>['help']); |
There was a problem hiding this comment.
// Future<int> main() async {
// ....
final process = await Process.start('flutter', <String>['help'], mode: ProcessStartMode.inheritStdio);
return await process.exitCode;
}Then you don't have to worry about stdout/stderr juggling!
e.g.:
import 'dart:io';
Future<int> main() async {
print('Starting process...');
var process = await Process.start('ping', [
'-c',
'3',
'dart.dev',
], mode: ProcessStartMode.inheritStdio);
return await process.exitCode;
}❯ dart foo.dart
Starting process...
PING dart.dev (199.36.158.100): 56 data bytes
64 bytes from 199.36.158.100: icmp_seq=0 ttl=55 time=4.264 ms
64 bytes from 199.36.158.100: icmp_seq=1 ttl=55 time=4.226 ms
64 bytes from 199.36.158.100: icmp_seq=2 ttl=55 time=4.123 ms
--- dart.dev ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 4.123/4.204/4.264/0.060 ms
Converts a bash script to dart.
Example
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.