diff options
author | Niklas Claesson <nicke.claesson@gmail.com> | 2018-05-01 13:51:55 +0200 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-05-01 11:51:55 +0000 |
commit | 4f4cdee6876148b14a430e5886fec45299bb0573 (patch) | |
tree | f5dbe7faf3f6eb531f218928447fb250e0805e1f | |
parent | 8c381e1786d0fbeb2136187c6d98f4000e8962bf (diff) | |
download | meson-4f4cdee6876148b14a430e5886fec45299bb0573.tar.gz |
Allow custom_target do depend on indexed output of custom_target
Fixes: #3494
-rw-r--r-- | mesonbuild/backend/backends.py | 2 | ||||
-rw-r--r-- | mesonbuild/build.py | 2 | ||||
-rw-r--r-- | test cases/common/161 index customtarget/check_args.py | 18 | ||||
-rw-r--r-- | test cases/common/161 index customtarget/meson.build | 7 |
4 files changed, 27 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 2fd028d6d..ed7c11861 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -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()] diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 352f85723..3d531d181 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -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) diff --git a/test cases/common/161 index customtarget/check_args.py b/test cases/common/161 index customtarget/check_args.py new file mode 100644 index 000000000..8663a6fe2 --- /dev/null +++ b/test cases/common/161 index customtarget/check_args.py @@ -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()) diff --git a/test cases/common/161 index customtarget/meson.build b/test cases/common/161 index customtarget/meson.build index 11cb214b2..27d28b56a 100644 --- a/test cases/common/161 index customtarget/meson.build +++ b/test cases/common/161 index customtarget/meson.build @@ -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') |