summaryrefslogtreecommitdiff
path: root/docs/yaml/objects/env.yaml
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2024-04-05 08:55:20 -0700
committerJussi Pakkanen <jpakkane@gmail.com>2024-04-14 19:40:02 +0300
commit9f02d0a3e5a5ffc82256391c244b1af38e41ef78 (patch)
treeabd84b53919405a6ea3de5494720e88df7ae23c1 /docs/yaml/objects/env.yaml
parent1dcffb635f3ba3dae63e6aa1b61d3cf56c9cc49b (diff)
downloadmeson-9f02d0a3e5a5ffc82256391c244b1af38e41ef78.tar.gz
Clarify mutable objects usage
Only Environment and ConfigurationData are mutable. However, only ConfigurationData becomes immutable after first use which is inconsistent. This deprecates modification after first use of Environment object and clarify documentation.
Diffstat (limited to 'docs/yaml/objects/env.yaml')
-rw-r--r--docs/yaml/objects/env.yaml13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/yaml/objects/env.yaml b/docs/yaml/objects/env.yaml
index 714da4fe4..3b2e2a851 100644
--- a/docs/yaml/objects/env.yaml
+++ b/docs/yaml/objects/env.yaml
@@ -9,6 +9,11 @@ description: |
on the same `varname`. Earlier Meson versions would warn and only the last
operation took effect.
+ *Since 1.5.0* This object becomes immutable after first use. This means that
+ calling append(), prepend() or set() will cause a deprecation warning if this
+ object has already been used in any function arguments. However, assignment
+ creates a mutable copy.
+
example: |
```meson
env = environment()
@@ -18,6 +23,14 @@ example: |
env.append('MY_PATH', '2')
env.append('MY_PATH', '3')
env.prepend('MY_PATH', '0')
+
+ # Deprecated since 1.5.0
+ run_command('script.py', env: env)
+ env.append('MY_PATH', '4')
+
+ # Allowed and only env2 is modified
+ env2 = env
+ env2.append('MY_PATH', '4')
```
methods: