aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Reference-manual.md2
-rw-r--r--mesonbuild/build.py3
-rw-r--r--test cases/common/151 list of file sources/foo1
-rw-r--r--test cases/common/151 list of file sources/gen.py7
-rw-r--r--test cases/common/151 list of file sources/meson.build12
5 files changed, 22 insertions, 3 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md
index 7e46da1..01f991d 100644
--- a/docs/markdown/Reference-manual.md
+++ b/docs/markdown/Reference-manual.md
@@ -137,7 +137,7 @@ These are all the supported keyword arguments:
Create a custom top level build target. The only positional argument is the name of this target and the keyword arguments are the following.
-- `input` list of source files
+- `input` list of source files. As of 0.41.0 the list will be flattened.
- `output` list of output files
- `command` command to run to create outputs from inputs. The command may be strings or the return of `find_program()` or `executable()` (note: always specify commands in array form `['commandname', '-arg1', '-arg2']` rather than as a string `'commandname -arg1 -arg2'` as the latter will *not* work)
- `install` when true, this target is installed during the install step
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index 41fd8c1..59459bf 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -1439,8 +1439,7 @@ class CustomTarget(Target):
def process_kwargs(self, kwargs):
super().process_kwargs(kwargs)
self.sources = kwargs.get('input', [])
- if not isinstance(self.sources, list):
- self.sources = [self.sources]
+ self.sources = flatten(self.sources)
if 'output' not in kwargs:
raise InvalidArguments('Missing keyword argument "output".')
self.outputs = kwargs['output']
diff --git a/test cases/common/151 list of file sources/foo b/test cases/common/151 list of file sources/foo
new file mode 100644
index 0000000..7b57bd2
--- /dev/null
+++ b/test cases/common/151 list of file sources/foo
@@ -0,0 +1 @@
+some text
diff --git a/test cases/common/151 list of file sources/gen.py b/test cases/common/151 list of file sources/gen.py
new file mode 100644
index 0000000..2337d3d
--- /dev/null
+++ b/test cases/common/151 list of file sources/gen.py
@@ -0,0 +1,7 @@
+import shutil
+import sys
+
+if __name__ == '__main__':
+ if len(sys.argv) != 3:
+ raise Exception('Requires exactly 2 args')
+ shutil.copy2(sys.argv[1], sys.argv[2])
diff --git a/test cases/common/151 list of file sources/meson.build b/test cases/common/151 list of file sources/meson.build
new file mode 100644
index 0000000..819509d
--- /dev/null
+++ b/test cases/common/151 list of file sources/meson.build
@@ -0,0 +1,12 @@
+project('test', 'c')
+
+mod_py = import('python3')
+python = mod_py.find_python()
+
+test_target = custom_target(
+ 'test_target',
+ input : [files('gen.py'), files('foo')],
+ output : 'bar',
+ command : [python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'],
+ build_by_default : true,
+)