flutter/packages/flutter_tools/templates/app_shared/linux.tmpl
Daco Harkes 2def951924
Reland "Native assets support for Linux" (#135097)
Reland of #134031. (Reverted in #135069.) Contains the fix for b/301051367 together with cl/567233346.

Support for FFI calls with `@Native external` functions through Native assets on Linux. This enables bundling native code without any build-system boilerplate code.

For more info see:

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

### Implementation details for Linux.

Mainly follows the design of https://github.com/flutter/flutter/pull/130494.

Some differences are:

* Linux does not support cross compiling or compiling for multiple architectures, so this has not been implemented.
* Linux has no add2app.

The assets copying is done in the install-phase of the CMake build of a flutter app.
CMake requires the native assets folder to exist, so we create it also when the feature is disabled or there are no assets.

### Tests

This PR adds new tests to cover the various use cases.

* packages/flutter_tools/test/general.shard/linux/native_assets_test.dart
  * Unit tests the Linux-specific part of building native assets.

It also extends various existing tests:

* packages/flutter_tools/test/integration.shard/native_assets_test.dart
  * Runs (incl hot reload/hot restart), builds, builds frameworks for Linux and flutter-tester.
2023-09-22 06:07:06 +00:00
..
flutter Document template CMake files (#96534) 2022-01-14 14:55:14 -08:00
.gitignore Add a more complete app template for Flutter (skeleton) (#83530) 2021-06-28 15:26:04 -07:00
CMakeLists.txt.tmpl Reland "Native assets support for Linux" (#135097) 2023-09-22 06:07:06 +00:00
main.cc Add a more complete app template for Flutter (skeleton) (#83530) 2021-06-28 15:26:04 -07:00
my_application.cc.tmpl Add a more complete app template for Flutter (skeleton) (#83530) 2021-06-28 15:26:04 -07:00
my_application.h Add a more complete app template for Flutter (skeleton) (#83530) 2021-06-28 15:26:04 -07:00