build icon indicating copy to clipboard operation
build copied to clipboard

Allow builders to specify by default that they look inside folders outside of `lib`

Open rrousselGit opened this issue 9 months ago • 1 comments

Related to https://github.com/dart-lang/build/issues/2426

Some builders may want to deviate a bit from the Dart folder conventions ; such as defining an asset or api folder.

Currently, this requires any project that uses such generator to define a build.yaml with:

targets:
  $default:
    sources:
      - assets/**
      - api/**
      - ...

But this is inconvenient because it requires every user of said builder to redefine the build.yaml.

Proposal: Allow builders to define custom sources

Instead of asking users of a builder to specify the sources, could a builder itself do it?
For example:

builders:
  my_builder:
    ...
    sources:
      - api/**
      - assets/**

I've tried using:

builders:
  nameless:
    ...
    defaults:
      generate_for:
        include:
          - api/**

But this doesn't seem to do the same.

rrousselGit avatar Apr 08 '25 11:04 rrousselGit

That sounds reasonable. I need to understand that code better, anyway, so happy to dig into it when I have some time to spare.

davidmorgan avatar Apr 08 '25 17:04 davidmorgan