meson/docs/yaml/objects
Dylan Baker b2473b61cc interpreter: add FeatureOption.enable_if and .disable_if
This adds two new methods, that are conceptually related in the same way
that `enable_auto_if` and `disable_auto_if` are. They are different
however, in that they will always replace an `auto` value with an
`enabled` or `disabled` value, or error if the feature is in the
opposite state (calling `feature(disabled).enable_if(true)`, for
example). This matters when the feature will be passed to
dependency(required : …)`, which has different behavior when passed an
enabled feature than an auto one.

The `disable_if` method will be controversial, I'm sure, since it
can be expressed via `feature.require()` (`feature.require(not
condition) == feature.disable_if(condition)`). I have two defences of
this:

1) `feature.require` is difficult to reason about, I would expect
   require to be equivalent to `feature.enable_if(condition)`, not to
   `feature.disable_if(not condition)`.
2) mixing `enable_if` and `disable_if` in the same call chain is much
   clearer than mixing `require` and `enable_if`:
   ```meson
   get_option('feat') \
     .enable_if(foo) \
     .disable_if(bar) \
     .enable_if(opt)
   ```
   vs
   ```meson
   get_option('feat') \
     .enable_if(foo) \
     .require(not bar) \
     .enable_if(opt)
   ```
   In the first chain it's immediately obvious what is happening, in the
   second, not so much, especially if you're not familiar with what
   `require` means.
2023-02-15 22:58:50 -05:00
..
alias_tgt.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
both_libs.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
build_tgt.yaml document declare_dependency(object: ...) 2023-01-04 09:44:32 -08:00
cfg_data.yaml docs: Fix [[true]] --> `true` 2022-04-07 17:16:26 -04:00
compiler.yaml preprocess: Add dependencies kwarg 2023-02-15 15:12:34 -05:00
custom_idx.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
custom_tgt.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
dep.yaml docs/dep.yaml: davault -> default 2022-01-14 19:20:31 -08:00
disabler.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
env.yaml Fix typos 2021-10-21 06:57:57 -04:00
exe.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
external_program.yaml docs: clarify prog.full_path even more 2022-11-30 20:19:56 -05:00
extracted_obj.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
feature.yaml interpreter: add FeatureOption.enable_if and .disable_if 2023-02-15 22:58:50 -05:00
file.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
generated_list.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
generator.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
inc.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
jar.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
lib.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
module.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
range.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
run_tgt.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
runresult.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00
structured_src.yaml docs: Add docs for structured_sources 2022-03-07 12:33:33 -08:00
subproject.yaml docs: YAML: Add `arg_flattening: false` where required 2022-04-07 17:16:26 -04:00
tgt.yaml docs: Add the YAML Reference manual 2021-10-03 11:46:34 +02:00