Skip to content

Commit

Permalink
always regenerate the bindings.rs files
Browse files Browse the repository at this point in the history
  • Loading branch information
eeeebbbbrrrr committed Aug 4, 2020
1 parent eb5349d commit d79adbf
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions pgx-pg-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use rayon::prelude::*;
use std::collections::HashSet;
use std::path::PathBuf;
use std::process::{Command, Output};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Mutex;
use syn::export::{ToTokens, TokenStream2};
use syn::Item;
Expand Down Expand Up @@ -77,7 +76,6 @@ fn main() -> Result<(), std::io::Error> {
build_deps::rerun_if_changed_paths("cshim/Makefile").unwrap();

let shim_mutex = Mutex::new(());
let need_common_rs = AtomicBool::new(false);

major_versions.into_par_iter().for_each(|major_version| {
let pg_config = get_pg_config(major_version);
Expand All @@ -100,23 +98,12 @@ fn main() -> Result<(), std::io::Error> {
eprintln!("bindings_rs={}", bindings_rs.display());
eprintln!("specific_rs={}", specific_rs.display());

if !common_rs.exists() // no common.rs
|| !specific_rs.exists() // no version-specific.rs
|| include_h.metadata().unwrap().modified().unwrap() // include headers are newer than version-specific.rs
> specific_rs.metadata().unwrap().modified().unwrap()
{
run_bindgen(&pg_config, major_version, &include_h, &bindings_rs);
need_common_rs.store(true, Ordering::SeqCst);
} else {
eprintln!("{} is up-to-date", specific_rs.display())
}
run_bindgen(&pg_config, major_version, &include_h, &bindings_rs);

build_shim(&shim_dir, &shim_mutex, major_version, &pg_config);
});

if need_common_rs.load(Ordering::SeqCst) {
generate_common_rs(manifest_dir, &out_dir);
}
generate_common_rs(manifest_dir, &out_dir);

Ok(())
}
Expand Down

0 comments on commit d79adbf

Please sign in to comment.