refactor(rust): align workspace with style rules

This commit is contained in:
2026-09-17 09:57:11 -04:00
parent cf9a671fb8
commit b4b77faaa9
15 changed files with 124 additions and 28 deletions

View File

@@ -4,8 +4,8 @@ rust_library(
name = "ariadne_lib",
crate_name = "ariadne",
srcs = [
"ariadne.rs",
"clew.rs",
"lib.rs",
"pipeline.rs",
],
deps = [
@@ -17,9 +17,10 @@ rust_library(
rust_binary(
name = "ariadne",
crate_name = "ariadne_cli",
srcs = ["main.rs"],
srcs = ["ariadne_main.rs"],
deps = [
":ariadne_lib",
"//src/monorepo:monorepo",
"//third_party/crates:clap",
],
)

View File

@@ -4,13 +4,14 @@ version = "0.1.0"
edition = "2024"
[lib]
path = "lib.rs"
path = "ariadne.rs"
[[bin]]
name = "ariadne"
path = "main.rs"
path = "ariadne_main.rs"
[dependencies]
clap = { version = "4", features = ["derive"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
clap = { workspace = true, features = ["derive"] }
monorepo = { workspace = true }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }

View File

@@ -17,7 +17,7 @@ struct Args {
impl From<Args> for ariadne::Config {
fn from(args: Args) -> Self {
ariadne::Config {
output_dir: resolve_workspace_path(args.output_dir),
output_dir: monorepo::workspace::resolve_workspace_path(args.output_dir),
force: args.force,
target_stage: args.target_stage,
}
@@ -32,19 +32,6 @@ fn parse_stage(value: &str) -> Result<ariadne::pipeline::Stage, String> {
.ok_or_else(|| format!("unknown stage: {value}"))
}
// TODO: Move this into a shared Rust utility crate.
fn resolve_workspace_path(path: PathBuf) -> PathBuf {
if path.is_absolute() {
return path;
}
if let Some(workspace) = std::env::var_os("BUILD_WORKSPACE_DIRECTORY") {
return PathBuf::from(workspace).join(path);
}
path
}
fn main() -> ariadne::Result<()> {
let config: ariadne::Config = Args::parse().into();
ariadne::run(&config)