allow internal_dependency object to carry both_lib

Otherwise, the both_libs object is resolved by the interpreter and we no
longer have access to it from the dependency object.
pull/13609/head
Charles Brunet 12 months ago committed by Dylan Baker
parent 83f8de5357
commit 7b3169f464
  1. 16
      mesonbuild/build.py
  2. 1
      mesonbuild/interpreter/interpreter.py

@ -137,6 +137,15 @@ def get_target_macos_dylib_install_name(ld) -> str:
name.append('.dylib')
return ''.join(name)
def extract_targets_as_list(
kwargs: T.Dict[str, T.Sequence[LibTypes]],
key: T.Literal['link_with', 'link_whole'],
self_libs: T.List[LibTypes]) -> T.List[LibTypes]:
lib_list = listify(kwargs.get(key, [])) + self_libs
return [t.get_default_object() if isinstance(t, BothLibraries) else t for t in lib_list]
class InvalidArguments(MesonException):
pass
@ -782,8 +791,8 @@ class BuildTarget(Target):
# we have to call process_compilers() first and we need to process libraries
# from link_with and link_whole first.
# See https://github.com/mesonbuild/meson/pull/11957#issuecomment-1629243208.
link_targets = extract_as_list(kwargs, 'link_with') + self.link_targets
link_whole_targets = extract_as_list(kwargs, 'link_whole') + self.link_whole_targets
link_targets = extract_targets_as_list(kwargs, 'link_with', self.link_targets)
link_whole_targets = extract_targets_as_list(kwargs, 'link_whole', self.link_whole_targets)
self.link_targets.clear()
self.link_whole_targets.clear()
self.link(link_targets)
@ -2493,6 +2502,9 @@ class BothLibraries(SecondLevelHolder):
return self.static
raise MesonBugException(f'self._preferred_library == "{self._preferred_library}" is neither "shared" nor "static".')
def get_id(self) -> str:
return self.get_default_object().get_id()
class CommandBase:
depend_files: T.List[File]

@ -690,6 +690,7 @@ class Interpreter(InterpreterBase, HoldableObject):
KwargInfo('version', (str, NoneType)),
KwargInfo('objects', ContainerTypeInfo(list, build.ExtractedObjects), listify=True, default=[], since='1.1.0'),
)
@noSecondLevelHolderResolving
def func_declare_dependency(self, node: mparser.BaseNode, args: T.List[TYPE_var],
kwargs: kwtypes.FuncDeclareDependency) -> dependencies.Dependency:
deps = kwargs['dependencies']

Loading…
Cancel
Save