diff --git a/.gitignore b/.gitignore index 56f9339..9aec231 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,4 @@ flamegraph.svg perf.data perf.data.old -# because env var is in here -.cargo/config.toml data diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7c918de --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "rapidjson"] + path = rapidjson + url = https://github.com/Tencent/rapidjson.git diff --git a/README.md b/README.md index 4638b0e..0af4934 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,12 @@ See releases on the right of this repo page. Executables for linux, windows, mac If there's no executable to suit you, you'll need to build your own: -Clone this repo. +Clone this repo: +``` +git clone --recurse-submodules --shallow-submodules https://github.com/djellemah/jch.git +``` +Build it: ``` bash cargo build --release ``` @@ -91,3 +95,19 @@ Left hand column is the aggregated type of all leaves at the path in the right-h - `Xxx:nnnn` means `nnnn` was the number of values encountered, ie the number of leaf nodes matching the path. - If more than one type was encountered at the path, the left hand column will contain an array of characteristics, as above. That is, it's a sum type. + +# Advanced Build +You can use an existing rapidjson tree by specifying the `RAPIDJSON_INCLUDE` env var. + +Either on the command line + +``` +RAPIDJSON_INCLUDE=your_source_dir cargo build +``` + +or in `.config/cargo.toml` like this + +``` +[env] +RAPIDJSON_INCLUDE = "rapidjson/include" +``` diff --git a/build.rs b/build.rs index ff86b13..f9bf781 100644 --- a/build.rs +++ b/build.rs @@ -2,15 +2,14 @@ fn main() { let rapidjson_include = std::env::var("RAPIDJSON_INCLUDE"); let rapidjson_include = match rapidjson_include { Ok(env_value) => std::path::PathBuf::from(env_value), - Err(err) => { - let msg = format!("\nCan't find RAPIDJSON_INCLUDE env var because {err:?}.\nYou can also set it in .cargo/config.toml under the [env] table."); - println!("{msg}"); - std::process::exit(1) - } + Err(_) => "rapidjson/include".into(), }; if !rapidjson_include.exists() { - println!("RAPIDJSON_INCLUDE value {} does not exist.", rapidjson_include.display()); + println!(r#" + RAPIDJSON_INCLUDE env var path "{}" does not exist. + You can also set RAPIDJSON_INCLUDE it in .cargo/config.toml under the [env] table. + "#, rapidjson_include.display()); std::process::exit(1) } diff --git a/rapidjson b/rapidjson new file mode 160000 index 0000000..ab1842a --- /dev/null +++ b/rapidjson @@ -0,0 +1 @@ +Subproject commit ab1842a2dae061284c0a62dca1cc6d5e7e37e346