Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Upgrade to Rust v1.84. #696

Merged
merged 6 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/delete-target-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ for (let file of [
"plugins/target/wasm32-wasi/debug/build",
"plugins/target/wasm32-wasi/debug/deps",
"plugins/target/wasm32-wasi/debug/incremental",
"plugins/target/wasm32-wasip1/debug/.fingerprint",
"plugins/target/wasm32-wasip1/debug/build",
"plugins/target/wasm32-wasip1/debug/deps",
"plugins/target/wasm32-wasip1/debug/incremental",
]) {
try {
fs.rmSync(path.join(process.env.GITHUB_WORKSPACE || process.cwd(), file), {
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
cache: false
# cache: ${{ runner.os != 'Linux' }}
# cache-base: "^(master|develop-)"
targets: wasm32-wasip1
- if: ${{ runner.os != 'Windows' }}
run: just build-wasm
env:
Expand Down Expand Up @@ -98,6 +99,7 @@ jobs:
bins: cargo-wasi, just
cache: false
# cache-base: "^(master|develop-)"
targets: wasm32-wasip1
- run: just build
- run: just build-wasm
- run: cargo run -- --help
Expand Down
2 changes: 1 addition & 1 deletion .prototools
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[plugins]
# moon-test = "file://./crates/cli/tests/fixtures/moon-schema.yaml"
moon-test = "https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml"
wasm-test = "file://./plugins/target/wasm32-wasi/debug/proto_wasm_test.wasm"
wasm-test = "file://./plugins/target/wasm32-wasip1/debug/proto_wasm_test.wasm"

# [tools.wasm-test]
# number = 123
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
- [Rust](https://github.com/moonrepo/plugins/blob/master/tools/rust/CHANGELOG.md)
- [Schema (TOML, JSON, YAML)](https://github.com/moonrepo/plugins/blob/master/tools/internal-schema/CHANGELOG.md)

## Unreleased

#### ⚙️ Internal

- Updated Rust to v1.84.

## 0.44.5

#### 🚀 Updates
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[workspace]
resolver = "2"
resolver = "3"
members = ["crates/*"]
default-members = ["crates/cli"]

[workspace.dependencies]
anyhow = "1.0.95"
async-trait = "0.1.85"
clap = "4.5.24"
clap_complete = "4.5.41"
clap = "4.5.25"
clap_complete = "4.5.42"
compact_str = { version = "0.8.1", default-features = false, features = [
"serde",
] }
Expand Down
19 changes: 11 additions & 8 deletions crates/warpgate/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@ use warpgate_api::{HostArch, HostEnvironment, HostLibc, HostOS, TestEnvironment,
pub fn find_target_dir<T: AsRef<Path>>(search_dir: T) -> Option<PathBuf> {
let mut dir = search_dir.as_ref();
let profiles = ["debug", "release"];
let targets = ["wasm32-wasip1", "wasm32-wasi"];

loop {
for profile in &profiles {
let next_target = dir.join("target/wasm32-wasi").join(profile);
for target in &targets {
let next_target = dir.join("target").join(target).join(profile);

if next_target.exists() {
return Some(next_target);
}
if next_target.exists() {
return Some(next_target);
}

let next_target = dir.join("wasm32-wasi").join(profile);
let next_target = dir.join(target).join(profile);

if next_target.exists() {
return Some(next_target);
if next_target.exists() {
return Some(next_target);
}
}
}

Expand Down Expand Up @@ -57,7 +60,7 @@ pub fn find_wasm_file() -> PathBuf {

if !wasm_file.exists() {
panic!(
"WASM file {} does not exist. Please build it with `cargo wasi build` before running tests!",
"WASM file {} does not exist. Please build it with `cargo build --target wasm32-wasip1` before running tests!",
wasm_file.display()
);
}
Expand Down
6 changes: 3 additions & 3 deletions docs/debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ Debugging WASM plugins is non-trivial. I'll use the Node.js plugin as an example

## Building

To start, build a debug target with `cargo wasi build` or `cargo build --target wasm32-wasi`. This will make it available at `target/wasm32-wasi/debug/<name>.wasm`.
To start, build a debug target with `cargo build --target wasm32-wasip1`. This will make it available at `target/wasm32-wasip1/debug/<name>.wasm`.

To execute the debug `.wasm` file within proto, we need to configure a `.prototools` file that points to our newly built file, for example:

```toml
[plugins]
node-test = "file://./target/wasm32-wasi/debug/node_plugin.wasm"
node-test = "file://./target/wasm32-wasip1/debug/node_plugin.wasm"
```

We can then execute it with proto as such:
Expand All @@ -108,7 +108,7 @@ PROTO_LOG=trace PROTO_WASM_LOG=trace PROTO_CACHE=off ~/proto/target/debug/proto

This will create a `<id>-debug.log` file in the current directory with all log output from the WASM plugin and Extism runtime.

> When debugging a failing test, the WASM log file is written to `$CARGO_TARGET_DIR/wasm32-wasi/debug/<name>.log` instead.
> When debugging a failing test, the WASM log file is written to `$CARGO_TARGET_DIR/wasm32-wasip1/debug/<name>.log` instead.

# Debugging PDKs

Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build-shim:
cargo build --bin proto-shim

build-wasm:
cd plugins && cargo wasi build
cd plugins && cargo build --workspace --target wasm32-wasip1

check:
cargo check --workspace
Expand Down
Loading
Loading