aboutsummaryrefslogtreecommitdiff
path: root/test cases/common
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-11-15 20:41:31 -0500
committerDylan Baker <dylan@pnwbakers.com>2022-12-05 12:33:17 -0800
commit9e8a3b9cbd5b90cc6384020ac5799ea054912f55 (patch)
tree9bc6c3c906683d50e1d149a18d2b9e5b18010e75 /test cases/common
parentce120ff164e67eb526ecfe70bf87bbb94050bc52 (diff)
downloadmeson-9e8a3b9cbd5b90cc6384020ac5799ea054912f55.zip
meson-9e8a3b9cbd5b90cc6384020ac5799ea054912f55.tar.gz
meson-9e8a3b9cbd5b90cc6384020ac5799ea054912f55.tar.bz2
when generating optional utility targets in ninja, skip existing aliases too
When auto-generating e.g. a `clang-format` target, we first check to see if the user has already defined one, and if so we don't bother creating our own. We check for two things: - if a ninja target already exists, skip - if a run_target was defined, skip The second check is *obviously* a duplicate of the first check. But the first check never actually worked, because all_outputs was only generated *after* generating all utility rules and actually writing out the build.ninja file. The check itself compares against nothing, and always evaluates to false no matter what. Fix this by reordering the target creation logic so we track outputs immediately, but only error about them later. Now, we no longer need to special-case run_target at all, so we can drop that whole logic from build.py and interpreter.py, and simplify the tracked state. Fixes defining an `alias_target()` for a utility, which tried to auto-generate another rule and errored out. Also fixes doing the same thing with a `custom_target()` although I cannot imagine why anyone would want to produce an output file named `clang-format` (unless clang itself decided to migrate to Meson, which would be cool but feels unlikely).
Diffstat (limited to 'test cases/common')
-rw-r--r--test cases/common/51 run target/.clang-format1
-rw-r--r--test cases/common/51 run target/.clang-tidy0
-rw-r--r--test cases/common/51 run target/meson.build9
3 files changed, 8 insertions, 2 deletions
diff --git a/test cases/common/51 run target/.clang-format b/test cases/common/51 run target/.clang-format
new file mode 100644
index 0000000..9b3aa8b
--- /dev/null
+++ b/test cases/common/51 run target/.clang-format
@@ -0,0 +1 @@
+BasedOnStyle: LLVM
diff --git a/test cases/common/51 run target/.clang-tidy b/test cases/common/51 run target/.clang-tidy
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/common/51 run target/.clang-tidy
diff --git a/test cases/common/51 run target/meson.build b/test cases/common/51 run target/meson.build
index 85d30f0..dbb6732 100644
--- a/test cases/common/51 run target/meson.build
+++ b/test cases/common/51 run target/meson.build
@@ -78,8 +78,13 @@ custom_target('configure_script_ct',
run_target('ctags',
command : converter)
-run_target('clang-format',
- command : converter)
+clangf = run_target('clang-format',
+ command : [converter, files('.clang-format'), meson.current_build_dir() / 'clang-format'])
+custom_target('clang-tidy',
+ input: '.clang-tidy',
+ output: 'clang-tidy',
+ command : [converter, '@INPUT@', '@OUTPUT@'])
+alias_target('clang-format-check', clangf)
# Check we can pass env to the program. Also check some string substitutions
# that were added in 0.57.0 but not documented. This is documented behaviour