Skip to content

Commit

Permalink
Zenoh: Fix badly behaved build.rs scripts.
Browse files Browse the repository at this point in the history
* Zenoh: Fix badly behaved build.rs scripts.

build.rs should only ever modify OUT_DIR. These scripts were modifying
local files which caused a git index update which caused them to
rebuild due to the git-version appearing out of date.
  • Loading branch information
chachi authored and Jack Morrison committed Mar 30, 2024
1 parent 3328edb commit 270eb87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions plugins/zenoh-plugin-rest/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ fn main() {
);
// Generate config schema
let schema = schema_for!(Config);
std::fs::write(
"config_schema.json5",
serde_json::to_string_pretty(&schema).unwrap(),
)
.unwrap();

let schema_file = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap())
.join("config_schema.json5");
std::fs::write(&schema_file, serde_json::to_string_pretty(&schema).unwrap()).unwrap();

// Check that the example config matches the schema
let schema = std::fs::read_to_string("config_schema.json5").unwrap();
let schema = std::fs::read_to_string(schema_file).unwrap();
let schema: serde_json::Value = serde_json::from_str(&schema).unwrap();
let schema = jsonschema::JSONSchema::compile(&schema).unwrap();
let config = std::fs::read_to_string("config.json5").unwrap();
Expand Down
11 changes: 5 additions & 6 deletions plugins/zenoh-plugin-storage-manager/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ fn main() {
);
// Generate default config schema
let schema = schema_for!(PluginConfig);
std::fs::write(
"config_schema.json5",
serde_json::to_string_pretty(&schema).unwrap(),
)
.unwrap();
let schema_file = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap())
.join("config_schema.json5");
std::fs::write(&schema_file, serde_json::to_string_pretty(&schema).unwrap()).unwrap();

// Check that the example config matches the schema
let schema = std::fs::read_to_string("config_schema.json5").unwrap();
let schema = std::fs::read_to_string(schema_file).unwrap();
let schema: serde_json::Value = serde_json::from_str(&schema).unwrap();
let schema = jsonschema::JSONSchema::compile(&schema).unwrap();
let config = std::fs::read_to_string("config.json5").unwrap();
Expand Down

0 comments on commit 270eb87

Please sign in to comment.