@noPosargs
@typed_kwargs('vcs_tag', CT_INPUT_KW.evolve(required=True), CT_OUTPUT_KW, KwargInfo('command', ContainerTypeInfo(list, (str, build.BuildTarget, build.CustomTarget, build.CustomTargetIndex, ExternalProgram, mesonlib.File)), listify=True, default=[]), KwargInfo('fallback', (str, NoneType)), KwargInfo('replace_string', str, default='@VCS_TAG@'))
def func_vcs_tag(self, node: mparser.BaseNode, args: T.List['TYPE_var'], kwargs: 'kwargs.VcsTag') -> build.CustomTarget:
    if (kwargs['fallback'] is None):
        FeatureNew.single_use('Optional fallback in vcs_tag', '0.41.0', self.subproject, location=node)
    fallback = (kwargs['fallback'] or self.project_version)
    replace_string = kwargs['replace_string']
    regex_selector = '(.*)'
    vcs_cmd = kwargs['command']
    source_dir = os.path.normpath(os.path.join(self.environment.get_source_dir(), self.subdir))
    if vcs_cmd:
        if isinstance(vcs_cmd[0], mesonlib.File):
            FeatureNew.single_use('vcs_tag with file as the first argument', '0.62.0', self.subproject, location=node)
        maincmd = self.find_program_impl(vcs_cmd[0], required=False)
        if maincmd.found():
            vcs_cmd[0] = maincmd
    else:
        vcs = mesonlib.detect_vcs(source_dir)
        if vcs:
            mlog.log('Found {} repository at {}'.format(vcs['name'], vcs['wc_dir']))
            vcs_cmd = vcs['get_rev'].split()
            regex_selector = vcs['rev_regex']
        else:
            vcs_cmd = [' ']
    self._validate_custom_target_outputs((len(kwargs['input']) > 1), kwargs['output'], 'vcs_tag')
    tg = build.CustomTarget(kwargs['output'][0], self.subdir, self.subproject, ((self.environment.get_build_command() + ['--internal', 'vcstagger', '@INPUT0@', '@OUTPUT0@', fallback, source_dir, replace_string, regex_selector]) + vcs_cmd), self.source_strings_to_files(kwargs['input']), kwargs['output'], build_by_default=True, build_always_stale=True)
    self.add_target(tg.name, tg)
    return tg
@noPosargs
@typed_kwargs('vcs_tag', CT_INPUT_KW.evolve(required=True), CT_OUTPUT_KW, KwargInfo('command', ContainerTypeInfo(list, (str, build.BuildTarget, build.CustomTarget, build.CustomTargetIndex, ExternalProgram, mesonlib.File)), listify=True, default=[]), KwargInfo('fallback', (str, NoneType)), KwargInfo('replace_string', str, default='@VCS_TAG@'))
def func_vcs_tag(self, node: mparser.BaseNode, args: T.List['TYPE_var'], kwargs: 'kwargs.VcsTag') -> build.CustomTarget:
    if (kwargs['fallback'] is None):
        FeatureNew.single_use('Optional fallback in vcs_tag', '0.41.0', self.subproject, location=node)
    fallback = (kwargs['fallback'] or self.project_version)
    replace_string = kwargs['replace_string']
    regex_selector = '(.*)'
    vcs_cmd = kwargs['command']
    source_dir = os.path.normpath(os.path.join(self.environment.get_source_dir(), self.subdir))
    if vcs_cmd:
        if isinstance(vcs_cmd[0], mesonlib.File):
            FeatureNew.single_use('vcs_tag with file as the first argument', '0.62.0', self.subproject, location=node)
        maincmd = self.find_program_impl(vcs_cmd[0], required=False)
        if maincmd.found():
            vcs_cmd[0] = maincmd
    else:
        vcs = mesonlib.detect_vcs(source_dir)
        if vcs:
            mlog.log('Found {} repository at {}'.format(vcs['name'], vcs['wc_dir']))
            vcs_cmd = vcs['get_rev'].split()
            regex_selector = vcs['rev_regex']
        else:
            vcs_cmd = [' ']
    self._validate_custom_target_outputs((len(kwargs['input']) > 1), kwargs['output'], 'vcs_tag')
    tg = build.CustomTarget(kwargs['output'][0], self.subdir, self.subproject, ((self.environment.get_build_command() + ['--internal', 'vcstagger', '@INPUT0@', '@OUTPUT0@', fallback, source_dir, replace_string, regex_selector]) + vcs_cmd), self.source_strings_to_files(kwargs['input']), kwargs['output'], build_by_default=True, build_always_stale=True)
    self.add_target(tg.name, tg)
    return tg