-
Notifications
You must be signed in to change notification settings - Fork 190
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: support compiling to webassembly #2254
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Thank you for the contribution ❤️
My biggest comment is around disabling SSO. I think it will be better to swap out ring instead. Let me know what you think.
...egen/src/main/kotlin/software/amazon/smithy/rustsdk/endpoints/OperationInputTestGenerator.kt
Outdated
Show resolved
Hide resolved
@@ -15,4 +15,5 @@ members = [ | |||
"s3control", | |||
"sts", | |||
"transcribestreaming", | |||
"webassembly", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some prerequisite work to do before this will run in CI. I'll see if I can get around to that today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our best option is to install cargo-wasi then run cargo wasi test -- --nocapture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That aspect of it didn't even cross my mind yet 😅
I did the prerequisite work to actually include the tests in the first place in #2255.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the tokio crate, they have a nice a setup for testing against the different webassembly targets: https://github.com/tokio-rs/tokio/blob/06f1a601bb05b1aba9f95020a7fa7572899c588f/.github/workflows/ci.yml#L529-L590
Co-authored-by: John DiSanti <johndisanti@gmail.com>
This reverts commit d8fcf49.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor things.
For CI, there are a few different problems.
|
Note to work on |
Co-authored-by: John DiSanti <johndisanti@gmail.com>
Co-authored-by: John DiSanti <johndisanti@gmail.com>
Co-authored-by: John DiSanti <johndisanti@gmail.com>
Co-authored-by: John DiSanti <johndisanti@gmail.com>
Co-authored-by: John DiSanti <johndisanti@gmail.com>
d41ca4d
to
4e1487b
Compare
4e1487b
to
0beea87
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great! I'm going to work on merging it today and wiring it up to CI.
I added a compilation check for I'm willing to merge this once the CI portion passes to at least keep your progress, but there is a chance we may break things in future releases without this visibility in CI. Thank you for the work here! |
Looks like it passed CI. Adding it to the merge queue. |
* feat(aws-config): define default feature for sso * chore(aws): disable unused features * chore(rust-runtime): disable unused features * chore: add missing tokio fs feature * chore: disable spawn blocking on wasm * chore: fix sso feature * chore: allow unused variables when not sso * chore: remove unnecessary dependency filter for wasm * chore: add integration test for wasm * chore: ensure test-util feature is applied to dev dependencies * chore: disable retry config Co-authored-by: John DiSanti <johndisanti@gmail.com> * chore: simplify features as suggested * chore: no default features for aws types * chore: rename credentials-sso feature * Revert "chore: simplify features as suggested" This reverts commit d8fcf49. * chore: set right name in default features * chore: create smithy client test util in runtime types * Update aws/rust-runtime/aws-types/Cargo.toml Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-inlineable/Cargo.toml Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/lib.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * chore: use hardcoded credentials feature * chore: make wasm example for s3 instead * chore: fix formatting * chore: fix kotlin formatting * chore: fix kotlin unit tests * chore: use timeout config from smithy types * chore: move tests into main file * chore: add vscode setttings to target wasi by default * chore: fix test-util feature for smithy client * chore: separate adapter into own module * chore: fix test with no default features * Fix typo * Update changelog * Check compilation of `aws-config` against `wasm32` in CI * Fix Dockerfile issue and use correct cargo-wasi command * Small Dockerfile fix * Add missing `tar` binary to Docker image --------- Co-authored-by: Eduardo Rodrigues <eduardomourar@users.noreply.github.com> Co-authored-by: John DiSanti <johndisanti@gmail.com> Co-authored-by: John DiSanti <jdisanti@amazon.com> Co-authored-by: Russell Cohen <rcoh@amazon.com>
* feat(aws-config): define default feature for sso * chore(aws): disable unused features * chore(rust-runtime): disable unused features * chore: add missing tokio fs feature * chore: disable spawn blocking on wasm * chore: fix sso feature * chore: allow unused variables when not sso * chore: remove unnecessary dependency filter for wasm * chore: add integration test for wasm * chore: ensure test-util feature is applied to dev dependencies * chore: disable retry config Co-authored-by: John DiSanti <johndisanti@gmail.com> * chore: simplify features as suggested * chore: no default features for aws types * chore: rename credentials-sso feature * Revert "chore: simplify features as suggested" This reverts commit d8fcf49. * chore: set right name in default features * chore: create smithy client test util in runtime types * Update aws/rust-runtime/aws-types/Cargo.toml Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-inlineable/Cargo.toml Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/profile/credentials/exec.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * Update aws/rust-runtime/aws-config/src/lib.rs Co-authored-by: John DiSanti <johndisanti@gmail.com> * chore: use hardcoded credentials feature * chore: make wasm example for s3 instead * chore: fix formatting * chore: fix kotlin formatting * chore: fix kotlin unit tests * chore: use timeout config from smithy types * chore: move tests into main file * chore: add vscode setttings to target wasi by default * chore: fix test-util feature for smithy client * chore: separate adapter into own module * chore: fix test with no default features * Fix typo * Update changelog * Check compilation of `aws-config` against `wasm32` in CI * Fix Dockerfile issue and use correct cargo-wasi command * Small Dockerfile fix * Add missing `tar` binary to Docker image --------- Co-authored-by: Eduardo Rodrigues <eduardomourar@users.noreply.github.com> Co-authored-by: John DiSanti <johndisanti@gmail.com> Co-authored-by: John DiSanti <jdisanti@amazon.com> Co-authored-by: Russell Cohen <rcoh@amazon.com>
Motivation and Context
#2087
In order to compile the AWS SDK to WebAssembly, it requires to patch the ring dependency and disable most default features.
Description
This will introduce some additional improvements and allow the AWS SDK to be compiled to WebAssembly without any workaround.
Testing
A basic integration test has been added that targets wasm32-wasi. Keep in mind that we are mocking the response until outbound HTTP request is added to the WASI standard.
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.