tree: 4574f7edc171f56a90625bd462897b4e0d8577ef [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_reference_docs.py
  24. gen_reference_docs_test.py
  25. gen_remote_test_invocation.py
  26. gen_test_invocation.py
  27. group_tests.py
  28. merge_deps_sources.py
  29. OWNERS
  30. README.md
  31. run_analysis.py
  32. test.gni
  33. toolchain.gni
  34. 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.