summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2020-09-17 11:46:42 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2020-10-13 17:55:16 -0400
commit173c115834e37acf2a66fd00fa4010e5765c39a9 (patch)
tree358449130cbe02a74e686cae046346c7ff53432d
parenta20d7ad67d3c876785901349cfc990e4bf31778b (diff)
downloadmeson-173c115834e37acf2a66fd00fa4010e5765c39a9.tar.gz
Add wrap mode to disable auto promote
-rw-r--r--docs/markdown/Builtin-options.md2
-rw-r--r--docs/markdown/Subprojects.md7
-rw-r--r--docs/markdown/snippets/subsubproject.md4
-rw-r--r--mesonbuild/interpreter.py13
-rw-r--r--mesonbuild/wrap/__init__.py2
5 files changed, 20 insertions, 8 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md
index 05ff4ff67..b7dd3de42 100644
--- a/docs/markdown/Builtin-options.md
+++ b/docs/markdown/Builtin-options.md
@@ -79,7 +79,7 @@ for details.
| unity_size {>=2} | 4 | Unity file block size | no | no |
| warning_level {0, 1, 2, 3} | 1 | Set the warning level. From 0 = none to 3 = highest | no | yes |
| werror | false | Treat warnings as errors | no | yes |
-| wrap_mode {default, nofallback,<br>nodownload, forcefallback} | default | Wrap mode to use | no | no |
+| wrap_mode {default, nofallback,<br>nodownload, forcefallback, nopromote} | default | Wrap mode to use | no | no |
| force_fallback_for | [] | Force fallback for those dependencies | no | no |
<a name="build-type-options"></a>
diff --git a/docs/markdown/Subprojects.md b/docs/markdown/Subprojects.md
index 7e17afa9f..e8adc965e 100644
--- a/docs/markdown/Subprojects.md
+++ b/docs/markdown/Subprojects.md
@@ -258,6 +258,13 @@ the following command-line options:
`glib-2.0` must also be forced to fallback, in this case with
`--force-fallback-for=glib,gsteamer`.
+* **--wrap-mode=nopromote**
+
+ *Since 0.56.0* Meson will automatically use wrap files found in subprojects
+ and copy them into the main project. That new behavior can be disabled by
+ passing `--wrap-mode=nopromote`. In that case only wraps found in the main
+ project will be used.
+
## `meson subprojects` command
*Since 0.49.0*
diff --git a/docs/markdown/snippets/subsubproject.md b/docs/markdown/snippets/subsubproject.md
index fdba3e014..77f4a0d4e 100644
--- a/docs/markdown/snippets/subsubproject.md
+++ b/docs/markdown/snippets/subsubproject.md
@@ -1,4 +1,4 @@
-## Sub-subprojects
+## Wraps from subprojects are automatically promoted
It is not required to promote wrap files for subprojects into the main project
any more. When configuring a subproject, meson will look for any wrap file or
@@ -9,3 +9,5 @@ the new wrap file or directory is ignored. That means that the main project can
always override any subproject's wrap files by providing their own, it also means
the ordering in which subprojects are configured matters, if 2 subprojects provide
foo.wrap only the one from the first subproject to be configured will be used.
+
+This new behavior can be disabled by passing `--wrap-mode=nopromote`.
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 56bc72d75..ad6f04eb7 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -3166,12 +3166,13 @@ external dependencies (including libraries) must go to "dependencies".''')
# Load wrap files from this (sub)project.
wrap_mode = self.coredata.get_builtin_option('wrap_mode')
- subdir = os.path.join(self.subdir, spdirname)
- r = wrap.Resolver(self.environment.get_source_dir(), subdir, wrap_mode)
- if self.is_subproject():
- self.environment.wrap_resolver.merge_wraps(r)
- else:
- self.environment.wrap_resolver = r
+ if not self.is_subproject() or wrap_mode != WrapMode.nopromote:
+ subdir = os.path.join(self.subdir, spdirname)
+ r = wrap.Resolver(self.environment.get_source_dir(), subdir, wrap_mode)
+ if self.is_subproject():
+ self.environment.wrap_resolver.merge_wraps(r)
+ else:
+ self.environment.wrap_resolver = r
self.build.projects[self.subproject] = proj_name
mlog.log('Project name:', mlog.bold(proj_name))
diff --git a/mesonbuild/wrap/__init__.py b/mesonbuild/wrap/__init__.py
index 17711461e..653f42ab9 100644
--- a/mesonbuild/wrap/__init__.py
+++ b/mesonbuild/wrap/__init__.py
@@ -40,6 +40,7 @@ string_to_value = {'default': 1,
'nofallback': 2,
'nodownload': 3,
'forcefallback': 4,
+ 'nopromote': 5,
}
class WrapMode(Enum):
@@ -47,6 +48,7 @@ class WrapMode(Enum):
nofallback = 2
nodownload = 3
forcefallback = 4
+ nopromote = 5
def __str__(self) -> str:
return self.name