mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() This PR adds support invoking `link.dart` hooks. Link hooks can add new assets. Link hooks can transform assets sent to link hook from build hooks. This PR does not yet add support for getting tree-shake information in the link hooks. This is pending on defining the `resources.json` format (https://github.com/dart-lang/sdk/issues/55494). Issue: * https://github.com/flutter/flutter/issues/146263 ## Implementation considerations The build hooks could be run before Dart compilation and the link hooks after Dart compilation. (This is how it's done in Dart standalone.) However, due to the way the `Target`s are set up, this would require two targets and serializing and deserializing the `BuildResult` in between these. This would lead to more code but no benefits. Currently there is nothing that mandates running build hooks before Dart compilation. ## Testing * The unit tests verify that the native_assets_builder `link` and `linkDryRun` would be invoked with help of the existing fake. * The native assets integration test now also invokes an FFI call of a package that adds the asset during the link hook instead of the build hook. * In order to keep coverage of the `flutter create --template=package_ffi`, `flutter create` is still run and the extra dependency is added and an extra ffi call is added. (Open to alternative suggestions.) |
||
---|---|---|
.. | ||
link_hook_bindings_generated.dart | ||
link_hook.dart |