summaryrefslogtreecommitdiffstats
path: root/test cases/unit/35 dist script/subprojects
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/unit/35 dist script/subprojects')
-rw-r--r--test cases/unit/35 dist script/subprojects/sub/dist-script.py12
-rw-r--r--test cases/unit/35 dist script/subprojects/sub/meson.build11
-rw-r--r--test cases/unit/35 dist script/subprojects/sub/meson_options.txt1
-rw-r--r--test cases/unit/35 dist script/subprojects/sub/prog.c1
4 files changed, 25 insertions, 0 deletions
diff --git a/test cases/unit/35 dist script/subprojects/sub/dist-script.py b/test cases/unit/35 dist script/subprojects/sub/dist-script.py
new file mode 100644
index 0000000..1274f29
--- /dev/null
+++ b/test cases/unit/35 dist script/subprojects/sub/dist-script.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import os
+import pathlib
+import sys
+
+assert sys.argv[1] == 'success'
+
+source_root = pathlib.Path(os.environ['MESON_PROJECT_DIST_ROOT'])
+modfile = source_root / 'prog.c'
+with modfile.open('w') as f:
+ f.write('int main(){return 0;}')
diff --git a/test cases/unit/35 dist script/subprojects/sub/meson.build b/test cases/unit/35 dist script/subprojects/sub/meson.build
new file mode 100644
index 0000000..a41a3b6
--- /dev/null
+++ b/test cases/unit/35 dist script/subprojects/sub/meson.build
@@ -0,0 +1,11 @@
+project('sub', 'c')
+
+if get_option('broken_dist_script')
+ # Make sure we can add a dist script in a subproject, but it won't be run
+ # if not using --include-subprojects.
+ meson.add_dist_script('dist-script.py', 'broken')
+else
+ # The dist script replace prog.c with something that actually build.
+ meson.add_dist_script('dist-script.py', 'success')
+ executable('prog', 'prog.c')
+endif
diff --git a/test cases/unit/35 dist script/subprojects/sub/meson_options.txt b/test cases/unit/35 dist script/subprojects/sub/meson_options.txt
new file mode 100644
index 0000000..8f52e0f
--- /dev/null
+++ b/test cases/unit/35 dist script/subprojects/sub/meson_options.txt
@@ -0,0 +1 @@
+option('broken_dist_script', type: 'boolean', value: true)
diff --git a/test cases/unit/35 dist script/subprojects/sub/prog.c b/test cases/unit/35 dist script/subprojects/sub/prog.c
new file mode 100644
index 0000000..049b36a
--- /dev/null
+++ b/test cases/unit/35 dist script/subprojects/sub/prog.c
@@ -0,0 +1 @@
+#error This should be replaced by a program during dist