build icon indicating copy to clipboard operation
build copied to clipboard

Can two builders from the same package share options?

Open rrousselGit opened this issue 7 months ago • 3 comments

A common pattern with code-generators is to define project-level configurations in the build.yaml.
At the same time, an implementation detail of some code-generators may be to split their generation in multiple builders.

In that scenario, it is possible to have all builders use the same options without having to duplicate the configuration?

What I'd like to avoid:

targets:
  $default:
    builders:
      my_generator|a:
        options:
          my_option: true
      my_generator|b:
        options:
          my_option: true

What I'd like:

targets:
  $default:
    builders:
      my_generator: # no builder name specified, all builders use the same option
        options:
          my_option: true

rrousselGit avatar Apr 29 '25 16:04 rrousselGit

That's certainly something I can look at.

What are the advantages of using multiple builders vs just bundling everything as a single builder?

Thanks.

davidmorgan avatar Apr 30 '25 07:04 davidmorgan

That's certainly something I can look at.

What are the advantages of using multiple builders vs just bundling everything as a single builder?

Thanks.

Nice example of multiple builders is Drift and its different strategies for code generation https://drift.simonbinder.eu/generation_options/modular/?h=modular

petrnymsa avatar Apr 30 '25 16:04 petrnymsa

@davidmorgan They share user-defined options, but their configuration is different

Like one builder could use SharedPartBuilder and another uses LibraryBuilder, but both are configured using the same options.

rrousselGit avatar Apr 30 '25 16:04 rrousselGit