Skip to content

Commit 95d06d9

Browse files
committed
WIP
1 parent 0a2b9ce commit 95d06d9

File tree

4 files changed

+411
-0
lines changed

4 files changed

+411
-0
lines changed

library/compiler-builtins/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ resolver = "2"
33
members = [
44
"builtins-test",
55
"compiler-builtins",
6+
"crates/josh-sync",
67
"crates/libm-macros",
78
"crates/musl-math-sys",
89
"crates/panic-handler",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "josh-sync"
3+
edition = "2024"
4+
publish = false
5+
6+
[dependencies]
7+
anyhow = "1.0.98"
8+
directories = "6.0.0"
9+
xshell = "0.2.7"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
use std::env;
2+
use std::process::exit;
3+
4+
use crate::sync::{GitSync, RustcPullError};
5+
6+
mod sync;
7+
8+
const USAGE: &str = r#"Utility for synchroniing compiler-builtins with rust-lang/rust
9+
10+
Usage:
11+
12+
josh-sync rustc-pull
13+
14+
josh-sync rustc-push BRANCH GITHUB_USERNAME
15+
"#;
16+
17+
fn main() -> anyhow::Result<()> {
18+
let sync = GitSync::from_current_dir()?;
19+
20+
// Collect args, then recollect as str refs so we can match on them
21+
let args: Vec<_> = env::args().collect();
22+
let args: Vec<&str> = args.iter().map(|s| s.as_str()).collect();
23+
24+
match args.as_slice()[1..] {
25+
["rustc-pull"] => {
26+
if let Err(error) = sync.rustc_pull(None) {
27+
match error {
28+
RustcPullError::NothingToPull => {
29+
eprintln!("Nothing to pull");
30+
std::process::exit(2);
31+
}
32+
RustcPullError::PullFailed(error) => {
33+
eprintln!("Pull failure: {error:?}");
34+
std::process::exit(1);
35+
}
36+
}
37+
}
38+
}
39+
["rustc-push", branch, github_username] => {
40+
sync.rustc_push(github_username, branch)?;
41+
}
42+
_ => {
43+
println!("{USAGE}");
44+
exit(1);
45+
}
46+
}
47+
Ok(())
48+
}

0 commit comments

Comments
 (0)