-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
21 lines (15 loc) · 869 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::{env, process::Command};
const CERTIFICATES_GENERATOR_SCRIPT_FOLDER: &str = "tests/scripts";
const CERTIFICATES_GENERATOR_SCRIPT: &str = "prepare-test-env.sh";
const OPENSSL_CONFIG: &str = "openssl.cnf";
fn main() -> Result<(), anyhow::Error> {
let out_dir = env::var("OUT_DIR").expect("`OUT_DIR` environment variable isn`t set, use Cargo to run build");
let dest_prefix = format!("{out_dir}/");
let script_path = format!("{CERTIFICATES_GENERATOR_SCRIPT_FOLDER}/{CERTIFICATES_GENERATOR_SCRIPT}");
let openssl_config_path = format!("{CERTIFICATES_GENERATOR_SCRIPT_FOLDER}/{OPENSSL_CONFIG}");
Command::new(script_path.clone()).arg(dest_prefix).status()?;
println!("cargo::rerun-if-changed={script_path}");
println!("cargo::rerun-if-changed={openssl_config_path}");
println!("cargo::rerun-if-changed=build.rs");
Ok(())
}