From 7d1431a06039cb29bc2585929a9fbac58bdedb0e Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Fri, 1 Oct 2021 09:38:52 -0700 Subject: build: plumb structured sources into BuildTargets --- mesonbuild/modules/gnome.py | 16 ++++++++-------- mesonbuild/modules/unstable_rust.py | 11 +++++------ 2 files changed, 13 insertions(+), 14 deletions(-) (limited to 'mesonbuild/modules') diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 486b395..d1729ef 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -607,10 +607,10 @@ class GnomeModule(ExtensionModule): def _get_link_args(self, state: 'ModuleState', lib: T.Union[build.SharedLibrary, build.StaticLibrary], - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']], + depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], include_rpath: bool = False, use_gir_args: bool = False - ) -> T.Tuple[T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']]]: + ) -> T.Tuple[T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]]]: link_command: T.List[str] = [] new_depends = list(depends) # Construct link args @@ -638,12 +638,12 @@ class GnomeModule(ExtensionModule): def _get_dependencies_flags( self, deps: T.Sequence[T.Union['Dependency', build.BuildTarget, build.CustomTarget, build.CustomTargetIndex]], state: 'ModuleState', - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']], + depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]], include_rpath: bool = False, use_gir_args: bool = False, separate_nodedup: bool = False ) -> T.Tuple[OrderedSet[str], OrderedSet[str], OrderedSet[str], T.Optional[T.List[str]], OrderedSet[str], - T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']]]: + T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]]]: cflags: OrderedSet[str] = OrderedSet() internal_ldflags: OrderedSet[str] = OrderedSet() external_ldflags: OrderedSet[str] = OrderedSet() @@ -931,7 +931,7 @@ class GnomeModule(ExtensionModule): girfile: str, scan_command: T.Sequence[T.Union['FileOrString', Executable, ExternalProgram, OverrideProgram]], generated_files: T.Sequence[T.Union[str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex, build.GeneratedList]], - depends: T.Sequence[T.Union['FileOrString', build.BuildTarget, 'build.GeneratedTypes']], + depends: T.Sequence[T.Union['FileOrString', build.BuildTarget, 'build.GeneratedTypes', build.StructuredSources]], kwargs: T.Dict[str, T.Any]) -> GirTarget: install = kwargs['install_gir'] if install is None: @@ -989,8 +989,8 @@ class GnomeModule(ExtensionModule): def _gather_typelib_includes_and_update_depends( state: 'ModuleState', deps: T.Sequence[T.Union[Dependency, build.BuildTarget, build.CustomTarget, build.CustomTargetIndex]], - depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']] - ) -> T.Tuple[T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString']]]: + depends: T.Sequence[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]] + ) -> T.Tuple[T.List[str], T.List[T.Union[build.BuildTarget, 'build.GeneratedTypes', 'FileOrString', build.StructuredSources]]]: # Need to recursively add deps on GirTarget sources from our # dependencies and also find the include directories needed for the # typelib generation custom target below. @@ -1092,7 +1092,7 @@ class GnomeModule(ExtensionModule): srcdir = os.path.join(state.environment.get_source_dir(), state.subdir) builddir = os.path.join(state.environment.get_build_dir(), state.subdir) - depends: T.List[T.Union['FileOrString', 'build.GeneratedTypes', build.BuildTarget]] = [] + depends: T.List[T.Union['FileOrString', 'build.GeneratedTypes', build.BuildTarget, build.StructuredSources]] = [] depends.extend(gir_dep.sources) depends.extend(girtargets) diff --git a/mesonbuild/modules/unstable_rust.py b/mesonbuild/modules/unstable_rust.py index 501273f..f656cd8 100644 --- a/mesonbuild/modules/unstable_rust.py +++ b/mesonbuild/modules/unstable_rust.py @@ -17,7 +17,7 @@ import typing as T from . import ExtensionModule, ModuleReturnValue from .. import mlog -from ..build import BothLibraries, BuildTarget, CustomTargetIndex, Executable, ExtractedObjects, GeneratedList, IncludeDirs, CustomTarget +from ..build import BothLibraries, BuildTarget, CustomTargetIndex, Executable, ExtractedObjects, GeneratedList, IncludeDirs, CustomTarget, StructuredSources from ..dependencies import Dependency, ExternalLibrary from ..interpreter.interpreter import TEST_KWARGS from ..interpreterbase import ContainerTypeInfo, InterpreterException, KwargInfo, FeatureNew, typed_kwargs, typed_pos_args, noPosargs @@ -149,10 +149,9 @@ class RustModule(ExtensionModule): new_target_kwargs['dependencies'] = new_target_kwargs.get('dependencies', []) + dependencies new_target = Executable( - name, base_target.subdir, state.subproject, - base_target.for_machine, base_target.sources, - base_target.objects, base_target.environment, - new_target_kwargs + name, base_target.subdir, state.subproject, base_target.for_machine, + base_target.sources, base_target.structured_sources, + base_target.objects, base_target.environment, new_target_kwargs ) test = self.interpreter.make_test( @@ -203,7 +202,7 @@ class RustModule(ExtensionModule): name: str if isinstance(header, File): name = header.fname - elif isinstance(header, (BuildTarget, BothLibraries, ExtractedObjects)): + elif isinstance(header, (BuildTarget, BothLibraries, ExtractedObjects, StructuredSources)): raise InterpreterException('bindgen source file must be a C header, not an object or build target') else: name = header.get_outputs()[0] -- cgit v1.1