Add wrap mode to disable auto promote

pull/6968/head
Xavier Claessens 4 years ago
parent a20d7ad67d
commit 173c115834
  1. 2
      docs/markdown/Builtin-options.md
  2. 7
      docs/markdown/Subprojects.md
  3. 4
      docs/markdown/snippets/subsubproject.md
  4. 13
      mesonbuild/interpreter.py
  5. 2
      mesonbuild/wrap/__init__.py

@ -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>

@ -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*

@ -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`.

@ -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))

@ -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

Loading…
Cancel
Save