Remove cargo run from runner
This change:
Removes `cargo run` from `runner`
Copies `oak_loader` into `bin` and use it to run Oak server
Fixes
@@ -297,7 +297,17 @@ fn build_wasm_module(name: &str, target: &Target, example_name: &str) -> Step {
fn build_server(opt: &BuildServer) -> Step {
match opt.server_variant.as_str() {
- "base" | "logless" => Step::Single {
+ "base" | "logless" => Step::Multiple {
+ name: "server".to_string(),
+ steps: vec![
+ Step::Single {
+ name: "create bin folder".to_string(),
+ command: Cmd::new(
+ "mkdir",
+ vec!["-p".to_string(), "oak/server/bin".to_string()],
+ ),
+ },
+ Step::Single {
name: format!("build server ({})", opt.server_variant),
command: Cmd::new_with_env(
"cargo",
@@ -321,6 +331,9 @@ fn build_server(opt: &BuildServer) -> Step {
]
},
"--manifest-path=oak/server/rust/oak_loader/Cargo.toml".to_string(),
+ "--out-dir=oak/server/bin".to_string(),
+ // `--out-dir` is unstable and requires `-Zunstable-options`.
+ "-Zunstable-options".to_string(),
...if opt.server_variant == "logless" {
vec!["--no-default-features".to_string()]
} else {
@@ -340,6 +353,8 @@ fn build_server(opt: &BuildServer) -> Step {
},
),
},
+ ],
+ },
v => panic!("unknown server variant: {}", v),
}
}
@@ -445,28 +460,8 @@ fn run_example_server(
application_file: &str,
) -> Box<dyn Runnable> {
Cmd::new_with_env(
- "cargo",
+ "oak/server/bin/oak_loader",
spread![
- ...match &opt.server_rust_toolchain {
- // This overrides the toolchain used by `rustup` to invoke the actual `cargo`
- // binary.
- // See https://github.com/rust-lang/rustup#toolchain-override-shorthand
- Some(server_rust_toolchain) => vec![format!("+{}", server_rust_toolchain)],
- None => vec![],
- },
- "run".to_string(),
- // If building in coverage mode, use the default target from the host, and build in
- // debug mode.
- ...if opt.coverage {
- vec![]
- } else {
- vec![
- format!("--target={}", opt.server_rust_target.as_deref().unwrap_or(DEFAULT_SERVER_RUST_TARGET)),
- "--release".to_string(),
- ]
- },
- "--manifest-path=oak/server/rust/oak_loader/Cargo.toml".to_string(),
- "--".to_string(),
"--grpc-tls-private-key=./examples/certs/local/local.key".to_string(),
"--grpc-tls-certificate=./examples/certs/local/local.pem".to_string(),
// TODO(#396): Add `--oidc-client` support.
