backends: Treat build target as generator only when it's the first arg

Otherwise it might be an argument to a script that just inspects the
binary itself.
pull/7723/head
Nirbheek Chauhan 4 years ago committed by Nirbheek Chauhan
parent 9b8ac9db32
commit faba48d853
  1. 8
      mesonbuild/backend/backends.py
  2. 2
      mesonbuild/backend/ninjabackend.py
  3. 2
      mesonbuild/backend/vs2010backend.py

@ -919,9 +919,9 @@ class Backend:
if delta > 0.001:
raise MesonException('Clock skew detected. File {} has a time stamp {:.4f}s in the future.'.format(absf, delta))
def build_target_to_cmd_array(self, bt):
def build_target_to_cmd_array(self, bt, check_cross):
if isinstance(bt, build.BuildTarget):
if isinstance(bt, build.Executable) and bt.for_machine is not MachineChoice.BUILD:
if check_cross and isinstance(bt, build.Executable) and bt.for_machine is not MachineChoice.BUILD:
if (self.environment.is_cross_build() and
self.environment.exe_wrapper is None and
self.environment.need_exe_wrapper()):
@ -1061,9 +1061,11 @@ class Backend:
inputs = self.get_custom_target_sources(target)
# Evaluate the command list
cmd = []
index = -1
for i in target.command:
index += 1
if isinstance(i, build.BuildTarget):
cmd += self.build_target_to_cmd_array(i)
cmd += self.build_target_to_cmd_array(i, (index == 0))
continue
elif isinstance(i, build.CustomTarget):
# GIR scanner will attempt to execute this binary but

@ -1977,7 +1977,7 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
generator = genlist.get_generator()
subdir = genlist.subdir
exe = generator.get_exe()
exe_arr = self.build_target_to_cmd_array(exe)
exe_arr = self.build_target_to_cmd_array(exe, True)
infilelist = genlist.get_inputs()
outfilelist = genlist.get_outputs()
extra_dependencies = self.get_custom_target_depend_files(genlist)

@ -121,7 +121,7 @@ class Vs2010Backend(backends.Backend):
infilelist = genlist.get_inputs()
outfilelist = genlist.get_outputs()
source_dir = os.path.join(down, self.build_to_src, genlist.subdir)
exe_arr = self.build_target_to_cmd_array(exe)
exe_arr = self.build_target_to_cmd_array(exe, True)
idgroup = ET.SubElement(parent_node, 'ItemGroup')
for i in range(len(infilelist)):
if len(infilelist) == len(outfilelist):

Loading…
Cancel
Save