aboutsummaryrefslogtreecommitdiffstats
path: root/meson/test cases/unit/35 dist script/subprojects/sub
diff options
context:
space:
mode:
Diffstat (limited to 'meson/test cases/unit/35 dist script/subprojects/sub')
-rw-r--r--meson/test cases/unit/35 dist script/subprojects/sub/dist-script.py12
-rw-r--r--meson/test cases/unit/35 dist script/subprojects/sub/meson.build11
-rw-r--r--meson/test cases/unit/35 dist script/subprojects/sub/meson_options.txt1
-rw-r--r--meson/test cases/unit/35 dist script/subprojects/sub/prog.c1
4 files changed, 25 insertions, 0 deletions
diff --git a/meson/test cases/unit/35 dist script/subprojects/sub/dist-script.py b/meson/test cases/unit/35 dist script/subprojects/sub/dist-script.py
new file mode 100644
index 000000000..1274f291b
--- /dev/null
+++ b/meson/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/meson/test cases/unit/35 dist script/subprojects/sub/meson.build b/meson/test cases/unit/35 dist script/subprojects/sub/meson.build
new file mode 100644
index 000000000..612861310
--- /dev/null
+++ b/meson/test cases/unit/35 dist script/subprojects/sub/meson.build
@@ -0,0 +1,11 @@
+project('sub')
+
+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/meson/test cases/unit/35 dist script/subprojects/sub/meson_options.txt b/meson/test cases/unit/35 dist script/subprojects/sub/meson_options.txt
new file mode 100644
index 000000000..8f52e0f87
--- /dev/null
+++ b/meson/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/meson/test cases/unit/35 dist script/subprojects/sub/prog.c b/meson/test cases/unit/35 dist script/subprojects/sub/prog.c
new file mode 100644
index 000000000..049b36ab2
--- /dev/null
+++ b/meson/test cases/unit/35 dist script/subprojects/sub/prog.c
@@ -0,0 +1 @@
+#error This should be replaced by a program during dist