Skip to content

Convert rebuilding-flutter-tool script to dart#185089

Open
vashworth wants to merge 3 commits intoflutter:masterfrom
vashworth:rebuild_flutter_tool_with_dart
Open

Convert rebuilding-flutter-tool script to dart#185089
vashworth wants to merge 3 commits intoflutter:masterfrom
vashworth:rebuild_flutter_tool_with_dart

Conversation

@vashworth
Copy link
Copy Markdown
Contributor

@vashworth vashworth commented Apr 15, 2026

Converts a bash script to dart.

Example
# Chat Conversation

Note: _This is purely the output of the chat conversation and does not contain any raw data, codebase snippets, etc. used to generate the output._

### User Input

rebuild cli

*Viewed [SKILL.md](file:///Users/vashworth/Development/flutter/.agents/skills/rebuilding-flutter-tool/SKILL.md) *

*User accepted the command `dart .agents/skills/rebuilding-flutter-tool/scripts/rebuild.dart`*

*Checked command status*

### Planner Response

**Flutter tool rebuilt successfully!**

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-assist bot 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.

@flutter-dashboard
Copy link
Copy Markdown

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.

@vashworth vashworth requested a review from reidbaker April 15, 2026 16:58
@vashworth vashworth added the CICD Run CI/CD label Apr 15, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .agents/skills/rebuilding-flutter-tool/scripts/rebuild.dart Outdated
Comment thread .agents/skills/rebuilding-flutter-tool/scripts/rebuild.dart Outdated
Comment thread .agents/skills/rebuilding-flutter-tool/scripts/rebuild.dart Outdated
@github-actions github-actions bot removed the CICD Run CI/CD label Apr 15, 2026
@vashworth vashworth added the CICD Run CI/CD label Apr 15, 2026
@vashworth vashworth requested a review from jtmcdole April 15, 2026 21:42

// 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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the first time I've seen this :D


void main() async {
final String scriptPath = Platform.script.toFilePath();
final Directory scriptDir = Directory(scriptPath).parent;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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']);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants