diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index fd0385d74..50d6148da 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -3098,7 +3098,7 @@ root and issuing %s. regex_selector] + vcs_cmd kwargs.setdefault('build_by_default', 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') @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') 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) + 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] kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs) tg = CustomTargetHolder(build.CustomTarget(name, self.subdir, self.subproject, kwargs), self) diff --git a/run_unittests.py b/run_unittests.py index 6e5017271..45b48f3b3 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -2761,6 +2761,16 @@ class FailureTests(BasePlatformTests): ".*WARNING.*Project targetting.*but.*", 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): '''