@FeatureNewKwargs('declare_dependency', '0.46.0', ['link_whole'])
@FeatureNewKwargs('declare_dependency', '0.54.0', ['variables'])
@FeatureNewKwargs('declare_dependency', '0.62.0', ['d_module_versions', 'd_import_dirs'])
@permittedKwargs({'include_directories', 'link_with', 'sources', 'dependencies', 'compile_args', 'link_args', 'link_whole', 'version', 'variables', 'd_module_versions', 'd_import_dirs'})
@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 = extract_as_list(kwargs, 'link_with')
    libs_whole = extract_as_list(kwargs, 'link_whole')
    sources = extract_as_list(kwargs, 'sources')
    sources = listify(self.source_strings_to_files(sources))
    deps = extract_as_list(kwargs, 'dependencies')
    compile_args = mesonlib.stringlistify(kwargs.get('compile_args', []))
    link_args = mesonlib.stringlistify(kwargs.get('link_args', []))
    variables = self.extract_variables(kwargs, list_new=True)
    d_module_versions = extract_as_list(kwargs, 'd_module_versions')
    d_import_dirs = self.extract_incdirs(kwargs, 'd_import_dirs')
    final_deps = []
    for d in deps:
        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, d_module_versions, d_import_dirs)
    return dep
@FeatureNewKwargs('declare_dependency', '0.46.0', ['link_whole'])
@FeatureNewKwargs('declare_dependency', '0.54.0', ['variables'])
@FeatureNewKwargs('declare_dependency', '0.62.0', ['d_module_versions', 'd_import_dirs'])
@permittedKwargs({'include_directories', 'link_with', 'sources', 'dependencies', 'compile_args', 'link_args', 'link_whole', 'version', 'variables', 'd_module_versions', 'd_import_dirs'})
@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 = extract_as_list(kwargs, 'link_with')
    libs_whole = extract_as_list(kwargs, 'link_whole')
    sources = extract_as_list(kwargs, 'sources')
    sources = listify(self.source_strings_to_files(sources))
    deps = extract_as_list(kwargs, 'dependencies')
    compile_args = mesonlib.stringlistify(kwargs.get('compile_args', []))
    link_args = mesonlib.stringlistify(kwargs.get('link_args', []))
    variables = self.extract_variables(kwargs, list_new=True)
    d_module_versions = extract_as_list(kwargs, 'd_module_versions')
    d_import_dirs = self.extract_incdirs(kwargs, 'd_import_dirs')
    final_deps = []
    for d in deps:
        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, d_module_versions, d_import_dirs)
    return dep