flutter/tools/fuchsia/gn-sdk

This directory contains a few build rules imported from an August 2021 snapshot of the Fuchsia GN SDK, with small (required) path adjustments.

The Dart Fuchsia tests require the Fuchsia Core SDK, and the build rules in the GN SDK require slight path modification to support building against the Fuchsia Core SDK from a different location. Therefore, the Fuchsia Core SDK is downloaded via gclient sync (versioned according to its fingerprint in DEPS), and the modified build rules from Fuchsia GN SDK are, for now, copied to and maintained in flutter/engine.

It is not yet clear if Fuchsia will want to provide SDK resources that support GN build rules with Dart libraries and tests, but if that does happen, these files should be replaced by the Fuchsia-provided build rules.

Other GN SDK build rules to be considered

It may be wise to consider replacing a few other duplicated (but differently built) build rules in //flutter/tools/fuchsia and //build with up-to-date (via gclient sync) rules from the GN SDK. Some of the flutter versions of these rules were originally imported from the fuchsia.git //build directory, and tailored for flutter. The GN SDK build rules offer simplified versions of these rules, pre-tailored for the Fuchsia SDK layout and out-of-tree use cases.

Known build files in this category, with the same file name and similar GN templates, in both Flutter and Fuchsia GN SDK, include:

  • fidl_library.gni
  • gn_run_binary.py

Other Flutter GN SDK build rules that could replace flutter implemented logic include:

  • gn-sdk/build/fuchsia_sdk_pkg.gni could potentially replace some of the build logic in //flutter/tools/fuchsia/sdk/sdk_targets.gni and/or //build/fuchsia/sdk.gni
  • gn-sdk/build/pm_tool.gni rules could potentially replace some flutter pm invocations

SDK build logic that might improve GN target implementations in flutter include:

  • gn-sdk/build/test.gni