Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codegen'd Rust/Arrow (de)ser 4: out-of-sync definitions CI detection #2545

Merged
merged 2 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions crates/re_types/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ const RUST_OUTPUT_DIR_PATH: &str = ".";
const PYTHON_OUTPUT_DIR_PATH: &str = "../../rerun_py/rerun_sdk/rerun/_rerun2";

fn main() {
if std::env::var("CI").is_ok() {
// Don't run on CI!
//
// The code we're generating here is actual source code that gets committed into the
// repository.
return;
}

if !is_tracked_env_var_set("IS_IN_RERUN_WORKSPACE") {
// Only run if we are in the rerun workspace, not on users machines.
return;
Expand Down Expand Up @@ -64,6 +56,13 @@ fn main() {
}
}

// Detect desyncs between definitions and generated when running on CI, and
// crash the build accordingly.
#[allow(clippy::manual_assert)]
if std::env::var("CI").is_ok() {
panic!("re_types' fbs definitions and generated code are out-of-sync!");
}

let sh = Shell::new().unwrap();

re_types_builder::generate_rust_code(
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This is a sha256 hash for all direct and indirect dependencies of this crate's build script.
# It can be safely removed at anytime to force the build script to run again.
# Check out build.rs to see how it's computed.
c10dc39333002ce5c62d9e88a7feb4fca76098528fe643012a53665a9934581e
ffa869371b5fc08da6c80ce53a84db674682b38152c458d958649decc8949f35
15 changes: 7 additions & 8 deletions crates/re_types_builder/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ const SOURCE_HASH_PATH: &str = "./source_hash.txt";
const FBS_REFLECTION_DEFINITION_PATH: &str = "./definitions/reflection.fbs";

fn main() {
if std::env::var("CI").is_ok() {
// Don't run on CI!
//
// The code we're generating here is actual source code that gets committed into the
// repository.
return;
}

if !is_tracked_env_var_set("IS_IN_RERUN_WORKSPACE") {
// Only run if we are in the rerun workspace, not on users machines.
return;
Expand Down Expand Up @@ -54,6 +46,13 @@ fn main() {
}
}

// Detect desyncs between definitions and generated when running on CI, and
// crash the build accordingly.
#[allow(clippy::manual_assert)]
if std::env::var("CI").is_ok() {
panic!("re_types_builder's fbs definitions and generated code are out-of-sync!");
}

// NOTE: This requires `flatc` to be in $PATH, but only for contributors, not end users.
// Even for contributors, `flatc` won't be needed unless they edit some of the .fbs files.
let sh = Shell::new().unwrap();
Expand Down
Loading