Fix FeatureNew false positive in vcs_tag

Fixes https://github.com/mesonbuild/meson/issues/3904
pull/4015/head
Nirbheek Chauhan 6 years ago committed by Nirbheek Chauhan
parent 41bb5941e1
commit ecede89b5d
  1. 6
      mesonbuild/interpreter.py
  2. 10
      run_unittests.py

@ -3098,7 +3098,7 @@ root and issuing %s.
regex_selector] + vcs_cmd regex_selector] + vcs_cmd
kwargs.setdefault('build_by_default', True) kwargs.setdefault('build_by_default', True)
kwargs.setdefault('build_always_stale', True) kwargs.setdefault('build_always_stale', True)
return self.func_custom_target(node, [kwargs['output']], kwargs) return self._func_custom_target_impl(node, [kwargs['output']], kwargs)
@FeatureNew('subdir_done', '0.46.0') @FeatureNew('subdir_done', '0.46.0')
@stringArgs @stringArgs
@ -3119,6 +3119,10 @@ root and issuing %s.
raise InterpreterException('custom_target: Only one positional argument is allowed, and it must be a string name') raise InterpreterException('custom_target: Only one positional argument is allowed, and it must be a string name')
if 'depfile' in kwargs and ('@BASENAME@' in kwargs['depfile'] or '@PLAINNAME@' in kwargs['depfile']): if 'depfile' in kwargs and ('@BASENAME@' in kwargs['depfile'] or '@PLAINNAME@' in kwargs['depfile']):
FeatureNew('substitutions in custom_target depfile', '0.47.0').use(self.subproject) FeatureNew('substitutions in custom_target depfile', '0.47.0').use(self.subproject)
return self._func_custom_target_impl(node, args, kwargs)
def _func_custom_target_impl(self, node, args, kwargs):
'Implementation-only, without FeatureNew checks, for internal use'
name = args[0] name = args[0]
kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs) kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs)
tg = CustomTargetHolder(build.CustomTarget(name, self.subdir, self.subproject, kwargs), self) tg = CustomTargetHolder(build.CustomTarget(name, self.subdir, self.subproject, kwargs), self)

@ -2761,6 +2761,16 @@ class FailureTests(BasePlatformTests):
".*WARNING.*Project targetting.*but.*", ".*WARNING.*Project targetting.*but.*",
meson_version='>= 0.41.0') meson_version='>= 0.41.0')
def test_vcs_tag_featurenew_build_always_stale(self):
'https://github.com/mesonbuild/meson/issues/3904'
vcs_tag = '''version_data = configuration_data()
version_data.set('PROJVER', '@VCS_TAG@')
vf = configure_file(output : 'version.h.in', configuration: version_data)
f = vcs_tag(input : vf, output : 'version.h')
'''
msg = '.*WARNING:.*feature.*build_always_stale.*custom_target.*'
self.assertMesonDoesNotOutput(vcs_tag, msg, meson_version='>=0.43')
class WindowsTests(BasePlatformTests): class WindowsTests(BasePlatformTests):
''' '''

Loading…
Cancel
Save