interpreter: Cache found dependency before converting for include_type

Fixes: #8516.
0.57
Xavier Claessens 4 years ago committed by Nirbheek Chauhan
parent 5a367d1135
commit c6dd75a1bd
  1. 14
      mesonbuild/interpreter.py
  2. 5
      test cases/common/239 dependency include_type inconsistency/bar/meson.build
  3. 5
      test cases/common/239 dependency include_type inconsistency/meson.build
  4. 3
      test cases/common/239 dependency include_type inconsistency/subprojects/baz.wrap
  5. 3
      test cases/common/239 dependency include_type inconsistency/subprojects/baz/meson.build
  6. 3
      test cases/common/239 dependency include_type inconsistency/subprojects/foo.wrap
  7. 9
      test cases/common/239 dependency include_type inconsistency/subprojects/foo/meson.build

@ -3775,13 +3775,6 @@ external dependencies (including libraries) must go to "dependencies".''')
if not d.found() and not_found_message:
self.message_impl([not_found_message])
self.message_impl([not_found_message])
# Ensure the correct include type
if 'include_type' in kwargs:
wanted = kwargs['include_type']
actual = d.include_type_method([], {})
if wanted != actual:
mlog.debug('Current include type of {} is {}. Converting to requested {}'.format(name, actual, wanted))
d = d.as_system_method([wanted], {})
# Override this dependency to have consistent results in subsequent
# dependency lookups.
if name and d.found():
@ -3790,6 +3783,13 @@ external dependencies (including libraries) must go to "dependencies".''')
if identifier not in self.build.dependency_overrides[for_machine]:
self.build.dependency_overrides[for_machine][identifier] = \
build.DependencyOverride(d.held_object, node, explicit=False)
# Ensure the correct include type
if 'include_type' in kwargs:
wanted = kwargs['include_type']
actual = d.include_type_method([], {})
if wanted != actual:
mlog.debug('Current include type of {} is {}. Converting to requested {}.format(name, actual, wanted)')
d = d.as_system_method([wanted], {})
return d
def dependency_impl(self, name, display_name, kwargs, force_fallback=False):

@ -0,0 +1,5 @@
baz_dep = dependency('baz',
fallback: ['baz', 'baz_dep'],
include_type: 'system',
method: 'pkg-config', # if we comment this out or change to 'auto' the build is successful
required: false)

@ -0,0 +1,5 @@
project('test', 'c', 'cpp')
foo_dep = subproject('foo').get_variable('foo_dep')
subdir('bar')

@ -0,0 +1,3 @@
[wrap-file]
source_url = http://host.invalid/baz.tar.gz
source_filename = baz.tar.gz

@ -0,0 +1,3 @@
project('baz', 'cpp')
baz_dep = declare_dependency()

@ -0,0 +1,3 @@
[wrap-file]
source_url = http://host.invalid/foo.tar.gz
source_filename = foo.tar.gz

@ -0,0 +1,9 @@
project('foo', 'c', 'cpp')
baz_dep = dependency('baz',
fallback: ['baz', 'baz_dep'],
include_type: 'system',
method: 'pkg-config',
required: false)
foo_dep = declare_dependency(dependencies: baz_dep)
Loading…
Cancel
Save