This is a second attempt at https://gerrit.lix.systems/c/lix/+/5516
instead of letting meson try to be cargo we'll just have cargo at home.
this requires some contortions to link everything together due to quite
a few meson deficiencies, but at the end we get to pretend that rust is
just c++ painted orange. we'll use cxx to bring real interop back soon.
also fixes #1230
also reverts 10845bfe63
co-authored-by: eldritch horrors <pennae@lix.systems>
Change-Id: Ib1fda843fa80d818705d5a65ec9054216a6a6964
48 lines
1.3 KiB
Python
Executable File
48 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import subprocess
|
|
import argparse
|
|
|
|
|
|
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():
|
|
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")]
|
|
+ [
|
|
t
|
|
for t in get_targets_of_rule(args.build_root, "CUSTOM_COMMAND")
|
|
if t.endswith(".gen.cc")
|
|
]
|
|
+ [
|
|
t
|
|
for t in get_targets_of_rule(args.build_root, "CUSTOM_COMMAND_DEP")
|
|
if t.endswith(".capnp.h")
|
|
]
|
|
+ [
|
|
t
|
|
for t in get_targets_of_rule(args.build_root, "CUSTOM_COMMAND")
|
|
if t.endswith(".gen.inc")
|
|
]
|
|
)
|
|
ninja_build(args.build_root, targets)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|