diff options
Diffstat (limited to 'meson/test cases/rewrite')
27 files changed, 622 insertions, 0 deletions
diff --git a/meson/test cases/rewrite/1 basic/addSrc.json b/meson/test cases/rewrite/1 basic/addSrc.json new file mode 100644 index 000000000..b8bc43916 --- /dev/null +++ b/meson/test cases/rewrite/1 basic/addSrc.json @@ -0,0 +1,94 @@ +[ + { + "type": "target", + "target": "trivialprog1", + "operation": "src_add", + "sources": ["a2.cpp", "a1.cpp", "a2.cpp"] + }, + { + "type": "target", + "target": "trivialprog2", + "operation": "src_add", + "sources": ["a7.cpp"] + }, + { + "type": "target", + "target": "trivialprog3", + "operation": "src_add", + "sources": ["a5.cpp"] + }, + { + "type": "target", + "target": "trivialprog4", + "operation": "src_add", + "sources": ["a5.cpp"] + }, + { + "type": "target", + "target": "trivialprog5", + "operation": "src_add", + "sources": ["a3.cpp"] + }, + { + "type": "target", + "target": "trivialprog6", + "operation": "src_add", + "sources": ["a4.cpp"] + }, + { + "type": "target", + "target": "trivialprog9", + "operation": "src_add", + "sources": ["a6.cpp", "a1.cpp"] + }, + { + "type": "target", + "target": "trivialprog0", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog1", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog2", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog3", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog4", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog5", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog6", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog7", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog8", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog9", + "operation": "info" + } +] diff --git a/meson/test cases/rewrite/1 basic/addTgt.json b/meson/test cases/rewrite/1 basic/addTgt.json new file mode 100644 index 000000000..2f4e7e256 --- /dev/null +++ b/meson/test cases/rewrite/1 basic/addTgt.json @@ -0,0 +1,9 @@ +[ + { + "type": "target", + "target": "trivialprog10", + "operation": "target_add", + "sources": ["new1.cpp", "new2.cpp"], + "target_type": "shared_library" + } +] diff --git a/meson/test cases/rewrite/1 basic/info.json b/meson/test cases/rewrite/1 basic/info.json new file mode 100644 index 000000000..0f1a3bd8c --- /dev/null +++ b/meson/test cases/rewrite/1 basic/info.json @@ -0,0 +1,57 @@ +[ + { + "type": "target", + "target": "trivialprog0", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog1", + "operation": "info" + }, + { + "type": "target", + "target": "exe2", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog3", + "operation": "info" + }, + { + "type": "target", + "target": "exe4", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog5", + "operation": "info" + }, + { + "type": "target", + "target": "exe6", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog7", + "operation": "info" + }, + { + "type": "target", + "target": "exe8", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog9", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog10", + "operation": "info" + } +] diff --git a/meson/test cases/rewrite/1 basic/meson.build b/meson/test cases/rewrite/1 basic/meson.build new file mode 100644 index 000000000..0f87c4520 --- /dev/null +++ b/meson/test cases/rewrite/1 basic/meson.build @@ -0,0 +1,19 @@ +project('rewritetest', 'cpp') + +src1 = ['main.cpp', 'fileA.cpp'] +src2 = files(['fileB.cpp', 'fileC.cpp']) +src3 = src1 +src4 = [src3] + +# Magic comment + +exe0 = executable('trivialprog0', src1 + src2) +exe1 = executable('trivialprog1', src1) +exe2 = executable('trivialprog2', [src2]) +exe3 = executable('trivialprog3', ['main.cpp', 'fileA.cpp']) +exe4 = executable('trivialprog4', ['main.cpp', ['fileA.cpp']]) +exe5 = executable('trivialprog5', [src2, 'main.cpp']) +exe6 = executable('trivialprog6', 'main.cpp', 'fileA.cpp') +exe7 = executable('trivialprog7', 'fileB.cpp', src1, 'fileC.cpp') +exe8 = executable('trivialprog8', src3) +executable('trivialprog9', src4) diff --git a/meson/test cases/rewrite/1 basic/rmSrc.json b/meson/test cases/rewrite/1 basic/rmSrc.json new file mode 100644 index 000000000..2e7447c68 --- /dev/null +++ b/meson/test cases/rewrite/1 basic/rmSrc.json @@ -0,0 +1,88 @@ +[ + { + "type": "target", + "target": "trivialprog1", + "operation": "src_rm", + "sources": ["fileA.cpp"] + }, + { + "type": "target", + "target": "trivialprog3", + "operation": "src_rm", + "sources": ["fileA.cpp"] + }, + { + "type": "target", + "target": "trivialprog4", + "operation": "src_rm", + "sources": ["fileA.cpp"] + }, + { + "type": "target", + "target": "trivialprog5", + "operation": "src_rm", + "sources": ["fileB.cpp"] + }, + { + "type": "target", + "target": "trivialprog6", + "operation": "src_rm", + "sources": ["fileA.cpp"] + }, + { + "type": "target", + "target": "trivialprog7", + "operation": "src_rm", + "sources": ["fileB.cpp"] + }, + { + "type": "target", + "target": "trivialprog0", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog1", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog2", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog3", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog4", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog5", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog6", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog7", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog8", + "operation": "info" + }, + { + "type": "target", + "target": "trivialprog9", + "operation": "info" + } +] diff --git a/meson/test cases/rewrite/1 basic/rmTgt.json b/meson/test cases/rewrite/1 basic/rmTgt.json new file mode 100644 index 000000000..dbaf02535 --- /dev/null +++ b/meson/test cases/rewrite/1 basic/rmTgt.json @@ -0,0 +1,17 @@ +[ + { + "type": "target", + "target": "exe0", + "operation": "target_rm" + }, + { + "type": "target", + "target": "trivialprog1", + "operation": "target_rm" + }, + { + "type": "target", + "target": "trivialprog9", + "operation": "target_rm" + } +] diff --git a/meson/test cases/rewrite/2 subdirs/addSrc.json b/meson/test cases/rewrite/2 subdirs/addSrc.json new file mode 100644 index 000000000..1a5c13ee3 --- /dev/null +++ b/meson/test cases/rewrite/2 subdirs/addSrc.json @@ -0,0 +1,13 @@ +[ + { + "type": "target", + "target": "something", + "operation": "src_add", + "sources": ["third.c"] + }, + { + "type": "target", + "target": "something", + "operation": "info" + } +] diff --git a/meson/test cases/rewrite/2 subdirs/addTgt.json b/meson/test cases/rewrite/2 subdirs/addTgt.json new file mode 100644 index 000000000..2e1e8bc30 --- /dev/null +++ b/meson/test cases/rewrite/2 subdirs/addTgt.json @@ -0,0 +1,10 @@ +[ + { + "type": "target", + "target": "newLib", + "operation": "target_add", + "sources": ["new1.cpp", "new2.cpp"], + "target_type": "shared_library", + "subdir": "sub2" + } +] diff --git a/meson/test cases/rewrite/2 subdirs/info.json b/meson/test cases/rewrite/2 subdirs/info.json new file mode 100644 index 000000000..dba2cd683 --- /dev/null +++ b/meson/test cases/rewrite/2 subdirs/info.json @@ -0,0 +1,12 @@ +[ + { + "type": "target", + "target": "something", + "operation": "info" + }, + { + "type": "target", + "target": "newLib", + "operation": "info" + } +] diff --git a/meson/test cases/rewrite/2 subdirs/meson.build b/meson/test cases/rewrite/2 subdirs/meson.build new file mode 100644 index 000000000..c7f3fec89 --- /dev/null +++ b/meson/test cases/rewrite/2 subdirs/meson.build @@ -0,0 +1,4 @@ +project('subdir rewrite', 'c') + +subdir('sub1') +subdir('sub2') diff --git a/meson/test cases/rewrite/2 subdirs/rmTgt.json b/meson/test cases/rewrite/2 subdirs/rmTgt.json new file mode 100644 index 000000000..9b112f98b --- /dev/null +++ b/meson/test cases/rewrite/2 subdirs/rmTgt.json @@ -0,0 +1,7 @@ +[ + { + "type": "target", + "target": "something", + "operation": "target_rm" + } +] diff --git a/meson/test cases/rewrite/2 subdirs/sub1/meson.build b/meson/test cases/rewrite/2 subdirs/sub1/meson.build new file mode 100644 index 000000000..ca4220544 --- /dev/null +++ b/meson/test cases/rewrite/2 subdirs/sub1/meson.build @@ -0,0 +1 @@ +srcs = ['first.c', 'second.c'] diff --git a/meson/test cases/rewrite/2 subdirs/sub2/meson.build b/meson/test cases/rewrite/2 subdirs/sub2/meson.build new file mode 100644 index 000000000..44b4075ea --- /dev/null +++ b/meson/test cases/rewrite/2 subdirs/sub2/meson.build @@ -0,0 +1 @@ +executable('something', srcs) diff --git a/meson/test cases/rewrite/3 kwargs/add.json b/meson/test cases/rewrite/3 kwargs/add.json new file mode 100644 index 000000000..5b3ce0b4d --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/add.json @@ -0,0 +1,38 @@ +[ + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "set", + "kwargs": { + "license": "GPL" + } + }, + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "add", + "kwargs": { + "license": ["MIT"] + } + }, + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "add", + "kwargs": { + "license": "BSD" + } + }, + { + "type": "kwargs", + "function": "project", + "id": "//", + "operation": "add", + "kwargs": { + "license": "Boost" + } + } +] diff --git a/meson/test cases/rewrite/3 kwargs/defopts_delete.json b/meson/test cases/rewrite/3 kwargs/defopts_delete.json new file mode 100644 index 000000000..4fe39e2a2 --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/defopts_delete.json @@ -0,0 +1,18 @@ +[ + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "set", + "kwargs": { + "default_options": ["cpp_std=c++14", "buildtype=release", "debug=true"] + } + }, + { + "type": "default_options", + "operation": "delete", + "options": { + "buildtype": null + } + } +] diff --git a/meson/test cases/rewrite/3 kwargs/defopts_set.json b/meson/test cases/rewrite/3 kwargs/defopts_set.json new file mode 100644 index 000000000..f8f855f11 --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/defopts_set.json @@ -0,0 +1,24 @@ +[ + { + "type": "default_options", + "operation": "set", + "options": { + "cpp_std": "c++14" + } + }, + { + "type": "default_options", + "operation": "set", + "options": { + "buildtype": "release", + "debug": true + } + }, + { + "type": "default_options", + "operation": "set", + "options": { + "cpp_std": "c++11" + } + } +] diff --git a/meson/test cases/rewrite/3 kwargs/delete.json b/meson/test cases/rewrite/3 kwargs/delete.json new file mode 100644 index 000000000..7047f4a40 --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/delete.json @@ -0,0 +1,20 @@ +[ + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "delete", + "kwargs": { + "version": null + } + }, + { + "type": "kwargs", + "function": "target", + "id": "helloWorld", + "operation": "delete", + "kwargs": { + "build_by_default": false + } + } +] diff --git a/meson/test cases/rewrite/3 kwargs/info.json b/meson/test cases/rewrite/3 kwargs/info.json new file mode 100644 index 000000000..0eed4048e --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/info.json @@ -0,0 +1,20 @@ +[ + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "info" + }, + { + "type": "kwargs", + "function": "target", + "id": "tgt1", + "operation": "info" + }, + { + "type": "kwargs", + "function": "dependency", + "id": "dep1", + "operation": "info" + } +] diff --git a/meson/test cases/rewrite/3 kwargs/meson.build b/meson/test cases/rewrite/3 kwargs/meson.build new file mode 100644 index 000000000..13b336ca4 --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/meson.build @@ -0,0 +1,7 @@ +project('rewritetest', 'cpp', version: '0.0.1') + +# Find ZLIB +dep1 = dependency('zlib', required: false) + +# Make a test exe +tgt1 = executable('helloWorld', 'main.cpp', build_by_default: true) diff --git a/meson/test cases/rewrite/3 kwargs/remove.json b/meson/test cases/rewrite/3 kwargs/remove.json new file mode 100644 index 000000000..e33cb6681 --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/remove.json @@ -0,0 +1,38 @@ +[ + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "set", + "kwargs": { + "license": ["GPL", "MIT", "BSD", "Boost"] + } + }, + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "remove", + "kwargs": { + "license": ["MIT"] + } + }, + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "remove", + "kwargs": { + "license": "BSD" + } + }, + { + "type": "kwargs", + "function": "project", + "id": "//", + "operation": "remove", + "kwargs": { + "license": "Boost" + } + } +] diff --git a/meson/test cases/rewrite/3 kwargs/remove_regex.json b/meson/test cases/rewrite/3 kwargs/remove_regex.json new file mode 100644 index 000000000..07fa58e21 --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/remove_regex.json @@ -0,0 +1,29 @@ +[ + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "set", + "kwargs": { + "default_options": ["cpp_std=c++14", "buildtype=release", "debug=true"] + } + }, + { + "type": "kwargs", + "function": "project", + "id": "/", + "operation": "remove_regex", + "kwargs": { + "default_options": ["cpp_std=.*"] + } + }, + { + "type": "kwargs", + "function": "project", + "id": "//", + "operation": "remove_regex", + "kwargs": { + "default_options": ["buildtype=.*"] + } + } +] diff --git a/meson/test cases/rewrite/3 kwargs/set.json b/meson/test cases/rewrite/3 kwargs/set.json new file mode 100644 index 000000000..6ca2ee4ae --- /dev/null +++ b/meson/test cases/rewrite/3 kwargs/set.json @@ -0,0 +1,34 @@ +[ + { + "type": "kwargs", + "function": "project", + "id": "//", + "operation": "set", + "kwargs": { + "version": "0.0.2", + "meson_version": "0.50.0", + "license": ["GPL", "MIT"] + } + }, + { + "type": "kwargs", + "function": "target", + "id": "helloWorld", + "operation": "set", + "kwargs": { + "build_by_default": false, + "build_rpath": "/usr/local", + "dependencies": "dep1" + } + }, + { + "type": "kwargs", + "function": "dependency", + "id": "zlib", + "operation": "set", + "kwargs": { + "required": true, + "method": "cmake" + } + } +] diff --git a/meson/test cases/rewrite/4 same name targets/addSrc.json b/meson/test cases/rewrite/4 same name targets/addSrc.json new file mode 100644 index 000000000..98d0d1ebf --- /dev/null +++ b/meson/test cases/rewrite/4 same name targets/addSrc.json @@ -0,0 +1,8 @@ +[ + { + "type": "target", + "target": "myExe", + "operation": "src_add", + "sources": ["a1.cpp", "a2.cpp"] + } +] diff --git a/meson/test cases/rewrite/4 same name targets/info.json b/meson/test cases/rewrite/4 same name targets/info.json new file mode 100644 index 000000000..a9fc2ddc6 --- /dev/null +++ b/meson/test cases/rewrite/4 same name targets/info.json @@ -0,0 +1,12 @@ +[ + { + "type": "target", + "target": "exe1", + "operation": "info" + }, + { + "type": "target", + "target": "exe2", + "operation": "info" + } +] diff --git a/meson/test cases/rewrite/4 same name targets/meson.build b/meson/test cases/rewrite/4 same name targets/meson.build new file mode 100644 index 000000000..384fa2b4e --- /dev/null +++ b/meson/test cases/rewrite/4 same name targets/meson.build @@ -0,0 +1,6 @@ +project('rewrite same name targets', 'cpp') + +src1 = ['main.cpp'] + +exe1 = executable('myExe', src1) +subdir('sub1') diff --git a/meson/test cases/rewrite/4 same name targets/sub1/meson.build b/meson/test cases/rewrite/4 same name targets/sub1/meson.build new file mode 100644 index 000000000..ac53667ae --- /dev/null +++ b/meson/test cases/rewrite/4 same name targets/sub1/meson.build @@ -0,0 +1,3 @@ +src2 = ['main.cpp'] + +exe2 = executable('myExe', src2) diff --git a/meson/test cases/rewrite/5 sorting/meson.build b/meson/test cases/rewrite/5 sorting/meson.build new file mode 100644 index 000000000..80934a066 --- /dev/null +++ b/meson/test cases/rewrite/5 sorting/meson.build @@ -0,0 +1,33 @@ +project('rewriter source sorting', ['c', 'cpp']) + +src1 = files([ + 'a1.c', + 'a10.c', + 'a2.c', + 'a3.c', + 'bbb/a/b1.c', + 'bbb/a4.c', + 'bbb/b3.c', + 'bbb/b4.c', + 'bbb/b/b2.c', + 'bbb/c1/b5.c', + 'bbb/c10/b6.c', + 'bbb/c2/b7.c', + 'bbb/b5.c', + 'a110.c', + 'aaa/f1.c', + 'aaa/f2.c', + 'aaa/f3.c', + 'a20.c', + 'b1.c', + 'aaa/b/b1.c', + 'aaa/b/b2.c', + 'a30.c', + 'a100.c', + 'aaa/a/a1.c', + 'a101.c', + 'a210.c', + 'c2.c' +]) + +exe1 = executable('exe1', src1) |