diff --git a/CHANGELOG.md b/CHANGELOG.md index e8b73b217fabbd1e9b36aaccd50e95cf344d3d56..d0b707172681b4bf7adb67be19410f6f910384dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## vNext (Month Day Year) +**Breaking changes** +* `test-util` has been made an optional dependency and has moved from + aws-hyper to smithy-http. If you were relying on `aws_hyper::TestConnection`, add `smithy-client` as a dependency + and enable the optional `test-util` feature. This prunes some unnecessary dependencies on `roxmltree` and `serde_json` + for most users. (#608) + **New This Week** - :bug: Bugfix: Fix parsing bug where whitespace was stripped when parsing XML (#590) - Establish common abstraction for environment variables (#594) diff --git a/aws/rust-runtime/aws-hyper/Cargo.toml b/aws/rust-runtime/aws-hyper/Cargo.toml index 395bc2229a13c54b9246aead65386e83e7f3d73e..d40ed47e97b637d88e0d75d9eab48e71b8b2fd9c 100644 --- a/aws/rust-runtime/aws-hyper/Cargo.toml +++ b/aws/rust-runtime/aws-hyper/Cargo.toml @@ -8,8 +8,7 @@ license = "Apache-2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -test-util = ["protocol-test-helpers"] -default = ["test-util"] +default = [] native-tls = ["hyper-tls", "smithy-client/native-tls"] rustls = ["hyper-rustls", "smithy-client/rustls"] @@ -35,13 +34,11 @@ tokio = { version = "1", features = ["time"] } pin-project = "1" tracing = "0.1" -protocol-test-helpers = { path = "../../../rust-runtime/protocol-test-helpers", optional = true } - [dev-dependencies] tokio = { version = "1", features = ["full", "test-util"] } tower-test = "0.4.0" aws-types = { path = "../aws-types" } +smithy-client = { path = "../../../rust-runtime/smithy-client", features = ["test-util"] } [[test]] name = "e2e_test" -required-features = ["test-util"] diff --git a/aws/rust-runtime/aws-hyper/src/lib.rs b/aws/rust-runtime/aws-hyper/src/lib.rs index 7e121d16dbe3ae56296a2115b648475dae808308..4248c384aed47f55ecf74af6afd6b99e79641ed3 100644 --- a/aws/rust-runtime/aws-hyper/src/lib.rs +++ b/aws/rust-runtime/aws-hyper/src/lib.rs @@ -3,9 +3,6 @@ * SPDX-License-Identifier: Apache-2.0. */ -#[doc(inline)] -pub use smithy_client::test_connection; - pub use smithy_client::retry::Config as RetryConfig; use aws_auth::middleware::CredentialsStage; diff --git a/aws/rust-runtime/aws-hyper/tests/e2e_test.rs b/aws/rust-runtime/aws-hyper/tests/e2e_test.rs index e8a196f4363cd6c057527ee1cef2ef8a3e1d0e95..039adc24560cbf543f7c654ade50206198b752f1 100644 --- a/aws/rust-runtime/aws-hyper/tests/e2e_test.rs +++ b/aws/rust-runtime/aws-hyper/tests/e2e_test.rs @@ -8,7 +8,6 @@ use aws_endpoint::partition::endpoint::{Protocol, SignatureVersion}; use aws_endpoint::set_endpoint_resolver; use aws_http::user_agent::AwsUserAgent; use aws_http::AwsErrorRetryPolicy; -use aws_hyper::test_connection::TestConnection; use aws_hyper::{Client, RetryConfig}; use aws_sig_auth::signer::OperationSigningConfig; use aws_types::region::Region; @@ -16,6 +15,7 @@ use aws_types::SigningService; use bytes::Bytes; use http::header::{AUTHORIZATION, HOST, USER_AGENT}; use http::{Response, Uri}; +use smithy_client::test_connection::TestConnection; use smithy_http::body::SdkBody; use smithy_http::operation; use smithy_http::operation::Operation; diff --git a/aws/rust-runtime/aws-types/Cargo.toml b/aws/rust-runtime/aws-types/Cargo.toml index 0b3cda3ffdbd7828af89cbd665cb9e9d1c1672c1..bd41fb50e3f95b03ab8dcc9b3f9dd4f5913d2cf1 100644 --- a/aws/rust-runtime/aws-types/Cargo.toml +++ b/aws/rust-runtime/aws-types/Cargo.toml @@ -18,4 +18,4 @@ serde_json = "1" arbitrary = "1" [build-dependencies] -rustc_version = "0.3.3" +rustc_version = "0.4.0" diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/FluentClientGenerator.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/FluentClientGenerator.kt index 236cccedca59d42e8fd6ebc123a5ff16d5f3d63c..d4544c5014c275684019fdcd1833bc04311ab8b2 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/FluentClientGenerator.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/FluentClientGenerator.kt @@ -17,7 +17,6 @@ import software.amazon.smithy.rust.codegen.rustlang.RustType import software.amazon.smithy.rust.codegen.rustlang.RustWriter import software.amazon.smithy.rust.codegen.rustlang.asOptional import software.amazon.smithy.rust.codegen.rustlang.asType -import software.amazon.smithy.rust.codegen.rustlang.contains import software.amazon.smithy.rust.codegen.rustlang.documentShape import software.amazon.smithy.rust.codegen.rustlang.render import software.amazon.smithy.rust.codegen.rustlang.rust @@ -48,7 +47,7 @@ class FluentClientDecorator : RustCodegenDecorator { rustCrate.withModule(RustModule("client", module)) { writer -> FluentClientGenerator(protocolConfig).render(writer) } - val awsHyper = protocolConfig.runtimeConfig.awsHyper().name + val awsHyper = "aws-hyper" rustCrate.addFeature(Feature("client", true, listOf(awsHyper))) rustCrate.addFeature(Feature("rustls", default = true, listOf("$awsHyper/rustls"))) rustCrate.addFeature(Feature("native-tls", default = false, listOf("$awsHyper/native-tls"))) @@ -76,8 +75,8 @@ class FluentClientGenerator(protocolConfig: ProtocolConfig) { TopDownIndex.of(protocolConfig.model).getContainedOperations(serviceShape).sortedBy { it.id } private val symbolProvider = protocolConfig.symbolProvider private val model = protocolConfig.model - private val hyperDep = protocolConfig.runtimeConfig.awsHyper().copy(optional = true) private val runtimeConfig = protocolConfig.runtimeConfig + private val hyperDep = runtimeConfig.awsRuntimeDependency("aws-hyper").copy(optional = true) fun render(writer: RustWriter) { writer.rustTemplate( diff --git a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/IntegrationTestDependencies.kt b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/IntegrationTestDependencies.kt index 83694a60e242333b0a83f4c1e6c6923273d3fb27..cb03b3078ed3c99a85534117e198ec65e7b559b4 100644 --- a/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/IntegrationTestDependencies.kt +++ b/aws/sdk-codegen/src/main/kotlin/software/amazon/smithy/rustsdk/IntegrationTestDependencies.kt @@ -49,7 +49,8 @@ class IntegrationTestDependencies( override fun section(section: LibRsSection) = when (section) { LibRsSection.Body -> writable { if (hasTests) { - addDependency(runtimeConfig.awsHyper().copy(scope = DependencyScope.Dev)) + val smithyClient = CargoDependency.SmithyClient(runtimeConfig).copy(features = listOf("test-util"), scope = DependencyScope.Dev) + addDependency(smithyClient) addDependency(SerdeJson) addDependency(Tokio) } @@ -62,6 +63,5 @@ class IntegrationTestDependencies( } val Criterion = CargoDependency("criterion", CratesIo("0.3"), scope = DependencyScope.Dev) -val SerdeJson = CargoDependency("serde_json", CratesIo("1"), features = emptyList()) +val SerdeJson = CargoDependency("serde_json", CratesIo("1"), features = emptyList(), scope = DependencyScope.Dev) val Tokio = CargoDependency("tokio", CratesIo("1"), features = listOf("macros", "test-util"), scope = DependencyScope.Dev) -fun RuntimeConfig.awsHyper() = awsRuntimeDependency("aws-hyper", features = listOf("test-util")) diff --git a/aws/sdk/integration-tests/dynamodb/tests/movies.rs b/aws/sdk/integration-tests/dynamodb/tests/movies.rs index d4f8a00bd1c9cbab1dc8dcd5d354bcc8712d55cf..83a30aca3850ed94fd098814bc665d058a517e9b 100644 --- a/aws/sdk/integration-tests/dynamodb/tests/movies.rs +++ b/aws/sdk/integration-tests/dynamodb/tests/movies.rs @@ -6,7 +6,6 @@ use aws_sdk_dynamodb as dynamodb; use aws_http::AwsErrorRetryPolicy; -use aws_hyper::test_connection::TestConnection; use aws_hyper::{SdkError, SdkSuccess}; use aws_sdk_dynamodb::input::CreateTableInput; use dynamodb::error::DescribeTableError; @@ -21,6 +20,7 @@ use dynamodb::{Config, Credentials, Region}; use http::header::{HeaderName, AUTHORIZATION}; use http::Uri; use serde_json::Value; +use smithy_client::test_connection::TestConnection; use smithy_http::body::SdkBody; use smithy_http::operation::Operation; use smithy_http::retry::ClassifyResponse; diff --git a/aws/sdk/integration-tests/kms/tests/integration.rs b/aws/sdk/integration-tests/kms/tests/integration.rs index cb9a4cf2a80d66d45967dd21cce2668cebce4436..d0472c6edf30d0a4cacda139395fa43e480db2a5 100644 --- a/aws/sdk/integration-tests/kms/tests/integration.rs +++ b/aws/sdk/integration-tests/kms/tests/integration.rs @@ -5,13 +5,13 @@ use aws_auth::Credentials; use aws_http::user_agent::AwsUserAgent; -use aws_hyper::test_connection::TestConnection; use aws_hyper::{Client, SdkError}; use aws_sdk_kms as kms; use http::header::AUTHORIZATION; use http::Uri; use kms::operation::GenerateRandom; use kms::{Config, Region}; +use smithy_client::test_connection::TestConnection; use smithy_http::body::SdkBody; use std::time::{Duration, UNIX_EPOCH}; diff --git a/aws/sdk/integration-tests/qldbsession/tests/integration.rs b/aws/sdk/integration-tests/qldbsession/tests/integration.rs index bb5a68753961bd6e53ba5d63a85b8dbddd9f9d23..fa1ffc7f47941f94641bd26eacb1f7db32c5f302 100644 --- a/aws/sdk/integration-tests/qldbsession/tests/integration.rs +++ b/aws/sdk/integration-tests/qldbsession/tests/integration.rs @@ -5,13 +5,13 @@ use aws_auth::Credentials; use aws_http::user_agent::AwsUserAgent; -use aws_hyper::test_connection::TestConnection; use aws_hyper::Client; use aws_sdk_qldbsession as qldbsession; use http::Uri; use qldbsession::model::StartSessionRequest; use qldbsession::operation::SendCommand; use qldbsession::{Config, Region}; +use smithy_client::test_connection::TestConnection; use smithy_http::body::SdkBody; use std::time::{Duration, UNIX_EPOCH}; diff --git a/aws/sdk/integration-tests/s3/tests/signing-it.rs b/aws/sdk/integration-tests/s3/tests/signing-it.rs index 756e8b49389920171a442244f37a16c572b1d617..fc6090bbd2c32e226cc84db28a8ff037b68da19a 100644 --- a/aws/sdk/integration-tests/s3/tests/signing-it.rs +++ b/aws/sdk/integration-tests/s3/tests/signing-it.rs @@ -4,9 +4,9 @@ */ use aws_http::user_agent::AwsUserAgent; -use aws_hyper::test_connection::TestConnection; use aws_sdk_s3::operation::ListObjectsV2; use aws_sdk_s3::{Credentials, Region}; +use smithy_client::test_connection::TestConnection; use smithy_http::body::SdkBody; use std::time::{Duration, UNIX_EPOCH}; diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt index 7bf28d430149653b9e8a1b65987fd8b51af3933d..81972bb8d3314e31f7119726891c53a0e3064d12 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/CargoDependency.kt @@ -178,7 +178,7 @@ data class CargoDependency( fun SmithyHttp(runtimeConfig: RuntimeConfig) = runtimeConfig.runtimeCrate("http") fun SmithyHttpTower(runtimeConfig: RuntimeConfig) = runtimeConfig.runtimeCrate("http-tower") - fun SmithyClient(runtimeConfig: RuntimeConfig) = runtimeConfig.runtimeCrate("client", true) + fun SmithyClient(runtimeConfig: RuntimeConfig) = runtimeConfig.runtimeCrate("client") fun ProtocolTestHelpers(runtimeConfig: RuntimeConfig) = CargoDependency( "protocol-test-helpers", runtimeConfig.runtimeCrateLocation.crateLocation(), scope = DependencyScope.Dev diff --git a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt index 6b033190365aaefaa952337b4f53f81c3d96f5fa..56fbff23f21a8c3c13f24d5349b40f83b66e5cf1 100644 --- a/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt +++ b/codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/smithy/generators/FluentClientDecorator.kt @@ -280,7 +280,7 @@ class FluentClientGenerator(protocolConfig: ProtocolConfig) { M: #{client}::bounds::SmithyMiddleware, R: #{client}::retry::NewRequestPolicy, """, - "client" to CargoDependency.SmithyClient(runtimeConfig).asType(), + "client" to clientDep.asType(), ) { rustTemplate( """ @@ -301,7 +301,7 @@ class FluentClientGenerator(protocolConfig: ProtocolConfig) { "ok" to symbolProvider.toSymbol(operation.outputShape(model)), "operation_err" to operation.errorSymbol(symbolProvider), "sdk_err" to CargoDependency.SmithyHttp(runtimeConfig).asType().copy(name = "result::SdkError"), - "client" to CargoDependency.SmithyClient(runtimeConfig).asType(), + "client" to clientDep.asType(), ) members.forEach { member -> val memberName = symbolProvider.toMemberName(member) diff --git a/rust-runtime/smithy-client/Cargo.toml b/rust-runtime/smithy-client/Cargo.toml index c37f592909650c9aa6ade58b981b3191d6085759..669364c4cda0e303707ec54c31d1e3516707975e 100644 --- a/rust-runtime/smithy-client/Cargo.toml +++ b/rust-runtime/smithy-client/Cargo.toml @@ -9,7 +9,7 @@ license = "Apache-2.0" [features] test-util = ["protocol-test-helpers"] -default = ["test-util", "hyper", "rustls"] +default = ["hyper", "rustls"] native-tls = ["hyper", "hyper-tls"] rustls = ["hyper", "hyper-rustls"] diff --git a/rust-runtime/smithy-client/src/test_connection.rs b/rust-runtime/smithy-client/src/test_connection.rs index 40693f6119b79bfd0d043e338a348de30734f22d..29de07f91b8d239829147b475cf4b76e2062e430 100644 --- a/rust-runtime/smithy-client/src/test_connection.rs +++ b/rust-runtime/smithy-client/src/test_connection.rs @@ -2,7 +2,7 @@ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ -//! Module with client connectors usefule for testing. +//! Module with client connectors useful for testing. // TODO #![allow(missing_docs)]