tree: 884335c213686e91e789a9ec06de8340bfe2b0a2 [path history] [tgz]
  1. kernel/
  2. meta/
  3. sdk/
  4. tests/
  5. BUILD.gn
  6. config.gni
  7. dart.gni
  8. dart_app.gni
  9. dart_build_config.gni
  10. dart_component.gni
  11. dart_library.gni
  12. dart_package_config.gni
  13. dart_test_component.gni
  14. dart_tool.gni
  15. empty_pubspec.yaml
  16. fidl_dart.gni
  17. fidl_move.gni
  18. fidlmerge_dart.gni
  19. gen_analyzer_invocation.py
  20. gen_app_invocation.py
  21. gen_dart_package_config.py
  22. gen_dart_test_invocation.py
  23. gen_remote_test_invocation.py
  24. gen_test_invocation.py
  25. group_tests.py
  26. label_to_package_name.py
  27. OWNERS
  28. README.md
  29. run_analysis.py
  30. test.gni
  31. toolchain.gni
  32. verify_sources.py
build/dart/README.md

GN templates for building and testing Dart components.

GN templates for defining Dart components

See: [https://fuchsia.dev/fuchsia-src/development/components/build]

Using

Add this line to your BUILD.gn file:

import("//build/dart/dart_component.gni")

Examples

See the tests under tests/ for usage examples. See individual .gni files for more details.

Compilation Modes

Dart components can be compiled in various different compilation modes. The component can either be compiled in JIT mode or AOT mode and each of these can optionally be compiled in ‘product’ mode which runs in a stripped down VM. By default, the dart_component will pick the compilation mode based on the following:

  • non-product JIT if debug
  • non-product AOT if release
  • product AOT if dart_force_product == true

The compilation mode can be set explicity as a gn arg by setting the dart_default_build_cfg variable.

Product mode can be set by setting the dart_force_product variable to true.

Template Structure

Flutter components and Dart components share much of the same functionality and only differ in their runners and some dependencies. The dart_component will delegate much of the work to the flutter_dart_component target which resides at //build/flutter/internal/flutter_dart_component.gni. The dart_component just sets up the runner dependencies before forwarding to the flutter_dart_component target.