Builtin clang-tidy task cannot reliably run if generators or custom targets are used #12426
Replies: 2 comments 5 replies
-
custom_target is a regular top-level ninja target with a return value that can be used as a dependency for any other target, or an alias_target. Both custom targets and generator outputs have ninja build edges you can run, although generator targets are relatively well hidden inside the private directory of a given library target.
Can you elaborate?
|
Beta Was this translation helpful? Give feedback.
-
This seems like a natural consequence of using generated source files -- you cannot use other files that depend on the generated source files, without knowing to build them. And ninja is the thing that knows how to build them, so somehow, ninja has to be involved. In the specific case of meson's builtin linter targets, I suppose it is plausible we could make them depend on all files that are a) generated, b) source files for a library/executable build target. This would be a special case within meson, but I guess that's the best we could even do. |
Beta Was this translation helpful? Give feedback.
-
Carrying on from the situation in #12424 and #12425, because of the behaviour of
custom_target
andgenerator
only triggering when a compilation is required, the builtinclang-tidy
task will fail if the project is not compiled in advance. Example:source.c
meson.build
The question I have is whether this is intended; the existence of generators hampers my ability to integrate custom linters into my project because:
generator.process
andcustom_target()
targets cannot be 'forced' to be built outside of compiling a librarydepends
keywordSo if a header is being generated within a library, we cannot force it to exist before running a linter, leading to false positives within the lint output. Requiring that the entire project be independently built prior to running the linters is also a poor idea as the compilation phase may be expensive, while the lint phase cheap; I also don't want to force my CI job to build the project just so it can run a comparatively cheap lint phase. Thoughts on resolution?
Beta Was this translation helpful? Give feedback.
All reactions