diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-03-01 22:05:19 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2021-03-18 08:41:21 -0400 |
commit | 3990754bf55727ef5593769b48f0a03c6b7a3671 (patch) | |
tree | b00148182600db24bd01b0041de5274b15437433 /test cases/unit/35 dist script | |
parent | 848e360450c397f1dcfc4d8d3f614df05806699a (diff) | |
download | meson-3990754bf55727ef5593769b48f0a03c6b7a3671.zip meson-3990754bf55727ef5593769b48f0a03c6b7a3671.tar.gz meson-3990754bf55727ef5593769b48f0a03c6b7a3671.tar.bz2 |
Allow add_dist_script() in subprojects
Fixes: #8440.
Diffstat (limited to 'test cases/unit/35 dist script')
5 files changed, 27 insertions, 0 deletions
diff --git a/test cases/unit/35 dist script/meson.build b/test cases/unit/35 dist script/meson.build index 2ae9438..8db4235 100644 --- a/test cases/unit/35 dist script/meson.build +++ b/test cases/unit/35 dist script/meson.build @@ -6,3 +6,5 @@ test('compare', exe) meson.add_dist_script('replacer.py', '"incorrect"', '"correct"') meson.add_dist_script(find_program('replacer.py'), '"incorrect"', '"correct"') + +subproject('sub') 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..6128613 --- /dev/null +++ b/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/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 |