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