Pull bindings generation for a given postgres version into a separate function
@@ -137,9 +137,23 @@ fn main() -> color_eyre::Result<()> {
pg_configs
.par_iter()
- .map(|pg_config| {
- let major_version =
- pg_config.major_version().wrap_err("could not determine major version")?;
+ .map(|pg_config| generate_bindings(pg_config, &build_paths, is_for_release))
+ .collect::<eyre::Result<Vec<_>>>()?;
+
+ // compile the cshim for each binding
+ for pg_config in pg_configs {
+ build_shim(&build_paths.shim_src, &build_paths.shim_dst, &pg_config)?;
+ }
+
+ Ok(())
+}
+
+fn generate_bindings(
+ pg_config: &PgConfig,
+ build_paths: &BuildPaths,
+ is_for_release: bool,
+) -> eyre::Result<()> {
+ let major_version = pg_config.major_version().wrap_err("could not determine major version")?;
let mut include_h = build_paths.manifest_dir.clone();
include_h.push("include");
include_h.push(format!("pg{}.h", major_version));
@@ -190,15 +204,6 @@ fn main() -> color_eyre::Result<()> {
)
})?;
}
- Ok(())
- })
- .collect::<eyre::Result<Vec<_>>>()?;
-
- // compile the cshim for each binding
- for pg_config in pg_configs {
- build_shim(&build_paths.shim_src, &build_paths.shim_dst, &pg_config)?;
- }
-
Ok(())
}
