tree: 4d09c7f7db57f86f1dbd703c352393b1ca5e0213 [path history] [tgz]
  1. kernel/
  2. meta/
  3. sdk/
  4. tests/
  5. args.gni
  6. BUILD.gn
  7. config.gni
  8. dart.gni
  9. dart_app.gni
  10. dart_build_config.gni
  11. dart_component.gni
  12. dart_library.gni
  13. dart_package_config.gni
  14. dart_packages.gni
  15. dart_test_component.gni
  16. dart_tool.gni
  17. empty_pubspec.yaml
  18. fidl_dart.gni
  19. fidlmerge_dart.gni
  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. generate_dart_toc.py
  28. generate_dart_toc_test.py
  29. group_tests.py
  30. merge_deps_sources.py
  31. OWNERS
  32. README.md
  33. run_analysis.py
  34. test.gni
  35. toolchain.gni
  36. 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.