Make plugin build profile contingent on host build profile
This commit is contained in:
parent
031162b473
commit
aeb1b89c25
1 changed files with 8 additions and 2 deletions
|
@ -10,21 +10,27 @@ fn main() {
|
||||||
let _ =
|
let _ =
|
||||||
std::fs::create_dir_all(base.join("bin")).expect("Could not make plugins bin directory");
|
std::fs::create_dir_all(base.join("bin")).expect("Could not make plugins bin directory");
|
||||||
|
|
||||||
|
let (profile_flags, profile_target) = match std::env::var("PROFILE").unwrap().as_str() {
|
||||||
|
"debug" => (&[][..], "debug"),
|
||||||
|
"release" => (&["--release"][..], "release"),
|
||||||
|
unknown => panic!("unknown profile `{}`", unknown),
|
||||||
|
};
|
||||||
|
|
||||||
let build_successful = std::process::Command::new("cargo")
|
let build_successful = std::process::Command::new("cargo")
|
||||||
.args([
|
.args([
|
||||||
"build",
|
"build",
|
||||||
"--release",
|
|
||||||
"--target",
|
"--target",
|
||||||
"wasm32-wasi",
|
"wasm32-wasi",
|
||||||
"--manifest-path",
|
"--manifest-path",
|
||||||
base.join("Cargo.toml").to_str().unwrap(),
|
base.join("Cargo.toml").to_str().unwrap(),
|
||||||
])
|
])
|
||||||
|
.args(profile_flags)
|
||||||
.status()
|
.status()
|
||||||
.expect("Could not build plugins")
|
.expect("Could not build plugins")
|
||||||
.success();
|
.success();
|
||||||
assert!(build_successful);
|
assert!(build_successful);
|
||||||
|
|
||||||
let binaries = std::fs::read_dir(base.join("target/wasm32-wasi/release"))
|
let binaries = std::fs::read_dir(base.join("target/wasm32-wasi").join(profile_target))
|
||||||
.expect("Could not find compiled plugins in target");
|
.expect("Could not find compiled plugins in target");
|
||||||
|
|
||||||
let engine = create_default_engine();
|
let engine = create_default_engine();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue