Initial commit
Rust workspace for VIctory: PE analysis, loader, HLE skeleton, DXBC/DXIL parsing with a GFX10 decoder, conversion cache, CLI and asset-policy enforcement. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
commit
f4504f6413
69 files changed
+7952
No files matched your search
@@ -0,0 +1,56 @@
|
||||
//! Repository maintenance. Run with `cargo xtask <command>`.
|
||||
|
||||
mod policy;
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use clap::{Parser, Subcommand};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(name = "xtask")]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Cmd,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum Cmd {
|
||||
/// Enforce the asset policy: the repository holds only small text files
|
||||
/// we wrote. Checks tracked and untracked-but-not-ignored files.
|
||||
Policy {
|
||||
/// Check only what is staged for commit (used by the pre-commit hook).
|
||||
#[arg(long)]
|
||||
staged: bool,
|
||||
},
|
||||
/// Point git at .githooks/ so every commit runs the policy check.
|
||||
InstallHooks,
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let root = workspace_root();
|
||||
match Cli::parse().command {
|
||||
Cmd::Policy { staged } => policy::run(&root, staged),
|
||||
Cmd::InstallHooks => {
|
||||
let status = Command::new("git")
|
||||
.args(["config", "core.hooksPath", ".githooks"])
|
||||
.current_dir(&root)
|
||||
.status()
|
||||
.context("running git")?;
|
||||
anyhow::ensure!(
|
||||
status.success(),
|
||||
"git config failed (is this a git repository?)"
|
||||
);
|
||||
println!("hooks installed: commits now run `cargo xtask policy --staged`");
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn workspace_root() -> PathBuf {
|
||||
Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.expect("xtask lives in the workspace")
|
||||
.into()
|
||||
}
|
||||
Reference in new issue
Block a user