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 getrandom crate feature=js for KeyExpr #1720

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

Charles-Schleich
Copy link
Member

Used to enable compiling key expressions to WASM for zenoh-ts

Copy link

PR missing one of the required labels: {'internal', 'bug', 'enhancement', 'documentation', 'breaking-change', 'dependencies', 'new feature'}

@Charles-Schleich Charles-Schleich added the internal Changes not included in the changelog label Jan 15, 2025
@@ -36,6 +36,7 @@ schemars = { workspace = true, optional = true }
serde = { workspace = true, features = ["alloc"] }
token-cell = { workspace = true }
zenoh-result = { workspace = true }
getrandom = { workspace = true, features = ["js"] }
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't be better having a js feature in zenoh-keyexpr that optionally enables js on getrandom instead of always enabling it?

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree with adding a feature,
It was mentioned here https://docs.rs/getrandom/latest/getrandom/#webassembly-support
That libraries should not introduce their own js features just to enable getrandom’s js feature.

regardless i think its cleaner if we do add it.

@@ -102,6 +102,7 @@ form_urlencoded = "1.2.1"
futures = "0.3.30"
futures-util = { version = "0.3.30", default-features = false } # Default features are disabled due to some crates' requirements
git-version = "0.3.9"
getrandom = { version = "0.2" }
Copy link
Member

@Mallets Mallets Jan 15, 2025

Choose a reason for hiding this comment

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

getrandom is added as dependency but no change in this PR seems to use it.
What's the role of this dependency alone, which makes fail the CI?

Copy link
Member Author

Choose a reason for hiding this comment

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

rand uses getrandom under the hood, and get random has the library feature that we need to enable to get the keyexpr package to compile to wasm successfully.
Ive added an ignore for cargo machete which should fix the CI check

@Mallets Mallets enabled auto-merge (squash) January 15, 2025 17:03
@Mallets Mallets disabled auto-merge January 15, 2025 17:23
@Mallets Mallets merged commit 26d67de into eclipse-zenoh:main Jan 15, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes not included in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants