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

Update all dependencies (incl JS) and make use of thread_local #12

Merged
merged 14 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Setup nightly Rust
run: rustup toolchain install nightly-2022-12-12 --profile minimal --target wasm32-unknown-unknown --component rust-src
- name: Install npm deps
working-directory: ./test
run: npm ci
# For some reason isntalling the rust toolchain via wasm-pack leads to CI failures.
# This check will read the top level rustup-toolchain.toml and install the required stuff.
- name: Trigger toolchain installation
working-directory: ./test
run: cargo check
- name: Run tests
working-directory: ./test
run: npm test
9 changes: 5 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Setup stable Rust
run: rustup target add wasm32-unknown-unknown
- name: Setup nightly Rust
run: rustup toolchain install nightly-2022-12-12 --profile minimal --target wasm32-unknown-unknown --component rust-src
# For some reason isntalling the rust toolchain via wasm-pack leads to CI failures.
# This check will read the top level rustup-toolchain.toml and install the required stuff.
- name: Trigger toolchain installation
working-directory: ./test
run: cargo check
- name: Build demo
working-directory: ./demo
run: |
Expand Down
12 changes: 0 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.

## Code reviews

All submissions, including submissions by project members, require review. We
Expand Down
125 changes: 79 additions & 46 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
Expand Up @@ -2,7 +2,7 @@
name = "wasm-bindgen-rayon"
version = "1.2.1"
authors = ["Ingvar Stepanyan <[email protected]>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
description = "Adapter for using Rayon-based concurrency on the Web"
keywords = ["web", "thread", "parallel", "concurrency", "webassembly"]
Expand All @@ -12,14 +12,14 @@ exclude = [".github"]
repository = "https://github.com/RReverser/wasm-bindgen-rayon"

[workspace.dependencies]
wasm-bindgen = "0.2.84"
wasm-bindgen = "0.2.93"
rayon = { version = "1.8.1", features = ["web_spin_lock"] }

[dependencies]
wasm-bindgen = { workspace = true }
rayon = { workspace = true }
crossbeam-channel = "0.5.9"
js-sys = "0.3.48"
js-sys = "0.3.70"

[workspace]
members = ["demo", "test"]
Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,21 @@ The other issue is that the Rust standard library for the WebAssembly target is

Since we want standard library to be thread-safe and [`std::sync`](https://doc.rust-lang.org/std/sync/) APIs to work, you'll need to use the nightly compiler toolchain and pass some flags to rebuild the standard library in addition to your own code.

In order to reduce risk of breakages, it's strongly recommended to use a fixed nightly version. For example, the latest stable Rust at the moment of writing is version 1.66, which corresponds to `nightly-2022-12-12`, which was tested and works with this crate.
In order to reduce risk of breakages, it's strongly recommended to use a fixed nightly version. This crate was tested with `nightly-2024-08-02`.

### Using config files

The easiest way to configure those flags is:

1. Put a string `nightly-2022-12-12` in a `rust-toolchain` file in your project directory. This tells Rustup to use nightly toolchain by default for your project.
1. Put the following in a `rust-toolchain.toml` file in your project directory:
```toml
[toolchain]
channel = "nightly-2024-08-02"
components = ["rust-src"]
targets = ["wasm32-unknown-unknown"]
```

This tells rustup to use a fixed nightly toolchain with the wasm-target for your project, and to install rust-src, which is required for `build-std`.
2. Put the following in a `.cargo/config.toml` file in your project directory:

```toml
Expand All @@ -140,7 +148,7 @@ In that case, the whole command looks like this:

```sh
RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' \
rustup run nightly-2022-12-12 \
rustup run nightly-2024-08-02 \
wasm-pack build --target web [...] \
-- -Z build-std=panic_abort,std
```
Expand Down
2 changes: 1 addition & 1 deletion demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "wasm-bindgen-rayon-demo"
version = "0.1.0"
authors = ["Ingvar Stepanyan <[email protected]>"]
edition = "2018"
edition = "2021"
publish = false

[lib]
Expand Down
Loading
Loading