Skip to content

Special handling for parts: buildStep.writePart #4155

@davidmorgan

Description

@davidmorgan

A new feature that could address a number of outstanding requests / issues.

  • Give BuildStep a method writePart(String content), for use when the primary input is a library
  • A bit like the source_gen shared part builder, it handles allowing multiple builders to write to one part file
  • It does the formatting, so it can be done efficiently / in parallel
  • Parts are not the same as outputs: they don't trigger other builders, they are not inputs. Builders only run on libraries. Builders do see the partial state of the part file as it accumulates source.
  • build_runner decides on the location of the part file, and is responsible for updating (or prompting to update) the manually-maintained file with the correct part statement; a bit like the "multi-root packages" idea, but without any SDK feature needed, this means build_runner can e.g. put all the parts under one folder

Re: folder layout, we could do for example: lib/_parts/..., test/_parts/...; note that parts can't be used from anywhere else so there is no need to put them under src.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions