37 lines
981 B
Python
37 lines
981 B
Python
"""Build and verify the DITAv2 Rust artifact outside the live runner.
|
|
|
|
Usage:
|
|
python -m prod.clean_arch.dita_v2.build_native_artifact
|
|
python -m prod.clean_arch.dita_v2.build_native_artifact --rollback
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
|
|
from .native_artifact import build_verified_artifact, rollback_artifact
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument(
|
|
"--target-dir",
|
|
type=Path,
|
|
default=Path("/root/.cargo/dita_v2_target"),
|
|
)
|
|
parser.add_argument("--rollback", action="store_true")
|
|
args = parser.parse_args()
|
|
crate_dir = Path(__file__).resolve().with_name("_rust_kernel")
|
|
result = (
|
|
rollback_artifact(args.target_dir, crate_dir)
|
|
if args.rollback
|
|
else build_verified_artifact(crate_dir, args.target_dir)
|
|
)
|
|
print(result)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|