flutter/packages
Daco Harkes e410b7cd5e
[native_assets] Use kernel concatenation (#147158)
Uses kernel concatenation to concatenate the `program.dill` and `native_assets.dill`.

This will enable compiling `native_assets.dill` after `program.dill` so that tree-shaking information can be used.

Issue:

* https://github.com/flutter/flutter/issues/146270

## Implementation choices

* We can either run the frontend_server twice as a process invocation (current PR), or keep the process running after the dart compilation and then shut it down after native assets compilation to kernel. Keeping the process running would require more coordination between different `Target`s.
* We can either chose to only do separate kernel file compilation in release (AOT) builds, or do it both for JIT and AOT (current PR). Doing it differently in JIT/AOT means more conditionals in lib/src/build_system/targets/, doing it single-shot in JIT might be more performant though.

Update: Both of these are mitigated by not running the kernel compiler process if there are no native assets at all.

## Implementation notes

This only updates `flutter assemble`.

The kernel compilation calls in `flutter run` do not require kernel concatenation. The native-assets-kernel-mapping in `flutter run` contains results from `--dry-run` invocations of `hook/build.dart` (and in the future `hook/link.dart`). These `--dry-run` invocations do not get access to tree-shaking information, so the `link` hook to be introduced later can be run before Dart compilation.

## Tests

* Updated the `Target`s tests to reflect the new implementation.

## Related CLs

* frontend_server support: https://dart-review.googlesource.com/c/sdk/+/363567
* Same PR for Dart standalone: https://dart-review.googlesource.com/c/sdk/+/362384
2024-04-25 11:22:17 +00:00
..
flutter Allow the SceneBuilder, PictureRecord, and Canvas constructor calls from the rendering layer to be hooked (#147271) 2024-04-25 00:19:24 +00:00
flutter_driver
flutter_goldens Remove hidden dependencies on the default goldenFileComparator. (#146956) 2024-04-24 22:50:58 +00:00
flutter_localizations
flutter_test Allow the SceneBuilder, PictureRecord, and Canvas constructor calls from the rendering layer to be hooked (#147271) 2024-04-25 00:19:24 +00:00
flutter_tools [native_assets] Use kernel concatenation (#147158) 2024-04-25 11:22:17 +00:00
flutter_web_plugins
fuchsia_remote_debug_protocol
integration_test
analysis_options.yaml