new wrap-mode: forcefallback

This can be useful to make sure that a project builds when
its fallbacks are used on systems where external dependencies
satisfy the version requirements, or to easily hack on the sources
of a dependency for which a fallback exists.
pull/3312/head
Mathieu Duponchelle 7 years ago
parent aef1a81b35
commit 31f0242a6f
  1. 2
      data/shell-completions/zsh/_meson
  2. 6
      docs/markdown/FAQ.md
  3. 3
      docs/markdown/snippets/new-wrap-mode.md
  4. 3
      mesonbuild/interpreter.py
  5. 7
      mesonbuild/wrap/__init__.py

@ -31,7 +31,7 @@ local -i ret
local __meson_backends="(ninja xcode ${(j. .)${:-vs{,2010,2015,2017}}})" local __meson_backends="(ninja xcode ${(j. .)${:-vs{,2010,2015,2017}}})"
local __meson_build_types="(plain debug debugoptimized minsize release)" local __meson_build_types="(plain debug debugoptimized minsize release)"
local __meson_wrap_modes="(WrapMode.{default,nofallback,nodownload})" local __meson_wrap_modes="(WrapMode.{default,nofallback,nodownload,forcefallback})"
local -a meson_commands=( local -a meson_commands=(
'setup:set up a build directory' 'setup:set up a build directory'

@ -288,3 +288,9 @@ has a option called `wrap-mode` which can be used to disable wrap
downloads altogether with `--wrap-mode=nodownload`. You can also downloads altogether with `--wrap-mode=nodownload`. You can also
disable dependency fallbacks altogether with `--wrap-mode=nofallback`, disable dependency fallbacks altogether with `--wrap-mode=nofallback`,
which also implies the `nodownload` option. which also implies the `nodownload` option.
If on the other hand, you want meson to always use the fallback
for dependencies, even when an external dependency exists and could
satisfy the version requirements, for example in order to make
sure your project builds when fallbacks are used, you can use
`--wrap-mode=forcefallback`.

@ -0,0 +1,3 @@
A new wrap mode was added, `--wrap-mode=forcefallback`. When this is set,
dependencies for which a fallback was provided will always use it, even
if an external dependency exists and satisfies the version requirements.

@ -2404,10 +2404,13 @@ to directly access options of other subprojects.''')
dep = None dep = None
# Search for it outside the project # Search for it outside the project
if self.coredata.wrap_mode != WrapMode.forcefallback or 'fallback' not in kwargs:
try: try:
dep = dependencies.find_external_dependency(name, self.environment, kwargs) dep = dependencies.find_external_dependency(name, self.environment, kwargs)
except DependencyException as e: except DependencyException as e:
exception = e exception = e
else:
exception = DependencyException("fallback for %s not found" % name)
# Search inside the projects list # Search inside the projects list
if not dep or not dep.found(): if not dep or not dep.found():

@ -25,7 +25,12 @@ from enum import Enum
# to use 'nofallback' so that any 'copylib' wraps will be # to use 'nofallback' so that any 'copylib' wraps will be
# download as subprojects. # download as subprojects.
# #
# --wrap-mode=forcefallback will ignore external dependencies,
# even if they match the version requirements, and automatically
# use the fallback if one was provided. This is useful for example
# to make sure a project builds when using the fallbacks.
#
# Note that these options do not affect subprojects that # Note that these options do not affect subprojects that
# are git submodules since those are only usable in git # are git submodules since those are only usable in git
# repositories, and you almost always want to download them. # repositories, and you almost always want to download them.
WrapMode = Enum('WrapMode', 'default nofallback nodownload') WrapMode = Enum('WrapMode', 'default nofallback nodownload forcefallback')

Loading…
Cancel
Save