difftreelog
ci bindings launch helper
in: master
2 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -507,9 +507,9 @@
[[package]]
name = "jrsonnet-gcmodule"
-version = "0.3.6"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c11fb98940a7f8b419619e98ccbf2e094671a5fdd0e277f05acd373071186d57"
+checksum = "47975473b24b4503acee0d449fd5eda04ae18828f9811828a6cc99abbbbc38c8"
dependencies = [
"jrsonnet-gcmodule-derive",
"parking_lot",
@@ -517,13 +517,13 @@
[[package]]
name = "jrsonnet-gcmodule-derive"
-version = "0.3.6"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bee774b7ba86fc86ee84482cd6732aa860ae3559f9827c65efd75c51e66ac76"
+checksum = "4782d1d76731f5e5bb4bdeff26ed3350f21d662f178ce6dee7b4da810e7a8f72"
dependencies = [
"proc-macro2",
"quote",
- "syn 1.0.109",
+ "syn 2.0.64",
]
[[package]]
@@ -635,6 +635,7 @@
dependencies = [
"jrsonnet-evaluator",
"jrsonnet-gcmodule",
+ "jrsonnet-interner",
"jrsonnet-parser",
"jrsonnet-stdlib",
]
@@ -780,9 +781,9 @@
[[package]]
name = "parking_lot"
-version = "0.12.2"
+version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
+checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27"
dependencies = [
"lock_api",
"parking_lot_core",
xtask/src/main.rsdiffbeforeafterboth1use anyhow::Result;2use clap::Parser;3use xshell::{cmd, Shell};45mod sourcegen;67#[derive(Parser)]8enum Opts {9 /// Generate files for rowan parser10 Sourcegen,11 /// Profile file execution12 Profile {13 #[arg(long, default_value = "true")]14 hyperfine: bool,15 #[arg(long)]16 callgrind: bool,17 #[arg(long)]18 cachegrind: bool,19 #[arg(long, default_value = "x86_64-unknown-linux-gnu")]20 target: String,21 args: Vec<String>,22 },23 /// Run all lints enforced by this repo24 Lint {25 /// Also fix found issues when possible.26 #[arg(long)]27 fix: bool,28 },29}3031fn main() -> Result<()> {32 let sh = Shell::new()?;33 match Opts::parse() {34 Opts::Sourcegen => sourcegen::generate_ungrammar(),35 Opts::Profile {36 hyperfine,37 callgrind,38 cachegrind,39 args,40 target,41 } => {42 let out = sh.create_temp_dir()?;4344 // build-std45 cmd!(46 sh,47 "cargo build -Zbuild-std --target={target} --profile releasedebug"48 )49 .run()?;50 let built = format!("./target/{target}/releasedebug/jrsonnet");51 let bench_cmd = format!("{built} {}", args.join(" "));52 if hyperfine {53 cmd!(sh, "hyperfine {bench_cmd}").run()?;54 }55 if callgrind {56 let args = args.clone();57 let mut callgrind_out = out.path().to_owned();58 callgrind_out.push("callgrind.out.1");59 cmd!(sh, "valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --callgrind-out-file={callgrind_out} {built} {args...}").run()?;60 cmd!(sh, "kcachegrind {callgrind_out}").run()?;61 }62 if cachegrind {63 let mut cachegrind_out = out.path().to_owned();64 cachegrind_out.push("cachegrind.out.1");65 cmd!(sh, "valgrind --tool=cachegrind --cachegrind-out-file={cachegrind_out} {built} {args...}").run()?;66 cmd!(sh, "kcachegrind {cachegrind_out}").run()?;67 }6869 Ok(())70 }71 Opts::Lint { fix } => {72 let fmt_check = if fix { None } else { Some("--check") };73 cmd!(sh, "cargo fmt {fmt_check...}").run()?;74 Ok(())75 }76 }77}1use anyhow::Result;2use clap::Parser;3use xshell::{cmd, Shell};45mod sourcegen;67#[derive(Parser)]8enum Opts {9 /// Generate files for rowan parser10 Sourcegen,11 /// Profile file execution12 Profile {13 #[arg(long, default_value = "true")]14 hyperfine: bool,15 #[arg(long)]16 callgrind: bool,17 #[arg(long)]18 cachegrind: bool,19 #[arg(long, default_value = "x86_64-unknown-linux-gnu")]20 target: String,21 args: Vec<String>,22 },23 /// Run all lints enforced by this repo24 Lint {25 /// Also fix found issues when possible.26 #[arg(long)]27 fix: bool,28 },29 TestCBindings {30 #[arg(long, default_value = "x86_64-unknown-linux-gnu")]31 target: String,32 args: Vec<String>,33 },34}3536fn main() -> Result<()> {37 let sh = Shell::new()?;38 match Opts::parse() {39 Opts::Sourcegen => sourcegen::generate_ungrammar(),40 Opts::Profile {41 hyperfine,42 callgrind,43 cachegrind,44 args,45 target,46 } => {47 let out = sh.create_temp_dir()?;4849 // build-std50 cmd!(51 sh,52 "cargo build -Zbuild-std --target={target} --profile releasedebug"53 )54 .run()?;55 let built = format!("./target/{target}/releasedebug/jrsonnet");56 let bench_cmd = format!("{built} {}", args.join(" "));57 if hyperfine {58 cmd!(sh, "hyperfine {bench_cmd}").run()?;59 }60 if callgrind {61 let args = args.clone();62 let mut callgrind_out = out.path().to_owned();63 callgrind_out.push("callgrind.out.1");64 cmd!(sh, "valgrind --tool=callgrind --dump-instr=yes --collect-jumps=yes --callgrind-out-file={callgrind_out} {built} {args...}").run()?;65 cmd!(sh, "kcachegrind {callgrind_out}").run()?;66 }67 if cachegrind {68 let mut cachegrind_out = out.path().to_owned();69 cachegrind_out.push("cachegrind.out.1");70 cmd!(sh, "valgrind --tool=cachegrind --cachegrind-out-file={cachegrind_out} {built} {args...}").run()?;71 cmd!(sh, "kcachegrind {cachegrind_out}").run()?;72 }7374 Ok(())75 }76 Opts::Lint { fix } => {77 let fmt_check = if fix { None } else { Some("--check") };78 cmd!(sh, "cargo fmt {fmt_check...}").run()?;79 Ok(())80 }81 Opts::TestCBindings { target, args } => {82 cmd!(83 sh,84 "cargo build -p libjsonnet --target={target} --release --no-default-features --features=interop-common,interop-threading"85 )86 .run()?;87 let built = format!("./target/{target}/release/libjsonnet.a");88 let c_bindings = "./bindings/c/";89 let test_file = "libjsonnet_test_file";90 cmd!(sh, "cp {built} {c_bindings}").run()?;91 sh.change_dir(c_bindings);9293 // TODO: Pass target to gcc?94 cmd!(sh, "gcc -c {test_file}.c").run()?;95 cmd!(sh, "gcc -o {test_file} -lc -lm {test_file}.o libjsonnet.a").run()?;96 let sh = Shell::new()?;9798 cmd!(sh, "{c_bindings}{test_file} {args...}").run()?;99100 Ok(())101 }102 }103}