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

Only add wasm-bindgen as a dependency on wasm32-unknown-unknown #738

Merged
merged 2 commits into from
Mar 18, 2024

Conversation

emilk
Copy link
Contributor

@emilk emilk commented Feb 15, 2024

When setting the js feature, uuid would previously pull in all of wasm-bindgen even when targeting a native build:

❯ cargo tree -p uuid --target aarch64-apple-darwin --no-default-features --features js
uuid v1.7.0 (/Users/emilk/code/forks/uuid)
└── wasm-bindgen v0.2.91
    ├── cfg-if v1.0.0
    └── wasm-bindgen-macro v0.2.91 (proc-macro)
        ├── quote v1.0.35
        │   └── proc-macro2 v1.0.78
        │       └── unicode-ident v1.0.12
        └── wasm-bindgen-macro-support v0.2.91
            ├── proc-macro2 v1.0.78 (*)
            ├── quote v1.0.35 (*)
            ├── syn v2.0.48
            │   ├── proc-macro2 v1.0.78 (*)
            │   ├── quote v1.0.35 (*)
            │   └── unicode-ident v1.0.12
            ├── wasm-bindgen-backend v0.2.91
            │   ├── bumpalo v3.14.0
            │   ├── log v0.4.20
            │   ├── once_cell v1.19.0
            │   ├── proc-macro2 v1.0.78 (*)
            │   ├── quote v1.0.35 (*)
            │   ├── syn v2.0.48 (*)
            │   └── wasm-bindgen-shared v0.2.91
            └── wasm-bindgen-shared v0.2.91

Now all of that dependency tree is gone when building for native.

Note that a user (me) cannot set the js feature only for some targets, but must opt-in to it on all targets.

@KodrAus
Copy link
Member

KodrAus commented Mar 3, 2024

Thanks for the PR @emilk. It looks like this doesn't work with the written [target.'cfg(target = "wasm32-unknown-unknown")'.dependencies.wasm-bindgen] cfg, but does with this one:

