Skip to content

Commit

Permalink
factors: Add build script for factors smoke test app
Browse files Browse the repository at this point in the history
Signed-off-by: Lann Martin <[email protected]>
  • Loading branch information
lann committed Jul 19, 2024
1 parent ab4d65c commit 656d995
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions crates/factors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,8 @@ tokio = { version = "1", features = ["macros", "rt", "sync"] }
toml = "0.8"
wasmtime-wasi-http = { workspace = true }

[build-dependencies]
cargo-target-dep = { git = "https://github.com/fermyon/cargo-target-dep", rev = "482f269eceb7b1a7e8fc618bf8c082dd24979cf1" }

[lints]
workspace = true
19 changes: 19 additions & 0 deletions crates/factors/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use std::path::Path;

use cargo_target_dep::build_target_dep;

fn main() {
println!("cargo:rerun-if-changed=build.rs");
// Enable spin-factors-derive to emit expanded macro output.
let out_dir = std::env::var("OUT_DIR").unwrap();
println!("cargo:rustc-env=SPIN_FACTORS_DERIVE_EXPAND_DIR={out_dir}");

let root = "tests/smoke-app";
build_target_dep(root, Path::new("tests/smoke-app/target/smoke_app.wasm"))
.release()
.target("wasm32-wasi")
.build();
println!("cargo:rerun-if-changed={root}/Cargo.toml");
println!("cargo:rerun-if-changed={root}/Cargo.lock");
println!("cargo:rerun-if-changed={root}/src");
}
8 changes: 2 additions & 6 deletions crates/factors/tests/smoke-app/spin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ route = "/..."
component = "smoke-app"

[component.smoke-app]
source = "target/wasm32-wasi/release/smoke_app.wasm"
source = "target/smoke_app.wasm"
allowed_outbound_hosts = ["https://{{ host }}"]
key_value_stores = ["default"]
variables = { "other" = "<{{ other }}>"}

[component.smoke-app.build]
command = "cargo build --target wasm32-wasi --release"
watch = ["src/**/*.rs", "Cargo.toml"]
variables = { "other" = "<{{ other }}>"}

0 comments on commit 656d995

Please sign in to comment.