63753f3fc7
## Motivation and Context Adds new subcommands `--new` and `--ls` to `changelogger` ## Description This is part 2 in a series of PRs supporting [file-per-change changelog](https://smithy-lang.github.io/smithy-rs/design/rfcs/rfc0042_file_per_change_changelog.html). This PR just adds utilities for humans and does NOT impact the current dev workflow, smithy-rs CI, or our release pipeline. #### A subcommand `--new` We can use this subcommand when creating a new changelog entry markdown file. An example usage: ``` $ changelogger new -t client -t aws-sdk-rust -r smithy-rs#1234 -a someone --bug-fix -m "Some changelog" \ # for long flags, replace -t with --applies-to, -r with --references, -a with --authors, and -m with --message \ # also remember to escape with \ when including backticks in the message at command line, e.g. \`pub\` The following changelog entry has been written to "/Users/ysaito1001/src/smithy-rs/.changelog/5745197.md": --- applies_to: - aws-sdk-rust - client authors: - someone references: - smithy-rs#1234 breaking: false new_feature: false bug_fix: true --- Some changelog ``` The following CLI arguments are "logically" required - `--applies-to` - `--ref` - `--author` - `--message` If any of the above is not passed a value at command line, then an editor is opened for further edit (which editor to open can be configured per the [edit crate](https://docs.rs/edit/0.1.5/edit/)). Note that the YAML syntax above is different from the single line array syntax [proposed in the RFC](https://smithy-lang.github.io/smithy-rs/design/rfcs/rfc0042_file_per_change_changelog.html#the-proposed-developer-experience). This is due to [a limitation](https://github.com/dtolnay/serde-yaml/issues/355) in `serde-yaml` (which has been archived unfortunately), but the multi-line values are still a valid YAML syntax and, most importantly, rendering changelong entries will continue working. For now, I won't post-process from the multi-line values syntax to the single line array syntax. One can work around this by handwriting a changelog entry Markdown file in `smithy-rs/.changelog` without using this subcommand. #### A subcommand `--ls` This subcommand will render a preview of changelog entries stored in `smithy-rs/.changelog` and print it to the standard output. Example usages (using the entry created at 5745197.md above): ``` $ changelogger ls -c smithy-rs \ # for long flag, replace -c with --change-set Next changelog preview for smithy-rs ===================================== **New this release:** - 🐛 (client, [smithy-rs#1234](https://github.com/smithy-lang/smithy-rs/issues/1234), @someone) Some changelog **Contributors** Thank you for your contributions! ❤ - @someone ([smithy-rs#1234](https://github.com/smithy-lang/smithy-rs/issues/1234)) ``` ``` $ changelogger ls -c aws-sdk \ # for long flag, replace -c with --change-set Next changelog preview for aws-sdk-rust ======================================== **New this release:** - 🐛 ([smithy-rs#1234](https://github.com/smithy-lang/smithy-rs/issues/1234), @someone) Some changelog **Contributors** Thank you for your contributions! ❤ - @someone ([smithy-rs#1234](https://github.com/smithy-lang/smithy-rs/issues/1234)) ``` ## Testing - Existing tests in CI - Basic unit tests for subcommands ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ |
||
---|---|---|
.cargo | ||
.changelog | ||
.github | ||
.pre-commit-hooks | ||
aws | ||
buildSrc | ||
codegen-client | ||
codegen-client-test | ||
codegen-core | ||
codegen-server | ||
codegen-server-test | ||
design | ||
examples | ||
gradle/wrapper | ||
rust-runtime | ||
tools | ||
.cargo-deny-config.toml | ||
.editorconfig | ||
.git-blame-ignore-revs | ||
.gitignore | ||
.pre-commit-config.yaml | ||
CHANGELOG.md | ||
CHANGELOG.next.toml | ||
CODEOWNERS | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
LICENSE | ||
NOTICE | ||
README.md | ||
build.gradle.kts | ||
ci | ||
ci.mk | ||
clippy-root.toml | ||
gradle.properties | ||
gradlew | ||
gradlew.bat | ||
rust-toolchain.toml | ||
settings.gradle.kts |
README.md
Smithy Rust
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.
All internal and external interfaces are considered unstable and subject to change without notice.
Setup
./gradlew
will setup gradle for you. JDK 17 is required.- Running tests requires a working Rust installation. See Rust docs for
installation instructions on your platform. The MSRV (Minimum Supported Rust Version) for the crates in this project is
stable-2
, i.e. the currentstable
Rust version and the prior two versions. 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 intosdk/build/aws-sdk
./gradlew :aws:sdk:sdkTest
: Generate & run all tests for a fresh SDK. (Note that these tests require Go to be installed for FIP support to compile properly)./gradlew :aws:sdk:{cargoCheck, cargoTest, cargoDocs, cargoClippy}
: Generate & run specified cargo command.
codegen-core
: Common code generation logic useful for clients and serverscodegen-client
: Whitelabel Smithy client code generationcodegen-client-test
: Smithy protocol test generation & integration tests for Smithy client whitelabel codedesign
: Design documentation. See the design/README.md for details about building / viewing.codegen-server
: Whitelabel Smithy server code generationcodegen-server-test
: Smithy protocol test generation & integration tests for Smithy server whitelabel codeexamples
: A collection of server implementation examples
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):
rust-runtime
codegen
andcodegen-server
aws/rust-runtime
aws/sdk-codegen
Some components, such as codegen-client-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/` (from repo root):
cargo test --manifest-path=rust-runtime/Cargo.toml
# Run clippy for `rust-runtime/` (from repo root):
cargo clippy --manifest-path=rust-runtime/Cargo.toml
# Or
cd rust-runtime
cargo test
cargo clippy
To test the aws/rust-runtime
crates:
# Run all Rust tests for `aws/rust-runtime/` (from repo root):
cargo test --manifest-path=aws/rust-runtime/Cargo.toml
# Run clippy for `aws/rust-runtime/` (from repo root):
cargo clippy --manifest-path=aws/rust-runtime/Cargo.toml
# Or
cd aws/rust-runtime
cargo test
cargo clippy
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-core:check
./gradlew codegen-client:check
./gradlew codegen-server:check
# Run client codegen tests
./gradlew codegen-client-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-client-test:
codegen-client-test/build/smithyprojections/codegen-client-test
- For codegen-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:sdkTest
# 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
.