Skip to content

[json_syntax_generator] Separate the runtime library #2447

@dcharkes

Description

@dcharkes

Currently, the runtime library for the generated syntax classes is copied into each generated syntax.

We could consider making a separate runtime library package:

  • All generated code would import this package.
  • This packages would need to be published on pub.dev in order for hooks_runner to be able to roll into flutter_tools.

This would have the following benefits:

  • No copy pasted in helper functions in every generated file: smaller diffs, and no diffs in unrelated syntax files.
  • Properly sharing base classes such as JsonObjectSyntax.

However, publishing a separate package would lead to more churn:

  • It would make the generated code less self-contained, leading to having to do an extra publish step on rolls.
  • More process to avoid version skew between the generated code and runtime library when generating.

Currently, json_syntax_generator has many rough edges and many breaking changes, so we keep the helper library to be copy pasted into every generated file for now.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions