More tests to cover missing fallback for a non-found dependency

Fix logic so we correctly raise an exception about missing fallback in the
case where the dependency is required.
pull/3818/head
Jon Turney 7 years ago committed by Nirbheek Chauhan
parent 9efdcfbb8d
commit fd4872ae77
  1. 4
      mesonbuild/interpreter.py
  2. 1
      test cases/common/171 not-found dependency/meson.build
  3. 2
      test cases/failing/80 subproj dependency not-found and required/meson.build

@ -2841,7 +2841,7 @@ external dependencies (including libraries) must go to "dependencies".''')
# Unless a fallback exists and is forced ... # Unless a fallback exists and is forced ...
if self.coredata.wrap_mode == WrapMode.forcefallback and 'fallback' in kwargs: if self.coredata.wrap_mode == WrapMode.forcefallback and 'fallback' in kwargs:
exception = DependencyException("fallback for %s not found" % name) pass
# ... search for it outside the project # ... search for it outside the project
elif name != '': elif name != '':
try: try:
@ -2852,6 +2852,8 @@ external dependencies (including libraries) must go to "dependencies".''')
# Search inside the projects list # Search inside the projects list
if not dep.found(): if not dep.found():
if 'fallback' in kwargs: if 'fallback' in kwargs:
if not exception:
exception = DependencyException("fallback for %s not found" % display_name)
fallback_dep = self.dependency_fallback(name, kwargs) fallback_dep = self.dependency_fallback(name, kwargs)
if fallback_dep: if fallback_dep:
# Never add fallback deps to self.coredata.deps since we # Never add fallback deps to self.coredata.deps since we

@ -11,3 +11,4 @@ library('testlib', 'testlib.c', dependencies: [dep])
subdir('sub', if_found: dep) subdir('sub', if_found: dep)
subdep = dependency('', fallback: ['trivial', 'trivial_dep']) subdep = dependency('', fallback: ['trivial', 'trivial_dep'])
missing = dependency('', fallback: ['missing', 'missing_dep'], required: false)

@ -0,0 +1,2 @@
project('dep-test')
missing = dependency('', fallback: ['missing', 'missing_dep'], required: true)
Loading…
Cancel
Save