Skip to content

Commit

Permalink
fix: smdk should reference wasm32-wasip1 due to wasm tooling changes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
digikata authored Dec 10, 2024
1 parent c6a8fe2 commit 4faf9e9
Show file tree
Hide file tree
Showing 23 changed files with 91 additions and 81 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ Here a a few listed below:
- [Elastic Connector](https://github.com/fluvio-connectors/elastic-connector): Send data from Fluvio to Elastic Search

## Community Development Resources
- [Hello World Fluvio Connector](https://github.com/infinyon/connector-hello-source): Sample Fluvio connector template to build your own connector

More projects and utilities are available in the [Fluvio Community Github Org](https://github.com/fluvio-community/)

- [Hello World Fluvio Connector](https://github.com/fluvio-community/connector-hello-source): Sample Fluvio connector template to build your own connector
- [Gurubase](https://gurubase.io/g/fluvio): Third-party AI/LLM Docs query

### Contributors are awesome
Expand Down
2 changes: 1 addition & 1 deletion crates/cargo-builder/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ impl CargoBuilder {
#[cfg(test)]
mod test {
use std::ffi::OsStr;
use crate::WASM_TARGET;

use super::*;
const WASM_TARGET: &str = "wasm32-wasi";

#[test]
fn test_builder_default() {
Expand Down
2 changes: 2 additions & 0 deletions crates/cargo-builder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pub mod cargo;
pub mod package;

const WASM_TARGET: &str = "wasm32-wasip1";
7 changes: 5 additions & 2 deletions crates/cargo-builder/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use std::path::{Path, PathBuf};
use anyhow::{anyhow, Context};
use cargo_metadata::{CargoOpt, MetadataCommand, Package};

use crate::WASM_TARGET;

#[derive(Debug)]
pub struct PackageOption {
pub release: String,
Expand Down Expand Up @@ -124,7 +126,7 @@ impl PackageInfo {
/// path to package's wasm32-wasi target
pub fn target_wasm32_wasi_path(&self) -> anyhow::Result<PathBuf> {
let mut path = self.target_dir.clone();
path.push("wasm32-wasi");
path.push(WASM_TARGET);
path.push(&self.profile);
path.push(self.target_name()?.replace('-', "_"));
path.set_extension("wasm");
Expand Down Expand Up @@ -159,6 +161,7 @@ pub fn get_current_project_path() -> anyhow::Result<Option<PathBuf>> {
#[cfg(test)]
mod tests {
use super::*;
use crate::WASM_TARGET;

#[test]
fn test_package_info() {
Expand Down Expand Up @@ -189,6 +192,6 @@ mod tests {
assert!(package_info
.target_wasm32_wasi_path()
.unwrap()
.ends_with("wasm32-wasi/release-lto/cargo_builder.wasm"));
.ends_with(format!("{WASM_TARGET}/release-lto/cargo_builder.wasm")));
}
}
6 changes: 2 additions & 4 deletions crates/fluvio-smartengine/src/engine/fixture.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::{
path::{PathBuf, Path},
};
use std::path::{PathBuf, Path};

pub(crate) fn read_wasm_module(module_name: &str) -> Vec<u8> {
let spu_dir = std::env::var("CARGO_MANIFEST_DIR").expect("target");
Expand All @@ -10,7 +8,7 @@ pub(crate) fn read_wasm_module(module_name: &str) -> Vec<u8> {
.parent()
.expect("fluvio")
.join(format!(
"smartmodule/examples/target/wasm32-wasi/release-lto/{module_name}.wasm"
"smartmodule/examples/target/wasm32-wasip1/release-lto/{module_name}.wasm"
));
read_module_from_path(wasm_path)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fluvio-spu/src/services/public/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fn read_wasm_module(module_name: &str) -> Vec<u8> {
.parent()
.expect("fluvio")
.join(format!(
"smartmodule/examples/target/wasm32-wasi/release-lto/{module_name}.wasm"
"smartmodule/examples/target/wasm32-wasip1/release-lto/{module_name}.wasm"
));
read_filter_from_path(wasm_path)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/smartmodule-development-kit/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::cmd::PackageCmd;
use crate::ENV_SMDK_NOWASI;

pub(crate) const BUILD_TARGET: &str = "wasm32-unknown-unknown";
pub(crate) const BUILD_TARGET_WASI: &str = "wasm32-wasi";
pub(crate) const BUILD_TARGET_WASI: &str = "wasm32-wasip1";

/// Builds the SmartModule in the current working directory into a WASM file
#[derive(Debug, Parser)]
Expand Down
15 changes: 9 additions & 6 deletions makefiles/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ longevity-test: build-test
$(TEST_BIN) longevity --expect-timeout -- $(VERBOSE_FLAG) --runtime-seconds=60
endif

sm-target:
rustup target add wasm32-wasip1

cli-backward-compatibility-test:
./tests/cli/cli-backward-compatibility.bash

Expand All @@ -237,7 +240,7 @@ cli-fluvio-mirroring-smoke:
cli-fluvio-mirroring-smoke-e2e:
bats $(shell ls -1 ./tests/cli/mirroring_smoke_tests/e2e/*.bats | sort -R)

cli-smdk-smoke:
cli-smdk-smoke: sm-target
bats $(shell ls -1 ./tests/cli/smdk_smoke_tests/*.bats | sort -R)

cli-cdk-smoke:
Expand All @@ -249,22 +252,22 @@ cli-fvm-smoke:
cli-basic-test:
bats ./tests/cli/fluvio_smoke_tests/e2e-basic.bats

cli-smartmodule-all-test:
cli-smartmodule-all-test: sm-target
bats ./tests/cli/fluvio_smoke_tests/e2e-smartmodule-basic.bats

cli-smartmodule-aggregate-test:
cli-smartmodule-aggregate-test: sm-target
bats -f aggregate ./tests/cli/fluvio_smoke_tests/e2e-smartmodule-basic.bats

cli-smartmodule-basic-test:
cli-smartmodule-basic-test: sm-target
bats ./tests/cli/fluvio_smoke_tests/smartmodule-basic.bats

cli-producer-smartmodule-test:
cli-producer-smartmodule-test: sm-target
bats ./tests/cli/fluvio_smoke_tests/producer-smartmodule.bats

stats-test:
$(TEST_BIN) stats -- $(VERBOSE_FLAG) --tolerance=5

cli-smdk-basic-test:
cli-smdk-basic-test: sm-target
SMDK_BIN=$(shell readlink -f $(SMDK_BIN)) bats ./tests/cli/smdk_smoke_tests/smdk-basic.bats

cli-cdk-basic-test:
Expand Down
2 changes: 1 addition & 1 deletion smartmodule/cargo_template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ topic to send data to.
```bash
$ fluvio topic create smartmodule-test
$ cargo build --release
$ fluvio consume smartmodule-test -B --{{smartmodule-type}}="target/wasm32-wasi/release-lto/{{project-name}}"
$ fluvio consume smartmodule-test -B --{{smartmodule-type}}="target/wasm32-wasip1/release-lto/{{project-name}}"
```
2 changes: 1 addition & 1 deletion smartmodule/cargo_template/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "stable"
targets = ["wasm32-unknown-unknown", "wasm32-wasi"]
targets = ["wasm32-unknown-unknown", "wasm32-wasip1"]
Loading

0 comments on commit 4faf9e9

Please sign in to comment.