Allow custom_target do depend on indexed output of custom_target

Fixes: #3494
pull/3510/head
Niklas Claesson 7 years ago committed by Nirbheek Chauhan
parent 8c381e1786
commit 4f4cdee687
  1. 2
      mesonbuild/backend/backends.py
  2. 2
      mesonbuild/build.py
  3. 18
      test cases/common/161 index customtarget/check_args.py
  4. 7
      test cases/common/161 index customtarget/meson.build

@ -764,7 +764,7 @@ class Backend:
fname = [os.path.join(self.build_to_src, target.subdir, i)]
elif isinstance(i, build.BuildTarget):
fname = [self.get_target_filename(i)]
elif isinstance(i, build.CustomTarget):
elif isinstance(i, (build.CustomTarget, build.CustomTargetIndex)):
fname = [os.path.join(self.get_target_dir(i), p) for p in i.get_outputs()]
elif isinstance(i, build.GeneratedList):
fname = [os.path.join(self.get_target_private_dir(target), p) for p in i.get_outputs()]

@ -1974,7 +1974,7 @@ def get_sources_string_names(sources):
s = s.held_object
if isinstance(s, str):
names.append(s)
elif isinstance(s, (BuildTarget, CustomTarget, GeneratedList)):
elif isinstance(s, (BuildTarget, CustomTarget, CustomTargetIndex, GeneratedList)):
names += s.get_outputs()
elif isinstance(s, File):
names.append(s.fname)

@ -0,0 +1,18 @@
#!python3
import sys
from pathlib import Path
def main():
if len(sys.argv) != 2:
print(sys.argv)
return 1
if sys.argv[1] != 'gen.c':
print(sys.argv)
return 2
Path('foo').touch()
return 0
if __name__ == '__main__':
sys.exit(main())

@ -29,4 +29,11 @@ lib = static_library(
['lib.c', gen[1]],
)
custom_target(
'foo',
input: gen[0],
output: 'foo',
command: [find_program('check_args.py'), '@INPUT@'],
)
subdir('subdir')

Loading…
Cancel
Save