dart-lang / dart-lang/language

What would be the macro equivalent of build_runner's built.yaml?

Open
#2,220 2 comments 1 reaction 0 assignees View on GitHub
request
Dominant language
TeX
Stars
2.9k
Forks
239
Avg merge
2d 18h
Merged PRs (30d)
14

Description

Hello!

I just thought about something that I haven't seen discussed before: How would macros offer project-wide configurations?

It's pretty common for existing code-generators to allow enabling/disabling features globally through their `build.yaml` file.
There are some discussions about configurations here https://github.com/dart-lang/language/blob/master/working/macros/feature-specification.md#environment-variables-and-configuration but it seems to be talking about alternative features like build flags – which I believe is a different topic.

In particular, in the link mentioned before, it mentions:
> Making macros configuration-free allows tools to give users a single, consistent version of generated code.

but this does not apply to a `build.yaml` like configuration file.

Will macros have something built-in for this?

I suppose we could use the Resource API for this, manually reading a file + decoding it. But I could see this leading to macros parsing the configuration multiple times, making this less efficient than it should be.

Contributor guide

Open the contributing guide

Research direction

Start with the linked feature-specification.md section on environment variables and configuration, then compare its scope with build_runner's built.yaml configuration model and the Resource API mentioned here. Done would be a documented decision or specification for whether macros provide project-wide configuration and how it should work.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.