Giter Club home page Giter Club logo

smithy-rs's Introduction

Smithy Rust CI on Branch main

Smithy code generators for Rust that generate clients, servers, and the entire AWS SDK. The latest unreleased SDK build can be found in aws-sdk-rust/next.

Design documentation

All internal and external interfaces are considered unstable and subject to change without notice.

Setup

  1. ./gradlew will setup gradle for you. JDK 11 is required.
  2. Running tests requires a working Rust installation. See Rust docs for installation instructions on your platform. Minimum supported Rust version is the latest released Rust version, although older versions may work.

Development

For development, pre-commit hooks make it easier to pass automated linting when opening a pull request. Setup:

brew install pre-commit # (or appropriate for your platform: https://pre-commit.com/)
pre-commit install

Project Layout

  • aws: AWS specific codegen & Rust code (signing, endpoints, customizations, etc.) Common commands:
    • ./gradlew :aws:sdk:assemble: Generate (but do not test / compile etc.) a fresh SDK into sdk/build/aws-sdk
    • ./gradlew :aws:sdk:test: Generate & run all tests for a fresh SDK
    • ./gradlew :aws:sdk:{cargoCheck, cargoTest, cargoDocs, cargoClippy}: Generate & run specified cargo command.
  • codegen: Whitelabel Smithy client code generation
  • codegen-test: Smithy protocol test generation & integration tests for Smithy client whitelabel code
  • design: Design documentation. See the design/README.md for details about building / viewing.
  • codegen-server: Whitelabel Smithy server code generation
  • codegen-server-test: Smithy protocol test generation & integration tests for Smithy server whitelabel code

Testing

Running all of smithy-rs's tests can take a very long time, so it's better to know which parts to test based on the changes being made, and allow continuous integration to find other issues when posting a pull request.

In general, the components of smithy-rs affect each other in the following order (with earlier affecting later):

  1. rust-runtime
  2. codegen and codegen-server
  3. aws/rust-runtime
  4. aws/sdk-codegen

Some components, such as codegen-test and codegen-server-test, are purely for testing other components.

Testing rust-runtime and aws/rust-runtime

To test the rust-runtime crates:

# Run all Rust tests for `rust-runtime/`
./gradlew rust-runtime:cargoTest
# Run clippy for `rust-runtime/`
./gradlew rust-runtime:cargoClippy

For aws/rust-runtime, just prefix with aws::

# Run all Rust tests for `rust-runtime/`
./gradlew aws:rust-runtime:cargoTest
# Run clippy for `rust-runtime/`
./gradlew aws:rust-runtime:cargoClippy

Some runtime crates have a additional-ci script that can also be run. These scripts often require cargo-hack and cargo-udeps to be installed.

Testing Client/Server Codegen

To test the code generation, the following can be used:

# Run Kotlin codegen unit tests
./gradlew codegen:check
# Run client codegen tests
./gradlew codegen-test:check
# Run server codegen tests
./gradlew codegen-server-test:check

Several Kotlin unit tests generate Rust projects and compile them. When these fail, they typically output links to the location of the generated code so that it can be inspected.

To look at generated code when the codegen tests fail, check these paths depending on the test suite that's failing:

  • For codegen-test: codegen-test/build/smithyprojections/codegen-test
  • For codgen-server-test: codegen-server-test/build/smithyprojections/codegen-server-test

Testing SDK Codegen

See the readme in aws/sdk/ for more information about these targets as they can be configured to generate more or less AWS service clients.

# Run Kotlin codegen unit tests
./gradlew aws:sdk-codegen:check
# Generate an SDK, but do not attempt to compile / run tests. Useful for inspecting generated code
./gradlew :aws:sdk:assemble
# Run all the tests
./gradlew :aws:sdk:test
# Validate that the generated code compiles
./gradlew :aws:sdk:cargoCheck
# Validate that the generated code passes Clippy
./gradlew :aws:sdk:cargoClippy
# Validate the generated docs
./gradlew :aws:sdk:cargoDoc

The generated SDK will be placed in aws/sdk/build/aws-sdk.

smithy-rs's People

Contributors

rcoh avatar jdisanti avatar velfi avatar david-perez avatar doug-aws avatar crisidev avatar guymguym avatar alistaim avatar lmjw avatar benesch avatar shinglyu avatar eagletmt avatar richardhboyd avatar nmoutschen avatar nataibi avatar jacco avatar mchoicpe-amazon avatar zekisherif avatar guyilin-amazon avatar yerke avatar barbu110 avatar tanguylebarzic avatar ryansb avatar a-xp avatar elrob avatar obi1kenobi avatar marcbowes avatar landonxjames avatar kiiadi avatar jonhoo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.