Skip to content

Commit

Permalink
Switch json5 to serde_json5
Browse files Browse the repository at this point in the history
The latter is a more recently updated fork a file layout that is easier
to process for automatic dependency resolvers.
  • Loading branch information
aaronmondal committed Nov 27, 2023
1 parent 6bc991c commit cb5862d
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 88 deletions.
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rust_binary(
"@crate_index//:env_logger",
"@crate_index//:futures",
"@crate_index//:hyper",
"@crate_index//:json5",
"@crate_index//:serde_json5",
"@crate_index//:parking_lot",
"@crate_index//:prometheus-client",
"@crate_index//:rustls-pemfile",
Expand Down
134 changes: 65 additions & 69 deletions Cargo.Bazel.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"checksum": "3c48f6a8f523f1a947c7efa5d041ee99d7187465e154ab7fcb2896f842d77e89",
"checksum": "b6ac671d2578b85d845eb82ff6476b66191872c127cd21141c325f53caf48152",
"crates": {
"addr2line 0.21.0": {
"name": "addr2line",
Expand Down Expand Up @@ -7294,58 +7294,6 @@
},
"license": "MIT OR Apache-2.0"
},
"json5 0.4.1": {
"name": "json5",
"version": "0.4.1",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/json5/0.4.1/download",
"sha256": "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1"
}
},
"targets": [
{
"Library": {
"crate_name": "json5",
"crate_root": "src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "json5",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "pest 2.7.5",
"target": "pest"
},
{
"id": "serde 1.0.193",
"target": "serde"
}
],
"selects": {}
},
"edition": "2018",
"proc_macro_deps": {
"common": [
{
"id": "pest_derive 2.7.5",
"target": "pest_derive"
}
],
"selects": {}
},
"version": "0.4.1"
},
"license": "ISC"
},
"lazy_static 1.4.0": {
"name": "lazy_static",
"version": "1.4.0",
Expand Down Expand Up @@ -8184,10 +8132,6 @@
"id": "hyper 0.14.27",
"target": "hyper"
},
{
"id": "json5 0.4.1",
"target": "json5"
},
{
"id": "parking_lot 0.12.1",
"target": "parking_lot"
Expand All @@ -8204,6 +8148,10 @@
"id": "scopeguard 1.2.0",
"target": "scopeguard"
},
{
"id": "serde_json5 0.1.0",
"target": "serde_json5"
},
{
"id": "tokio 1.34.0",
"target": "tokio"
Expand Down Expand Up @@ -8312,10 +8260,6 @@
"id": "prost 0.11.9",
"target": "prost"
},
{
"id": "prost-types 0.11.9",
"target": "prost_types"
},
{
"id": "rand 0.8.5",
"target": "rand"
Expand Down Expand Up @@ -8523,10 +8467,6 @@
"id": "futures 0.3.29",
"target": "futures"
},
{
"id": "hashbrown 0.14.2",
"target": "hashbrown"
},
{
"id": "hex 0.4.3",
"target": "hex"
Expand Down Expand Up @@ -8699,6 +8639,10 @@
"id": "prost 0.11.9",
"target": "prost"
},
{
"id": "prost-types 0.11.9",
"target": "prost_types"
},
{
"id": "serde 1.0.193",
"target": "serde"
Expand Down Expand Up @@ -8795,10 +8739,6 @@
"id": "hex 0.4.3",
"target": "hex"
},
{
"id": "json5 0.4.1",
"target": "json5"
},
{
"id": "parking_lot 0.12.1",
"target": "parking_lot"
Expand All @@ -8819,6 +8759,10 @@
"id": "serde 1.0.193",
"target": "serde"
},
{
"id": "serde_json5 0.1.0",
"target": "serde_json5"
},
{
"id": "shlex 1.2.0",
"target": "shlex"
Expand Down Expand Up @@ -12735,6 +12679,58 @@
},
"license": "MIT OR Apache-2.0"
},
"serde_json5 0.1.0": {
"name": "serde_json5",
"version": "0.1.0",
"repository": {
"Http": {
"url": "https://crates.io/api/v1/crates/serde_json5/0.1.0/download",
"sha256": "32a6b754515e1a7bd79fc2edeaecee526fc80cb3a918607e5ca149225a3a9586"
}
},
"targets": [
{
"Library": {
"crate_name": "serde_json5",
"crate_root": "third_party/src/lib.rs",
"srcs": [
"**/*.rs"
]
}
}
],
"library_target_name": "serde_json5",
"common_attrs": {
"compile_data_glob": [
"**"
],
"deps": {
"common": [
{
"id": "pest 2.7.5",
"target": "pest"
},
{
"id": "serde 1.0.193",
"target": "serde"
}
],
"selects": {}
},
"edition": "2018",
"proc_macro_deps": {
"common": [
{
"id": "pest_derive 2.7.5",
"target": "pest_derive"
}
],
"selects": {}
},
"version": "0.1.0"
},
"license": "Apache-2.0"
},
"serde_path_to_error 0.1.14": {
"name": "serde_path_to_error",
"version": "0.1.14",
Expand Down
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ clap = { version = "4.3.11", features = ["derive"] }
env_logger = "0.10.0"
futures = "0.3.28"
hyper = { version = "0.14.27" }
json5 = "0.4.1"
parking_lot = "0.12.1"
prometheus-client = "0.21.2"
rustls-pemfile = "1.0.3"
scopeguard = "1.2.0"
serde_json5 = "0.1.0"
tokio = { version = "1.29.1", features = ["rt-multi-thread"] }
tokio-rustls = "0.24.1"
tonic = { version = "0.9.2", features = ["gzip"] }
Expand Down
2 changes: 1 addition & 1 deletion native-link-worker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rust_library(
"@crate_index//:formatx",
"@crate_index//:futures",
"@crate_index//:hex",
"@crate_index//:json5",
"@crate_index//:serde_json5",
"@crate_index//:parking_lot",
"@crate_index//:prost",
"@crate_index//:relative-path",
Expand Down
2 changes: 1 addition & 1 deletion native-link-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ filetime = "0.2.21"
formatx = "0.2.1"
futures = "0.3.28"
hex = "0.4.3"
json5 = "0.4.1"
parking_lot = "0.12.1"
prost = "0.11.9"
relative-path = "1.8.0"
scopeguard = "1.2.0"
serde = "1.0.167"
serde_json5 = "0.1.0"
shlex = "1.1.0"
tokio = { version = "1.29.1", features = ["sync", "rt", "process"] }
tokio-stream = { version = "0.1.14", features = ["fs"] }
Expand Down
2 changes: 1 addition & 1 deletion native-link-worker/src/running_actions_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ async fn process_side_channel_file(
.err_tip(|| "Error reading side channel file")?;
}

let side_channel_info: SideChannelInfo = json5::from_str(&json_contents).map_err(|e| {
let side_channel_info: SideChannelInfo = serde_json5::from_str(&json_contents).map_err(|e| {
make_input_err!("Could not convert contents of side channel file (json) to SideChannelInfo : {e:?}")
})?;
Ok(side_channel_info.failure.map(|failure| match failure {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/cas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ async fn get_config() -> Result<CasConfig, Box<dyn std::error::Error>> {
let json_contents = String::from_utf8(
std::fs::read(&args.config_file).err_tip(|| format!("Could not open config file {}", args.config_file))?,
)?;
Ok(json5::from_str(&json_contents)?)
Ok(serde_json5::from_str(&json_contents)?)
}

fn main() -> Result<(), Box<dyn std::error::Error>> {
Expand Down

0 comments on commit cb5862d

Please sign in to comment.