tree: 724c051aea606bb572e389bb8cb3b9738a03e5dd [path history] [tgz]
  1. kernel/
  2. meta/
  3. sdk/
  4. args.gni
  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_packages.gni
  14. dart_test_component.gni
  15. dart_tool.gni
  16. empty_pubspec.yaml
  17. fidl_dart.gni
  18. fidlmerge_dart.gni
  19. gen_app_invocation.py
  20. gen_dart_package_config.py
  21. gen_dart_test_invocation.py
  22. gen_reference_docs.py
  23. gen_reference_docs_test.py
  24. gen_remote_test_invocation.py
  25. gen_test_invocation.py
  26. generate_dart_toc.py
  27. generate_dart_toc_test.py
  28. group_tests.py
  29. merge_deps_sources.py
  30. OWNERS
  31. README.md
  32. run_analysis.py
  33. test.gni
  34. toolchain.gni
  35. 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.