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

Add wasm32-wasi support for V3, V4, and V5 #477

Merged
merged 3 commits into from
Sep 3, 2020
Merged

Conversation

sunfishcode
Copy link
Contributor

I'm submitting a(n) feature

Description

When the wasm32 architecture is used with WASI, md5, getrandom, and sha1
are all available, so V3, V4, and V5 can be enabled.

Motivation

I'm porting an application that uses uuid to WASI and would like to add support.

Tests

cargo test --target=wasm32-wasi --all-features passes.

When the wasm32 architecture is used with WASI, md5, getrandom, and sha1
are all available, so V3, V4, and V5 can be enabled.
@kinggoesgaming
Copy link
Member

An update: I have been trying to get the one heck of a mess that is our build system fixed. This might take sometime to get fixed. I want a good fix not just a system held together with duct tape.

I am not sure how we handle post the shift to Github Actions complete. (Travis is completely broken for us now so...)

Copy link
Member

@kinggoesgaming kinggoesgaming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you

@kinggoesgaming
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Sep 3, 2020

Build succeeded:

@bors bors bot merged commit 58b40ad into uuid-rs:master Sep 3, 2020
bors-servo added a commit to servo/ipc-channel that referenced this pull request Dec 26, 2020
Make it compile for wasm32-unknown-unknown and wasm32-wasi

This uses the "inprocess" implementation for the WebAssembly targets, like Windows, Android and iOS already do.

Note that this only compile with the master branch of the `uuid` crate, as uuid-rs/uuid#477 hasn't been published yet.
acfoltzer added a commit to acfoltzer/uuid that referenced this pull request May 27, 2023
@sunfishcode added `wasm32-wasi` support in uuid-rs#477, but somewhere along the way it appears to have
been broken or dropped. Thankfully, the reason for the breakage doesn't appear too deep: the
`wasm-bindgen` support was enabled for all `wasm32` architectures, rather than just the
`wasm32-unknown-unknown` target triple that [`wasm-bindgen`
supports](https://rustwasm.github.io/wasm-bindgen/reference/rust-targets.html).

This PR fixes the `cfg` expressions for `wasm-bindgen`-specific code so that they no longer catch
`wasm32-wasi`, and now `wasm32-wasi` just works 🎉

To guard against future breakage, I added some `wasm32-wasi` testing infrastructure. A new CI
target modeled on the `wasm-bindgen` target tests the `wasm32-wasi` implementation against
`wasmtime`. Since test runners can't be specified at the command line, this requires a
`.cargo/config` addition as well.

I also noticed and fixed a typo in the existing `wasm-bindgen` CI target that I believe has been
causing the tests to not run with any of the version features enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants