Skip to content

Commit

Permalink
interpreter: Don't abort if dep isn't required and sub didn't override
Browse files Browse the repository at this point in the history
  • Loading branch information
xclaesse committed Jul 1, 2020
1 parent f7a07ee commit 7c90639
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions mesonbuild/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3489,8 +3489,12 @@ def get_subproject_dep(self, name, display_name, dirname, varname, kwargs):
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], {})
Expand Down
7 changes: 7 additions & 0 deletions test cases/common/102 subproject subdir/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7c90639

Please sign in to comment.