Skip to content

Commit

Permalink
submodule rapidjson
Browse files Browse the repository at this point in the history
  • Loading branch information
djellemah committed May 4, 2024
1 parent b6b3614 commit e4fa36c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ jobs:
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
with:
submodules: true

- run: rustup default nightly
- name: compile
run: cargo build --release
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ flamegraph.svg
perf.data
perf.data.old

# because env var is in here
.cargo/config.toml
data
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "rapidjson"]
path = rapidjson
url = https://github.com/Tencent/rapidjson.git
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down Expand Up @@ -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"
```
11 changes: 5 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
1 change: 1 addition & 0 deletions rapidjson
Submodule rapidjson added at ab1842

0 comments on commit e4fa36c

Please sign in to comment.