[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown"))'.dependencies.wasm-bindgen]

I have no idea why 🙂

Would you be happy to use that bound for wasm-bindgen and for the dev-dependencies.wasm-bindgen too?

@emilk
Copy link
Contributor Author

emilk commented Mar 8, 2024

I'm happy with whatever works to get rid of the dependencies :)

Personally I prefer this format of my Cargo.toml:

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = { version = "0.2", optional = true }

(which works for me at least)

@emilk
Copy link
Contributor Author

emilk commented Mar 15, 2024

ok, let's see if that works

@KodrAus
Copy link
Member

KodrAus commented Mar 18, 2024

The build failure is unrelated. I just merged a fix to main for it so if you rebase things should go green here too 🙂

@emilk emilk force-pushed the emilk/wasm-bindgen-only-on-web branch from 69012c0 to abe995a Compare March 18, 2024 08:44
@emilk
Copy link
Contributor Author

emilk commented Mar 18, 2024

rebased

@KodrAus KodrAus merged commit 951e8e3 into uuid-rs:main Mar 18, 2024
21 checks passed
@KodrAus
Copy link
Member

KodrAus commented Mar 18, 2024

Thanks @emilk! I'll put together a release that includes this shortly.

mergify bot referenced this pull request in andrzejressel/pulumi-wasm Mar 19, 2024
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [uuid](https://togithub.com/uuid-rs/uuid) | workspace.dependencies | minor | `1.7.0` -> `1.8.0` |

---

### Release Notes

<details>
<summary>uuid-rs/uuid (uuid)</summary>

### [`v1.8.0`](https://togithub.com/uuid-rs/uuid/releases/tag/1.8.0)

[Compare Source](https://togithub.com/uuid-rs/uuid/compare/1.7.0...1.8.0)

#### ⚠️ Potential Breakage ⚠️

A new `impl AsRef<Uuid> for Uuid` bound has been added, which can break inference on code like:

```rust
let b = uuid.as_ref();
```

You can fix these by explicitly typing the result of the conversion:

```rust
let b: &[u8] = uuid.as_ref();
```

or by calling `as_bytes` instead:

```rust
let b = uuid.as_bytes();
```

#### What's Changed

-   docs: fix small spelling mistake by [@&#8203;bengsparks](https://togithub.com/bengsparks) in [https://github.com/uuid-rs/uuid/pull/737](https://togithub.com/uuid-rs/uuid/pull/737)
-   serde serialize_with support by [@&#8203;dakaizou](https://togithub.com/dakaizou) in [https://github.com/uuid-rs/uuid/pull/735](https://togithub.com/uuid-rs/uuid/pull/735)
-   Fix up CI builds by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/744](https://togithub.com/uuid-rs/uuid/pull/744)
-   Only add `wasm-bindgen` as a dependency on `wasm32-unknown-unknown` by [@&#8203;emilk](https://togithub.com/emilk) in [https://github.com/uuid-rs/uuid/pull/738](https://togithub.com/uuid-rs/uuid/pull/738)
-   impl AsRef<Uuid> for Uuid by [@&#8203;koshell](https://togithub.com/koshell) in [https://github.com/uuid-rs/uuid/pull/743](https://togithub.com/uuid-rs/uuid/pull/743)
-   Add v6 to v8 draft link to README by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/746](https://togithub.com/uuid-rs/uuid/pull/746)
-   Add a workflow for running cargo outdated by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/745](https://togithub.com/uuid-rs/uuid/pull/745)
-   Prepare for 1.8.0 release by [@&#8203;KodrAus](https://togithub.com/KodrAus) in [https://github.com/uuid-rs/uuid/pull/747](https://togithub.com/uuid-rs/uuid/pull/747)

#### New Contributors

-   [@&#8203;bengsparks](https://togithub.com/bengsparks) made their first contribution in [https://github.com/uuid-rs/uuid/pull/737](https://togithub.com/uuid-rs/uuid/pull/737)
-   [@&#8203;dakaizou](https://togithub.com/dakaizou) made their first contribution in [https://github.com/uuid-rs/uuid/pull/735](https://togithub.com/uuid-rs/uuid/pull/735)
-   [@&#8203;emilk](https://togithub.com/emilk) made their first contribution in [https://github.com/uuid-rs/uuid/pull/738](https://togithub.com/uuid-rs/uuid/pull/738)
-   [@&#8203;koshell](https://togithub.com/koshell) made their first contribution in [https://github.com/uuid-rs/uuid/pull/743](https://togithub.com/uuid-rs/uuid/pull/743)

**Full Changelog**: uuid-rs/uuid@1.7.0...1.8.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/andrzejressel/pulumi-wasm).
kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Mar 19, 2024
Bumps uuid from 1.7.0 to 1.8.0.

Release notes
Sourced from uuid's releases.

1.8.0
⚠️ Potential Breakage ⚠️
A new impl AsRef<Uuid> for Uuid bound has been added, which can break inference on code like:
let b = uuid.as_ref();
You can fix these by explicitly typing the result of the conversion:
let b: &[u8] = uuid.as_ref();
or by calling as_bytes instead:
let b = uuid.as_bytes();
What's Changed

docs: fix small spelling mistake by @​bengsparks in uuid-rs/uuid#737
serde serialize_with support by @​dakaizou in uuid-rs/uuid#735
Fix up CI builds by @​KodrAus in uuid-rs/uuid#744
Only add wasm-bindgen as a dependency on wasm32-unknown-unknown by @​emilk in uuid-rs/uuid#738
impl AsRef for Uuid by @​koshell in uuid-rs/uuid#743
Add v6 to v8 draft link to README by @​KodrAus in uuid-rs/uuid#746
Add a workflow for running cargo outdated by @​KodrAus in uuid-rs/uuid#745
Prepare for 1.8.0 release by @​KodrAus in uuid-rs/uuid#747

New Contributors

@​bengsparks made their first contribution in uuid-rs/uuid#737
@​dakaizou made their first contribution in uuid-rs/uuid#735
@​emilk made their first contribution in uuid-rs/uuid#738
@​koshell made their first contribution in uuid-rs/uuid#743

Full Changelog: uuid-rs/uuid@1.7.0...1.8.0



Commits

0f2aaae Merge pull request #747 from uuid-rs/cargo/1.8.0
01d16c3 prepare for 1.8.0 release
e4746bc Merge pull request #745 from uuid-rs/ci/outdated
d0396ad Merge pull request #746 from uuid-rs/chore/draft-link
9415ed4 Merge pull request #743 from koshell/main
951e8e3 Merge pull request #738 from rerun-io/emilk/wasm-bindgen-only-on-web
101aa84 add v6 to v8 draft link to README
84dcbba run outdated on a schedule
ca952b1 add a workflow for running cargo outdated
abe995a Make the toml longer, more complicated, and functional
Additional commits viewable in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
emilk added a commit to rerun-io/rerun that referenced this pull request Mar 20, 2024
This cuts out a lot of dependencies in native builds:
* uuid-rs/uuid#738
@emilk emilk mentioned this pull request Mar 20, 2024
5 tasks
Wumpf pushed a commit to rerun-io/rerun that referenced this pull request Mar 20, 2024
This cuts out a lot of dependencies in native builds:
* uuid-rs/uuid#738

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using newly built examples:
[app.rerun.io](https://app.rerun.io/pr/5594/index.html)
* Using examples from latest `main` build:
[app.rerun.io](https://app.rerun.io/pr/5594/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[app.rerun.io](https://app.rerun.io/pr/5594/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/5594)
- [Docs
preview](https://rerun.io/preview/74c77cd1e9544764e174d0fafbb7fe37d9709bf7/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/74c77cd1e9544764e174d0fafbb7fe37d9709bf7/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
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