interpreter: Don't abort if dep isn't required and sub didn't override

pull/6902/head
Xavier Claessens 4 years ago
parent f7a07ee91a
commit 7c90639078
  1. 8
      mesonbuild/interpreter.py
  2. 7
      test cases/common/102 subproject subdir/meson.build
  3. 2
      test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap

@ -3489,8 +3489,12 @@ external dependencies (including libraries) must go to "dependencies".''')
raise DependencyException(m.format(display_name))
return DependencyHolder(cached_dep, self.subproject)
else:
m = 'Subproject {} did not override dependency {}'
raise DependencyException(m.format(subproj_path, display_name))
if required:
m = 'Subproject {} did not override dependency {}'
raise DependencyException(m.format(subproj_path, display_name))
mlog.log('Dependency', mlog.bold(display_name), 'from subproject',
mlog.bold(subproj_path), 'found:', mlog.red('NO'))
return self.notfound_dependency()
if subproject.found():
self.verify_fallback_consistency(dirname, varname, cached_dep)
dep = self.subprojects[dirname].get_variable_method([varname], {})

@ -47,3 +47,10 @@ assert(d.found(), 'Should implicitly fallback')
d = dependency('glib-2.0', required : false)
assert(d.found())
assert(d.type_name() == 'internal')
# sub_implicit.wrap provides gobject-2.0 and we already configured that subproject,
# so we must not return the system dependency here. But since the subproject did
# not override that dependency and its not required, not-found should be returned.
# Using gobject-2.0 here because some CI runners have it installed.
d = dependency('gobject-2.0', required : false)
assert(not d.found())

@ -2,5 +2,5 @@
[provide]
glib-2.0 = glib_dep
dependency_names = sub_implicit_provide1
dependency_names = sub_implicit_provide1, gobject-2.0
sub_implicit_provide2 = sub_implicit_provide2_dep

Loading…
Cancel
Save