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

feat(rust)!: build wasip2 by default #298

Merged
merged 2 commits into from
Nov 8, 2024
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
160 changes: 80 additions & 80 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions checks/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@ in
assert flakes.rust.complex.checks.${system} ? doctest;
assert flakes.rust.complex.packages.${system} ? default;
assert flakes.rust.hello-multibin.packages.${system} ? default;
assert flakes.rust.hello-multibin.packages.${system} ? rust-hello-multibin-wasm32-wasip1;
assert flakes.rust.hello-multibin.packages.${system} ? rust-hello-multibin-wasm32-wasip2;
assert flakes.rust.hello.packages.${system} ? default;
assert flakes.rust.hello.packages.${system} ? rust-hello-wasm32-wasip1-oci;
assert flakes.rust.hello.packages.${system} ? rust-hello-wasm32-wasip1;
assert flakes.rust.lib.packages.${system} ? rust-lib-wasm32-wasip1;
assert flakes.rust.hello.packages.${system} ? rust-hello-wasm32-wasip2-oci;
assert flakes.rust.hello.packages.${system} ? rust-hello-wasm32-wasip2;
assert flakes.rust.lib.packages.${system} ? rust-lib-wasm32-wasip2;
assert flakes.rust.workspace.packages.${system} ? default;
assert flakes.rust.workspace.packages.${system} ? rust-workspace-wasm32-wasip1;
assert flakes.rust.workspace.packages.${system} ? rust-workspace-wasm32-wasip2;
(assertRustPackages flakes.rust.complex.packages "rust-complex")
(assertRustPackages flakes.rust.hello-multibin.packages "rust-hello-multibin")
(assertRustPackages flakes.rust.hello.packages "rust-hello")
Expand Down
4 changes: 2 additions & 2 deletions examples/rust-complex/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 examples/rust-complex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ version = "0.1.0"
edition = "2021"

[dependencies]
foo = { workspace = true }
complex-foo = { workspace = true }
ring = { workspace = true }

[target.'cfg(windows)'.dependencies]
foo = { workspace = true, features = ["windows"] }
complex-foo = { workspace = true, features = ["windows"] }

[dev-dependencies]
rust-complex = { path = "." }

[workspace.dependencies]
foo = { path = "./foo" }
complex-foo = { path = "./foo" }
ring = { version = "0.17", features = ["wasm32_unknown_unknown_js"] }
2 changes: 1 addition & 1 deletion examples/rust-complex/foo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "foo"
name = "complex-foo"
version = "0.1.0"
edition = "2021"

Expand Down
1 change: 1 addition & 0 deletions lib/rust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ in {
targets.s390x-unknown-linux-musl = "s390x-unknown-linux-musl";
targets.wasm32-unknown-unknown = "wasm32-unknown-unknown";
targets.wasm32-wasip1 = "wasm32-wasip1";
targets.wasm32-wasip2 = "wasm32-wasip2";
targets.x86_64-apple-darwin = "x86_64-apple-darwin";
targets.x86_64-apple-ios = "x86_64-apple-ios";
targets.x86_64-pc-windows-gnu = "x86_64-pc-windows-gnu";
Expand Down
2 changes: 1 addition & 1 deletion lib/rust/defaultPkgsFor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ with self.lib.rust.targets;
then pkgs.pkgsCross.gnu64
else if target == x86_64-unknown-linux-musl
then pkgs.pkgsCross.musl64
else if target == wasm32-unknown-unknown || target == wasm32-wasip1
else if target == wasm32-unknown-unknown || target == wasm32-wasip1 || target == wasm32-wasip2
then pkgs.pkgsCross.wasi32
else
import (
Expand Down
8 changes: 7 additions & 1 deletion lib/rust/mkAttrs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,10 @@ with self.lib.rust.targets;
then {
CARGO_TARGET_WASM32_WASIP1_RUNNER = "wasmtime run -C cache=n";
}
else if target == wasm32-wasip2
then {
CARGO_TARGET_WASM32_WASIP2_RUNNER = "wasmtime run -C cache=n";
}
else if target == x86_64-unknown-linux-gnu
then
{
Expand Down Expand Up @@ -647,7 +651,8 @@ with self.lib.rust.targets;
default.${s390x-unknown-linux-gnu} = true;
default.${s390x-unknown-linux-musl} = false;
default.${wasm32-unknown-unknown} = true;
default.${wasm32-wasip1} = true;
default.${wasm32-wasip1} = false;
default.${wasm32-wasip2} = true;
default.${x86_64-apple-darwin} = true;
default.${x86_64-apple-ios} = false;
default.${x86_64-pc-windows-gnu} = true;
Expand Down Expand Up @@ -729,6 +734,7 @@ with self.lib.rust.targets;
ociArchitecture.${armv7-unknown-linux-musleabihf} = "arm";
ociArchitecture.${wasm32-unknown-unknown} = "wasm";
ociArchitecture.${wasm32-wasip1} = "wasm";
ociArchitecture.${wasm32-wasip2} = "wasm";
ociArchitecture.${x86_64-apple-darwin} = "amd64";
ociArchitecture.${x86_64-pc-windows-gnu} = "amd64";
ociArchitecture.${x86_64-unknown-linux-gnu} = "amd64";
Expand Down
Loading