sdk icon indicating copy to clipboard operation
sdk copied to clipboard

I wish for `dart run --aot`

Open matanlurey opened this issue 6 months ago • 2 comments

For small Dart binaries with few dependencies, dart run binary.dart is sufficient.

For larger binaries, where you can afford to run a resident compiler as you make changes:

dart run --resident binary.dart

There are a lot of shell scripts, python scripts, and Dart code that essentially does something like:

// Pseudo code
final snapshot = await compileScriptIfChangesMade(pathToDartFile);
await runSnapshot(snapshot);

... because the binary is not expected to change often (--resident is less helpful), or even we'd want to take advantage of AOT compilation. I'd love for this to be as easy as dart run binary.dart --snapshot-kind=aot-snapshot, or similar.

matanlurey avatar Jun 12 '25 00:06 matanlurey

Are you suggesting that dart run --aot binary.dart would detect if binary.dart had changed / was run for the first time and generate an AOT snapshot to be reused on future runs?

bkonyi avatar Jun 12 '25 15:06 bkonyi

Yes. Basically I'd love for something like the myriad of wrapper shell scripts in Flutter and the engine to just be handled by dart run.

matanlurey avatar Jun 12 '25 15:06 matanlurey