@FeatureNewKwargs('declare_dependency', '0.46.0', ['link_whole'])
@FeatureNewKwargs('declare_dependency', '0.54.0', ['variables'])
@permittedKwargs(permitted_kwargs['declare_dependency'])
@noPosargs
def func_declare_dependency(self, node, args, kwargs):
    version = kwargs.get('version', self.project_version)
    if (not isinstance(version, str)):
        raise InterpreterException('Version must be a string.')
    incs = self.extract_incdirs(kwargs)
    libs = unholder(extract_as_list(kwargs, 'link_with'))
    libs_whole = unholder(extract_as_list(kwargs, 'link_whole'))
    sources = extract_as_list(kwargs, 'sources')
    sources = unholder(listify(self.source_strings_to_files(sources)))
    deps = unholder(extract_as_list(kwargs, 'dependencies'))
    compile_args = mesonlib.stringlistify(kwargs.get('compile_args', []))
    link_args = mesonlib.stringlistify(kwargs.get('link_args', []))
    variables = kwargs.get('variables', {})
    if (not isinstance(variables, dict)):
        raise InterpreterException('variables must be a dict.')
    if (not all((isinstance(v, str) for v in variables.values()))):
        raise InterpreterException('variables values be strings.')
    final_deps = []
    for d in deps:
        try:
            d = d.held_object
        except Exception:
            pass
        if (not isinstance(d, (dependencies.Dependency, dependencies.ExternalLibrary, dependencies.InternalDependency))):
            raise InterpreterException('Dependencies must be external deps')
        final_deps.append(d)
    for l in libs:
        if isinstance(l, dependencies.Dependency):
            raise InterpreterException('Entries in "link_with" may only be self-built targets,\nexternal dependencies (including libraries) must go to "dependencies".')
    dep = dependencies.InternalDependency(version, incs, compile_args, link_args, libs, libs_whole, sources, final_deps, variables)
    return DependencyHolder(dep, self.subproject)
@FeatureNewKwargs('declare_dependency', '0.46.0', ['link_whole'])
@FeatureNewKwargs('declare_dependency', '0.54.0', ['variables'])
@permittedKwargs(permitted_kwargs['declare_dependency'])
@noPosargs
def func_declare_dependency(self, node, args, kwargs):
    version = kwargs.get('version', self.project_version)
    if (not isinstance(version, str)):
        raise InterpreterException('Version must be a string.')
    incs = self.extract_incdirs(kwargs)
    libs = unholder(extract_as_list(kwargs, 'link_with'))
    libs_whole = unholder(extract_as_list(kwargs, 'link_whole'))
    sources = extract_as_list(kwargs, 'sources')
    sources = unholder(listify(self.source_strings_to_files(sources)))
    deps = unholder(extract_as_list(kwargs, 'dependencies'))
    compile_args = mesonlib.stringlistify(kwargs.get('compile_args', []))
    link_args = mesonlib.stringlistify(kwargs.get('link_args', []))
    variables = kwargs.get('variables', {})
    if (not isinstance(variables, dict)):
        raise InterpreterException('variables must be a dict.')
    if (not all((isinstance(v, str) for v in variables.values()))):
        raise InterpreterException('variables values be strings.')
    final_deps = []
    for d in deps:
        try:
            d = d.held_object
        except Exception:
            pass
        if (not isinstance(d, (dependencies.Dependency, dependencies.ExternalLibrary, dependencies.InternalDependency))):
            raise InterpreterException('Dependencies must be external deps')
        final_deps.append(d)
    for l in libs:
        if isinstance(l, dependencies.Dependency):
            raise InterpreterException('Entries in "link_with" may only be self-built targets,\nexternal dependencies (including libraries) must go to "dependencies".')
    dep = dependencies.InternalDependency(version, incs, compile_args, link_args, libs, libs_whole, sources, final_deps, variables)
    return DependencyHolder(dep, self.subproject)