aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2020-09-23 12:14:32 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2020-09-23 12:14:32 -0400
commit55ea461993db23c8a68053a5f499fda7f65df9b6 (patch)
tree8d20233f2d1442fc223be4854bd8cbc460a4e43b
parent8fa0548e080dd006821ff985868fdef789935feb (diff)
downloadmeson-55ea461993db23c8a68053a5f499fda7f65df9b6.zip
meson-55ea461993db23c8a68053a5f499fda7f65df9b6.tar.gz
meson-55ea461993db23c8a68053a5f499fda7f65df9b6.tar.bz2
Deprecate meson.build_root() and meson.source_root()
Those function are common source of issue when used in a subproject because they point to the parent project root which is rarely what is expected and is a violation of subproject isolation.
-rw-r--r--docs/markdown/Reference-manual.md12
-rw-r--r--docs/markdown/snippets/deprecate_source_build_root.md5
-rw-r--r--mesonbuild/interpreter.py2
3 files changed, 13 insertions, 6 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index c289397..2f9e2de 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -1804,17 +1804,17 @@ the following methods.
or `xcode`.
- `build_root()`: returns a string with the absolute path to the build
- root directory. Note: this function will return the build root of
- the parent project if called from a subproject, which is usually
+ root directory. *(deprecated since 0.56.0)*: this function will return the
+ build root of the parent project if called from a subproject, which is usually
not what you want. Try using `current_build_dir()`.
- `source_root()`: returns a string with the absolute path to the
source root directory. Note: you should use the `files()` function
to refer to files in the root source directory instead of
- constructing paths manually with `meson.source_root()`. This
- function will return the source root of the parent project if called
- from a subproject, which is usually not what you want. Try using
- `current_source_dir()`.
+ constructing paths manually with `meson.source_root()`.
+ *(deprecated since 0.56.0)*: This function will return the source root of the
+ parent project if called from a subproject, which is usually not what you want.
+ Try using `current_source_dir()`.
- `current_build_dir()`: returns a string with the absolute path to the
current build directory.
diff --git a/docs/markdown/snippets/deprecate_source_build_root.md b/docs/markdown/snippets/deprecate_source_build_root.md
new file mode 100644
index 0000000..05b6b91
--- /dev/null
+++ b/docs/markdown/snippets/deprecate_source_build_root.md
@@ -0,0 +1,5 @@
+## `meson.build_root()` and `meson.source_root()` are deprecated
+
+Those function are common source of issue when used in a subproject because they
+point to the parent project root which is rarely what is expected and is a
+violation of subproject isolation.
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 3af5b51..7df5571 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2061,11 +2061,13 @@ class MesonMain(InterpreterObject):
@noPosargs
@permittedKwargs({})
+ @FeatureDeprecated('meson.source_root', '0.56.0', 'use meson.current_source_dir instead.')
def source_root_method(self, args, kwargs):
return self.interpreter.environment.source_dir
@noPosargs
@permittedKwargs({})
+ @FeatureDeprecated('meson.build_root', '0.56.0', 'use meson.current_build_dir instead.')
def build_root_method(self, args, kwargs):
return self.interpreter.environment.build_dir