build
build copied to clipboard
Add configuration set aliases
Allow builder to define a simple alias which represents multiple options. This would be an enhancement over release/dev option defaults.
Use case: To truly debug in prod mode we would need to set options on multiple builders. The Dart source cleanup would need to stop filtering out Dart files, and the dart2js archive extractor would need to stop filtering out the source map. Our instructions today recommend running without --release and enabling dart2js becaus it's a smaller amount to --define, but it also means you're not getting release mode options for any other builder. We could allow both of these builders to agree on what the option alias debug or keep_source_maps should mean and provide the right configuration for that intention.
Configuration would look something like:
builders:
some_builder_name:
...
defaults:
release_options:
compiler: dart2js
dart2js_use_source_maps: false
option_aliases:
debug:
help: "Keep source maps"
options:
dart2js_use_source_maps: true
Usage looks like:
pub run build_runner build --release --define debug
Behind the scenes we'd merge in the options in the following order:
- Existing options as we're using them today:
- builder defaults
- builder defaults by mode
- user options
- user options by mode
- Global options from build.yaml
- Option aliases
- "legacy" style
--defineoptions
Should we also enable using these aliases when statically configuring a builder somehow?
Should we also enable using these aliases when statically configuring a builder somehow?
I don't see why not as long as we can make a decision about syntax and merge order.
targets:
$default:
builders:
some_package:
option_sets:
- debug
options:
foo: bar
release_options:
foo: baz
- builder defaults
- builder defaults by mode
- Option sets from build.yaml
- user options
- user options by mode
- Global option sets.
- Global options from build.yaml
- Option aliases from command line
- "legacy" style
--defineoptions
What if you want to only apply an option set in a specific mode though? Do we support debug_option_sets etc? lol
Closing as stale.