Store run target names in build.

This way we can easily check that we only provide builtin targets such
as clang-format if the user has not provided their own.
pull/6167/head
Jussi Pakkanen 5 yıl önce
ebeveyn 1238b16c8e
işleme 35e809fc5e
  1. 6
      mesonbuild/backend/ninjabackend.py
  2. 1
      mesonbuild/build.py
  3. 3
      mesonbuild/interpreter.py
  4. 7
      test cases/common/54 run target/meson.build

@ -2648,6 +2648,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
def generate_scanbuild(self):
if not environment.detect_scanbuild():
return
if ('', 'scan-build') in self.build.run_target_names:
return
cmd = self.environment.get_build_command() + \
['--internal', 'scanbuild', self.environment.source_dir, self.environment.build_dir] + \
self.environment.get_build_command() + self.get_user_option_args()
@ -2665,6 +2667,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
return
if target_name in self.all_outputs:
return
if ('', target_name) in self.build.run_target_names:
return
cmd = self.environment.get_build_command() + \
['--internal', 'clang' + name, self.environment.source_dir, self.environment.build_dir]
elem = NinjaBuildElement(self.all_outputs, 'meson-' + target_name, 'CUSTOM_COMMAND', 'PHONY')
@ -2688,6 +2692,8 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
import shutil
if not shutil.which(tool):
return
if ('', target_name) in self.build.run_target_names:
return
if target_name in self.all_outputs:
return
cmd = self.environment.get_build_command() + \

@ -117,6 +117,7 @@ class Build:
self.environment = environment
self.projects = {}
self.targets = OrderedDict()
self.run_target_names = set() # type: typing.Set[typing.Tuple[str, str]]
self.global_args = PerMachine({}, {}) # type: PerMachine[typing.Dict[str, typing.List[str]]]
self.projects_args = PerMachine({}, {}) # type: PerMachine[typing.Dict[str, typing.List[str]]]
self.global_link_args = PerMachine({}, {}) # type: PerMachine[typing.Dict[str, typing.List[str]]]

@ -3369,6 +3369,9 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
command, *cmd_args = cleaned_args
tg = RunTargetHolder(build.RunTarget(name, command, cmd_args, cleaned_deps, self.subdir, self.subproject), self)
self.add_target(name, tg.held_object)
full_name = (self.subproject, name)
assert(full_name not in self.build.run_target_names)
self.build.run_target_names.add(full_name)
return tg
@FeatureNew('alias_target', '0.52.0')

@ -65,3 +65,10 @@ conf = configure_file(
run_target('configure_script',
command : conf
)
# Target names that clash with potential builtin functionality.
run_target('ctags',
command : converter)
run_target('clang-format',
command : converter)

Yükleniyor…
İptal
Kaydet