summaryrefslogtreecommitdiffstats
path: root/test cases/common/71 ctarget dependency
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/common/71 ctarget dependency')
-rwxr-xr-xtest cases/common/71 ctarget dependency/gen1.py12
-rwxr-xr-xtest cases/common/71 ctarget dependency/gen2.py10
-rw-r--r--test cases/common/71 ctarget dependency/input.dat1
-rw-r--r--test cases/common/71 ctarget dependency/meson.build20
4 files changed, 43 insertions, 0 deletions
diff --git a/test cases/common/71 ctarget dependency/gen1.py b/test cases/common/71 ctarget dependency/gen1.py
new file mode 100755
index 0000000..dbadb6d
--- /dev/null
+++ b/test cases/common/71 ctarget dependency/gen1.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import time, sys
+
+# Make sure other script runs first if dependency
+# is missing.
+time.sleep(0.5)
+
+with open(sys.argv[1]) as f:
+ contents = f.read()
+with open(sys.argv[2], 'w') as f:
+ f.write(contents)
diff --git a/test cases/common/71 ctarget dependency/gen2.py b/test cases/common/71 ctarget dependency/gen2.py
new file mode 100755
index 0000000..6fde556
--- /dev/null
+++ b/test cases/common/71 ctarget dependency/gen2.py
@@ -0,0 +1,10 @@
+#!/usr/bin/env python3
+
+import sys, os
+from glob import glob
+
+files = glob(os.path.join(sys.argv[1], '*.tmp'))
+assert len(files) == 1
+
+with open(files[0]) as ifile, open(sys.argv[2], 'w') as ofile:
+ ofile.write(ifile.read())
diff --git a/test cases/common/71 ctarget dependency/input.dat b/test cases/common/71 ctarget dependency/input.dat
new file mode 100644
index 0000000..7af91e2
--- /dev/null
+++ b/test cases/common/71 ctarget dependency/input.dat
@@ -0,0 +1 @@
+This is a piece of text.
diff --git a/test cases/common/71 ctarget dependency/meson.build b/test cases/common/71 ctarget dependency/meson.build
new file mode 100644
index 0000000..40f7398
--- /dev/null
+++ b/test cases/common/71 ctarget dependency/meson.build
@@ -0,0 +1,20 @@
+project('custom target dependency')
+
+# Sometimes custom targets do not take input files
+# but instead do globbing or some similar wackiness.
+# In this case we need to be able to specify a
+# manual dependency between two custom targets,
+# if one needs to be run before the other.
+
+g1 = find_program('gen1.py')
+g2 = find_program('gen2.py')
+
+c1 = custom_target('medput',
+input : 'input.dat',
+output : 'medput.tmp',
+command : [g1, '@INPUT@', '@OUTPUT@'])
+
+custom_target('output',
+output : 'output.dat',
+command : [g2, '@OUTDIR@', '@OUTPUT@'],
+depends : c1)