def build_target(self, node: mparser.BaseNode, args, kwargs, targetclass):

    @FeatureNewKwargs('build target', '0.42.0', ['rust_crate_type', 'build_rpath', 'implicit_include_directories'])
    @FeatureNewKwargs('build target', '0.41.0', ['rust_args'])
    @FeatureNewKwargs('build target', '0.40.0', ['build_by_default'])
    @FeatureNewKwargs('build target', '0.48.0', ['gnu_symbol_visibility'])
    def build_target_decorator_caller(self, node, args, kwargs):
        return True
    build_target_decorator_caller(self, node, args, kwargs)
    if (not args):
        raise InterpreterException('Target does not have a name.')
    (name, *sources) = args
    for_machine = self.machine_from_native_kwarg(kwargs)
    if ('sources' in kwargs):
        sources += listify(kwargs['sources'])
    sources = self.source_strings_to_files(sources)
    objs = extract_as_list(kwargs, 'objects')
    kwargs['dependencies'] = extract_as_list(kwargs, 'dependencies')
    kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs)
    if ('extra_files' in kwargs):
        ef = extract_as_list(kwargs, 'extra_files')
        kwargs['extra_files'] = self.source_strings_to_files(ef)
    self.check_sources_exist(os.path.join(self.source_root, self.subdir), sources)
    if (targetclass not in {build.Executable, build.SharedLibrary, build.SharedModule, build.StaticLibrary, build.Jar}):
        mlog.debug('Unknown target type:', str(targetclass))
        raise RuntimeError('Unreachable code')
    self.kwarg_strings_to_includedirs(kwargs)
    kwargs = {k: v for (k, v) in kwargs.items() if (k in targetclass.known_kwargs)}
    srcs: T.List['SourceInputs'] = []
    struct: T.Optional[build.StructuredSources] = build.StructuredSources()
    for s in sources:
        if isinstance(s, build.StructuredSources):
            struct = (struct + s)
        else:
            srcs.append(s)
    if (not struct):
        struct = None
    else:
        for v in struct.sources.values():
            outputs: T.Set[str] = set()
            for f in v:
                o: T.List[str]
                if isinstance(f, str):
                    o = [os.path.basename(f)]
                elif isinstance(f, mesonlib.File):
                    o = [f.fname]
                else:
                    o = f.get_outputs()
                conflicts = outputs.intersection(o)
                if conflicts:
                    raise InvalidArguments.from_node(f"Conflicting sources in structured sources: {', '.join(sorted(conflicts))}", node=node)
                outputs.update(o)
    kwargs['include_directories'] = self.extract_incdirs(kwargs)
    target = targetclass(name, self.subdir, self.subproject, for_machine, srcs, struct, objs, self.environment, kwargs)
    target.project_version = self.project_version
    self.add_stdlib_info(target)
    self.add_target(name, target)
    self.project_args_frozen = True
    return target
def build_target(self, node: mparser.BaseNode, args, kwargs, targetclass):

    @FeatureNewKwargs('build target', '0.42.0', ['rust_crate_type', 'build_rpath', 'implicit_include_directories'])
    @FeatureNewKwargs('build target', '0.41.0', ['rust_args'])
    @FeatureNewKwargs('build target', '0.40.0', ['build_by_default'])
    @FeatureNewKwargs('build target', '0.48.0', ['gnu_symbol_visibility'])
    def build_target_decorator_caller(self, node, args, kwargs):
        return True
    build_target_decorator_caller(self, node, args, kwargs)
    if (not args):
        raise InterpreterException('Target does not have a name.')
    (name, *sources) = args
    for_machine = self.machine_from_native_kwarg(kwargs)
    if ('sources' in kwargs):
        sources += listify(kwargs['sources'])
    sources = self.source_strings_to_files(sources)
    objs = extract_as_list(kwargs, 'objects')
    kwargs['dependencies'] = extract_as_list(kwargs, 'dependencies')
    kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs)
    if ('extra_files' in kwargs):
        ef = extract_as_list(kwargs, 'extra_files')
        kwargs['extra_files'] = self.source_strings_to_files(ef)
    self.check_sources_exist(os.path.join(self.source_root, self.subdir), sources)
    if (targetclass not in {build.Executable, build.SharedLibrary, build.SharedModule, build.StaticLibrary, build.Jar}):
        mlog.debug('Unknown target type:', str(targetclass))
        raise RuntimeError('Unreachable code')
    self.kwarg_strings_to_includedirs(kwargs)
    kwargs = {k: v for (k, v) in kwargs.items() if (k in targetclass.known_kwargs)}
    srcs: T.List['SourceInputs'] = []
    struct: T.Optional[build.StructuredSources] = build.StructuredSources()
    for s in sources:
        if isinstance(s, build.StructuredSources):
            struct = (struct + s)
        else:
            srcs.append(s)
    if (not struct):
        struct = None
    else:
        for v in struct.sources.values():
            outputs: T.Set[str] = set()
            for f in v:
                o: T.List[str]
                if isinstance(f, str):
                    o = [os.path.basename(f)]
                elif isinstance(f, mesonlib.File):
                    o = [f.fname]
                else:
                    o = f.get_outputs()
                conflicts = outputs.intersection(o)
                if conflicts:
                    raise InvalidArguments.from_node(f"Conflicting sources in structured sources: {', '.join(sorted(conflicts))}", node=node)
                outputs.update(o)
    kwargs['include_directories'] = self.extract_incdirs(kwargs)
    target = targetclass(name, self.subdir, self.subproject, for_machine, srcs, struct, objs, self.environment, kwargs)
    target.project_version = self.project_version
    self.add_stdlib_info(target)
    self.add_target(name, target)
    self.project_args_frozen = True
    return target