From bcc127b3fd416f97928f72d35c1a731fb3acc91a Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 2 Nov 2022 16:01:42 -0400 Subject: [PATCH] hotdoc module: add dedicated depends kwarg, deprecate file deps in dependencies We consistently use the "dependencies" kwarg to refer to C-like CFLAGS/LDFLAGS interfaces. And for hotdoc, we actually accept libraries for this as well, as we may want to document their (generated?) sources, so we want their CFLAGS too. But we also accepted custom targets and just added a build order dependency on these, which was odd and typically we call that "depends". Let's deprecate this in favor of the depends kwarg. --- mesonbuild/modules/hotdoc.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/mesonbuild/modules/hotdoc.py b/mesonbuild/modules/hotdoc.py index 06eec2a85..800f76648 100644 --- a/mesonbuild/modules/hotdoc.py +++ b/mesonbuild/modules/hotdoc.py @@ -23,7 +23,10 @@ from mesonbuild.coredata import MesonException from . import ModuleReturnValue, ModuleInfo from . import ExtensionModule from ..dependencies import Dependency, InternalDependency -from ..interpreterbase import InvalidArguments, noPosargs, noKwargs, typed_kwargs, ContainerTypeInfo, KwargInfo, typed_pos_args +from ..interpreterbase import ( + InvalidArguments, noPosargs, noKwargs, typed_kwargs, FeatureDeprecated, + ContainerTypeInfo, KwargInfo, typed_pos_args +) from ..interpreter import CustomTargetHolder from ..interpreter.type_checking import NoneType from ..programs import ExternalProgram @@ -290,6 +293,7 @@ class HotdocTargetBuilder: self.process_extra_assets() self.add_extension_paths(self.kwargs.pop('extra_extension_paths')) self.process_subprojects() + self.extra_depends.extend(self.kwargs.pop('depends')) install = self.kwargs.pop('install') self.process_extra_args() @@ -415,10 +419,18 @@ class HotDocModule(ExtensionModule): # --c-include-directories KwargInfo( 'dependencies', - ContainerTypeInfo(list, (Dependency, build.StaticLibrary, build.SharedLibrary)), + ContainerTypeInfo(list, (Dependency, build.StaticLibrary, build.SharedLibrary, + build.CustomTarget, build.CustomTargetIndex)), listify=True, default=[], ), + KwargInfo( + 'depends', + ContainerTypeInfo(list, (build.CustomTarget, build.CustomTargetIndex)), + listify=True, + default=[], + since='0.64.1', + ), KwargInfo('gi_c_source_roots', ContainerTypeInfo(list, str), listify=True, default=[]), KwargInfo('extra_assets', ContainerTypeInfo(list, str), listify=True, default=[]), KwargInfo('extra_extension_paths', ContainerTypeInfo(list, str), listify=True, default=[]), @@ -428,6 +440,9 @@ class HotDocModule(ExtensionModule): ) def generate_doc(self, state, args, kwargs): project_name = args[0] + if any(isinstance(x, (build.CustomTarget, build.CustomTargetIndex)) for x in kwargs['dependencies']): + FeatureDeprecated.single_use('hotdoc.generate_doc dependencies argument with custom_target', + '0.64.1', state.subproject, 'use `depends`', state.current_node) builder = HotdocTargetBuilder(project_name, state, self.hotdoc, self.interpreter, kwargs) target, install_script = builder.make_targets() targets = [target]