{% set rfcid = “RFC-0176” %} {% include “docs/contribute/governance/rfcs/_common/_rfc_header.md” %}
{# Fuchsia RFCs use templates to display various fields from _rfcs.yaml. View the #} {# fully rendered RFCs at https://fuchsia.dev/fuchsia-src/contribute/governance/rfcs #}
We propose to create an allowlist for Dart programs in the Fuchsia Source Tree.
The initial allowlist will encompass all such existing Dart programs. Authoring new Dart programs in the Fuchsia Source Tree will require an exemption.
Authoring new Dart programs which target Fuchsia in the out-of-tree “product” environment will remain fully supported.
The Flutter on Fuchsia team wants to remove support for the Dart programming language from the in-tree environment.
Creating an allowlist will help the Flutter on Fuchsia team track and restrict new usages of Dart and plan for their eventual migration. We will cover the specific plans for migrating existing Dart programs in a future RFC.
There are several reasons the team wants to move Dart support out-of-tree:
Facilitator:
Reviewers:
Consulted:
Socialization:
This RFC's initial socialization proposal went through individual conversations with all impacted teams, listed in either “Reviewer” or “Consulted” above. The RFC author then hosted a workshop during the “2022 Fuchsia SDK Summit” on the contents of this RFC.
The Flutter on Fuchsia team will maintain a list of Dart programs which are allowed to exist in the build graph of an in-tree Fuchsia build. The initial contents of this list will be all existing Dart programs in-tree.
When designing the policy and the enforcement mechanism, we tried to keep the following priniciples in mind:
We will generate the initial allowlist in fuchsia.git from the list of existing Dart programs in-tree. In line with the incrementality design principle we will include a wild-card entry in the allowlist for performance testing; this wild-card entry will allow addition of new performance tests inside of “//src/tests/end_to_end/perf”.
After generating the initial list, we will implement the mechanism for enforcing the allowlist at build time. This implementation will use GN visibility to restrict the addition of new dart_library, flutter_library, dart_test, flutter_test, and dart_tool targets to the build. In this way it will behave similarly to allowlists like the driver shared libraries allowlist.
After this point, the in-tree GN build will emit a build-time error if a Dart program is present in the build tree but not contained in the allowlist. We will not restrict the expansion of existing Dart programs through the allow-list mechanism, but we will discourage this in design and code-review.
This is purely a policy and build-system change; we anticipate no performance impact.
The initial contents of the allowlist will contain all existing Dart programs in-tree, so enforcement will be fully backwards-compatible.
This is purely a policy and build-system change; we anticipate no security impact.
This is purely a policy and build-system change; we anticipate no privacy impact.
We will implement the allowlist as a build-time check, which means the main test is that the Fuchsia Source Tree continues to build correctly. If the tree continues to build correctly, then this means that all Dart programs fall within the constraints of the allowlist.
This RFC serves as documentation of our intention to create the allowlist.
We will need to update some documentation for developers:
A major downside of this proposal is that writing new Dart programs in-tree will become difficult. Fuchsia developers often reach for Dart when writing host tools due to its historical availability and ease-of-use.
Without the option of Dart available, the only viable replacement for writing host tools which interact with a fuchsia device is to implement an ffx plugin. We hope this is acceptable to developers because ffx is already the blessed and well-lit path for writing such host tools using the Fuchsia SDK.
A major unknown of this proposal is how to accommodate Dart‘s deep integration with the Fuchsia platform (FIDL bindings, conformance tests) in a world where Dart programs are strictly built out-of-tree. We also don’t know at this time how to coordinate the versioning for out-of-tree dart libraries against Fuchsia SDK versions. The flutter-on-fuchsia team intends to address these unknowns in a follow-up RFC.
The existing Fuchsia language policy for Dart: Language Policy
This RFC proposes a similar allowlist-based enforcement mechanism as the drviers shared library allowlist: Drivers Shared Library Allowlist RFC