diff options
author | jade <lix@jade.fyi> | 2024-08-07 00:50:30 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@localhost> | 2024-08-07 00:50:30 +0000 |
commit | 529eed74c477eee8567f28379210cd47f0b4e18f (patch) | |
tree | 4c82036a43a1c1f627cacf2316f708afb6835389 /meson/clang-tidy/build_required_targets.py | |
parent | 2c48460850186e5fb8152e7882baf9e29bb5e884 (diff) | |
parent | ca9d3e6e00ec452701d9d3b7e909eff61799f739 (diff) |
Merge changes I0fc80718,Ia182b86f,I355f82cb,I8a9b58fa,Id89f8a1f, ... into main
* changes:
tree-wide: fix various lint warnings
flake & doxygen: update tagline
nix flake metadata: print modified dates for input flakes
cli: eat terminal codes from stdout also
Implement forcing CLI colour on, and document it better
manual: fix a syntax error in redirects.js that made it not do anything
misc docs/meson tidying
build: implement clang-tidy using our plugin
Diffstat (limited to 'meson/clang-tidy/build_required_targets.py')
-rwxr-xr-x | meson/clang-tidy/build_required_targets.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/meson/clang-tidy/build_required_targets.py b/meson/clang-tidy/build_required_targets.py new file mode 100755 index 000000000..5c0e9641e --- /dev/null +++ b/meson/clang-tidy/build_required_targets.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +import subprocess + +def get_targets_of_rule(build_root: str, rule_name: str) -> list[str]: + return subprocess.check_output(['ninja', '-C', build_root, '-t', 'targets', 'rule', rule_name]).decode().strip().splitlines() + +def ninja_build(build_root: str, targets: list[str]): + subprocess.check_call(['ninja', '-C', build_root, '--', *targets]) + +def main(): + import argparse + ap = argparse.ArgumentParser(description='Builds required targets for clang-tidy') + ap.add_argument('build_root', help='Ninja build root', type=str) + + args = ap.parse_args() + + targets = [t for t in get_targets_of_rule(args.build_root, 'CUSTOM_COMMAND') if t.endswith('gen.hh')] + ninja_build(args.build_root, targets) + +if __name__ == '__main__': + main() |