diff options
author | Tristan Partin <tristan@partin.io> | 2024-05-02 00:01:25 -0500 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2024-05-07 13:20:39 -0700 |
commit | 23eb7ba700cd6c53d5491cc4f99c532629efa1e2 (patch) | |
tree | 2c6ea91e294daf4b0e704eb971fe4be89ae5b11a | |
parent | a0ff14551266c87919f5b4b1469b7be0ef0a052e (diff) | |
download | meson-23eb7ba700cd6c53d5491cc4f99c532629efa1e2.zip meson-23eb7ba700cd6c53d5491cc4f99c532629efa1e2.tar.gz meson-23eb7ba700cd6c53d5491cc4f99c532629efa1e2.tar.bz2 |
Use correct subdir when generating processed file path
We need the subdir of where the output file will actually be created,
not the current subdir of the interpreter.
Fixes: #13168
-rw-r--r-- | mesonbuild/build.py | 6 | ||||
-rw-r--r-- | test cases/common/276 generator custom_tgt subdir/include/meson.build | 4 | ||||
-rw-r--r-- | test cases/common/276 generator custom_tgt subdir/meson.build | 24 |
3 files changed, 29 insertions, 5 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 6f0d6a2..da4c437 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1818,13 +1818,9 @@ class Generator(HoldableObject): env=env if env is not None else EnvironmentVariables()) for e in files: - if isinstance(e, CustomTarget): - output.depends.add(e) - if isinstance(e, CustomTargetIndex): - output.depends.add(e.target) if isinstance(e, (CustomTarget, CustomTargetIndex)): output.depends.add(e) - fs = [File.from_built_file(state.subdir, f) for f in e.get_outputs()] + fs = [File.from_built_file(e.get_subdir(), f) for f in e.get_outputs()] elif isinstance(e, GeneratedList): if preserve_path_from: raise InvalidArguments("generator.process: 'preserve_path_from' is not allowed if one input is a 'generated_list'.") diff --git a/test cases/common/276 generator custom_tgt subdir/include/meson.build b/test cases/common/276 generator custom_tgt subdir/include/meson.build new file mode 100644 index 0000000..251e0ed --- /dev/null +++ b/test cases/common/276 generator custom_tgt subdir/include/meson.build @@ -0,0 +1,4 @@ +test_header = custom_target( + output: 'test_header.h', + command: [python, args, '@OUTPUT@'], +) diff --git a/test cases/common/276 generator custom_tgt subdir/meson.build b/test cases/common/276 generator custom_tgt subdir/meson.build new file mode 100644 index 0000000..38e9635 --- /dev/null +++ b/test cases/common/276 generator custom_tgt subdir/meson.build @@ -0,0 +1,24 @@ +project('276 generator custom_tgt subdir') + +python = find_program('python3', required: true) +args = [ + '-c', + 'import sys; open(sys.argv[1], "w")', + '@OUTPUT0@', +] + +subdir('include') + +gen = generator( + python, + arguments: args + ['@OUTPUT@'], + output: '@PLAINNAME@.t', +) + +custom_target( + 'check-headers.stamp', + command: [python, args, '@INPUT@'], + input: gen.process(test_header), + output: 'check-headers.stamp', + build_by_default: true, +) |