mirror of https://github.com/smithy-lang/smithy-rs
Add MSRV to generated SDK Cargo.toml files (#3601)
This PR sets the `rust-version` property on generated Cargo.toml files for the AWS SDK crates. It doesn't attempt to place the property on the runtime crates for now since that will either require manual updating, or more machinery to automate. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
This commit is contained in:
parent
cfb97edbc4
commit
386ec3f1f7
|
@ -25,8 +25,13 @@ jobs:
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install gcc make python3-pip nginx git ruby openjdk-17-jre pkg-config libssl-dev faketime
|
sudo apt-get -y install gcc make python3-pip nginx git ruby pkg-config libssl-dev faketime
|
||||||
pip3 install certbuilder crlbuilder
|
pip3 install certbuilder crlbuilder
|
||||||
|
- name: Configure JDK
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: corretto
|
||||||
|
java-version: 17
|
||||||
- name: Stop nginx
|
- name: Stop nginx
|
||||||
run: sudo systemctl stop nginx
|
run: sudo systemctl stop nginx
|
||||||
- name: Checkout smithy-rs
|
- name: Checkout smithy-rs
|
||||||
|
|
|
@ -52,3 +52,9 @@ let result = client.wait_until_thing()
|
||||||
references = ["smithy-rs#119", "smithy-rs#3595", "smithy-rs#3593", "smithy-rs#3585", "smithy-rs#3571", "smithy-rs#3569"]
|
references = ["smithy-rs#119", "smithy-rs#3595", "smithy-rs#3593", "smithy-rs#3585", "smithy-rs#3571", "smithy-rs#3569"]
|
||||||
meta = { "breaking" = false, "tada" = true, "bug" = false, "target" = "client" }
|
meta = { "breaking" = false, "tada" = true, "bug" = false, "target" = "client" }
|
||||||
author = "jdisanti"
|
author = "jdisanti"
|
||||||
|
|
||||||
|
[[aws-sdk-rust]]
|
||||||
|
message = "SDK crates now set the `rust-version` property in their Cargo.toml files to indicate the minimum supported Rust version."
|
||||||
|
references = ["smithy-rs#3601"]
|
||||||
|
meta = { "breaking" = false, "tada" = true, "bug" = false }
|
||||||
|
author = "jdisanti"
|
||||||
|
|
|
@ -116,6 +116,7 @@ fun generateSmithyBuild(services: AwsServices): String {
|
||||||
${service.examplesUri(project)?.let { """"examples": "$it",""" } ?: ""}
|
${service.examplesUri(project)?.let { """"examples": "$it",""" } ?: ""}
|
||||||
"moduleRepository": "https://github.com/awslabs/aws-sdk-rust",
|
"moduleRepository": "https://github.com/awslabs/aws-sdk-rust",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"minimumSupportedRustVersion": "${getRustMSRV()}",
|
||||||
"customizationConfig": {
|
"customizationConfig": {
|
||||||
"awsSdk": {
|
"awsSdk": {
|
||||||
"awsSdkBuild": true,
|
"awsSdkBuild": true,
|
||||||
|
|
|
@ -37,6 +37,7 @@ data class ClientRustSettings(
|
||||||
override val codegenConfig: ClientCodegenConfig,
|
override val codegenConfig: ClientCodegenConfig,
|
||||||
override val license: String?,
|
override val license: String?,
|
||||||
override val examplesUri: String?,
|
override val examplesUri: String?,
|
||||||
|
override val minimumSupportedRustVersion: String? = null,
|
||||||
override val customizationConfig: ObjectNode?,
|
override val customizationConfig: ObjectNode?,
|
||||||
) : CoreRustSettings(
|
) : CoreRustSettings(
|
||||||
service,
|
service,
|
||||||
|
@ -49,6 +50,7 @@ data class ClientRustSettings(
|
||||||
codegenConfig,
|
codegenConfig,
|
||||||
license,
|
license,
|
||||||
examplesUri,
|
examplesUri,
|
||||||
|
minimumSupportedRustVersion,
|
||||||
customizationConfig,
|
customizationConfig,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -70,6 +72,7 @@ data class ClientRustSettings(
|
||||||
codegenConfig = ClientCodegenConfig.fromCodegenConfigAndNode(coreCodegenConfig, codegenSettingsNode),
|
codegenConfig = ClientCodegenConfig.fromCodegenConfigAndNode(coreCodegenConfig, codegenSettingsNode),
|
||||||
license = coreRustSettings.license,
|
license = coreRustSettings.license,
|
||||||
examplesUri = coreRustSettings.examplesUri,
|
examplesUri = coreRustSettings.examplesUri,
|
||||||
|
minimumSupportedRustVersion = coreRustSettings.minimumSupportedRustVersion,
|
||||||
customizationConfig = coreRustSettings.customizationConfig,
|
customizationConfig = coreRustSettings.customizationConfig,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ fun testClientRustSettings(
|
||||||
codegenConfig: ClientCodegenConfig = ClientCodegenConfig(),
|
codegenConfig: ClientCodegenConfig = ClientCodegenConfig(),
|
||||||
license: String? = null,
|
license: String? = null,
|
||||||
examplesUri: String? = null,
|
examplesUri: String? = null,
|
||||||
|
minimumSupportedRustVersion: String? = null,
|
||||||
customizationConfig: ObjectNode? = null,
|
customizationConfig: ObjectNode? = null,
|
||||||
) = ClientRustSettings(
|
) = ClientRustSettings(
|
||||||
service,
|
service,
|
||||||
|
@ -48,6 +49,7 @@ fun testClientRustSettings(
|
||||||
codegenConfig,
|
codegenConfig,
|
||||||
license,
|
license,
|
||||||
examplesUri,
|
examplesUri,
|
||||||
|
minimumSupportedRustVersion,
|
||||||
customizationConfig,
|
customizationConfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,18 @@ import software.amazon.smithy.model.shapes.ShapeId
|
||||||
import software.amazon.smithy.rust.codegen.core.util.orNull
|
import software.amazon.smithy.rust.codegen.core.util.orNull
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
import kotlin.streams.toList
|
|
||||||
|
|
||||||
const val SERVICE = "service"
|
private const val SERVICE = "service"
|
||||||
const val MODULE_NAME = "module"
|
private const val MODULE_NAME = "module"
|
||||||
const val MODULE_DESCRIPTION = "moduleDescription"
|
private const val MODULE_DESCRIPTION = "moduleDescription"
|
||||||
const val MODULE_VERSION = "moduleVersion"
|
private const val MODULE_VERSION = "moduleVersion"
|
||||||
const val MODULE_AUTHORS = "moduleAuthors"
|
private const val MODULE_AUTHORS = "moduleAuthors"
|
||||||
const val MODULE_REPOSITORY = "moduleRepository"
|
private const val MODULE_REPOSITORY = "moduleRepository"
|
||||||
const val RUNTIME_CONFIG = "runtimeConfig"
|
private const val RUNTIME_CONFIG = "runtimeConfig"
|
||||||
const val LICENSE = "license"
|
private const val LICENSE = "license"
|
||||||
const val EXAMPLES = "examples"
|
private const val EXAMPLES = "examples"
|
||||||
const val CUSTOMIZATION_CONFIG = "customizationConfig"
|
private const val MINIMUM_SUPPORTED_RUST_VERSION = "minimumSupportedRustVersion"
|
||||||
|
private const val CUSTOMIZATION_CONFIG = "customizationConfig"
|
||||||
const val CODEGEN_SETTINGS = "codegen"
|
const val CODEGEN_SETTINGS = "codegen"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,6 +88,7 @@ open class CoreRustSettings(
|
||||||
open val codegenConfig: CoreCodegenConfig,
|
open val codegenConfig: CoreCodegenConfig,
|
||||||
open val license: String?,
|
open val license: String?,
|
||||||
open val examplesUri: String? = null,
|
open val examplesUri: String? = null,
|
||||||
|
open val minimumSupportedRustVersion: String? = null,
|
||||||
open val customizationConfig: ObjectNode? = null,
|
open val customizationConfig: ObjectNode? = null,
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
|
@ -177,6 +178,7 @@ open class CoreRustSettings(
|
||||||
CODEGEN_SETTINGS,
|
CODEGEN_SETTINGS,
|
||||||
EXAMPLES,
|
EXAMPLES,
|
||||||
LICENSE,
|
LICENSE,
|
||||||
|
MINIMUM_SUPPORTED_RUST_VERSION,
|
||||||
CUSTOMIZATION_CONFIG,
|
CUSTOMIZATION_CONFIG,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -198,6 +200,7 @@ open class CoreRustSettings(
|
||||||
codegenConfig = coreCodegenConfig,
|
codegenConfig = coreCodegenConfig,
|
||||||
license = config.getStringMember(LICENSE).orNull()?.value,
|
license = config.getStringMember(LICENSE).orNull()?.value,
|
||||||
examplesUri = config.getStringMember(EXAMPLES).orNull()?.value,
|
examplesUri = config.getStringMember(EXAMPLES).orNull()?.value,
|
||||||
|
minimumSupportedRustVersion = config.getStringMember(MINIMUM_SUPPORTED_RUST_VERSION).orNull()?.value,
|
||||||
customizationConfig = config.getObjectMember(CUSTOMIZATION_CONFIG).orNull(),
|
customizationConfig = config.getObjectMember(CUSTOMIZATION_CONFIG).orNull(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ class CargoTomlGenerator(
|
||||||
private val moduleDescription: String?,
|
private val moduleDescription: String?,
|
||||||
private val moduleLicense: String?,
|
private val moduleLicense: String?,
|
||||||
private val moduleRepository: String?,
|
private val moduleRepository: String?,
|
||||||
|
private val minimumSupportedRustVersion: String?,
|
||||||
private val writer: RustWriter,
|
private val writer: RustWriter,
|
||||||
private val manifestCustomizations: ManifestCustomizations = emptyMap(),
|
private val manifestCustomizations: ManifestCustomizations = emptyMap(),
|
||||||
private val dependencies: List<CargoDependency> = emptyList(),
|
private val dependencies: List<CargoDependency> = emptyList(),
|
||||||
|
@ -67,6 +68,7 @@ class CargoTomlGenerator(
|
||||||
settings.moduleDescription,
|
settings.moduleDescription,
|
||||||
settings.license,
|
settings.license,
|
||||||
settings.moduleRepository,
|
settings.moduleRepository,
|
||||||
|
settings.minimumSupportedRustVersion,
|
||||||
writer,
|
writer,
|
||||||
manifestCustomizations,
|
manifestCustomizations,
|
||||||
dependencies,
|
dependencies,
|
||||||
|
@ -90,6 +92,7 @@ class CargoTomlGenerator(
|
||||||
"edition" to "2021",
|
"edition" to "2021",
|
||||||
"license" to moduleLicense,
|
"license" to moduleLicense,
|
||||||
"repository" to moduleRepository,
|
"repository" to moduleRepository,
|
||||||
|
minimumSupportedRustVersion?.let { "rust-version" to it },
|
||||||
"metadata" to
|
"metadata" to
|
||||||
listOfNotNull(
|
listOfNotNull(
|
||||||
"smithy" to
|
"smithy" to
|
||||||
|
|
|
@ -466,6 +466,7 @@ private fun String.intoCrate(
|
||||||
moduleDescription = null,
|
moduleDescription = null,
|
||||||
moduleLicense = null,
|
moduleLicense = null,
|
||||||
moduleRepository = null,
|
moduleRepository = null,
|
||||||
|
minimumSupportedRustVersion = null,
|
||||||
writer = this,
|
writer = this,
|
||||||
dependencies = deps,
|
dependencies = deps,
|
||||||
).render()
|
).render()
|
||||||
|
|
|
@ -38,6 +38,7 @@ data class ServerRustSettings(
|
||||||
override val codegenConfig: ServerCodegenConfig,
|
override val codegenConfig: ServerCodegenConfig,
|
||||||
override val license: String?,
|
override val license: String?,
|
||||||
override val examplesUri: String?,
|
override val examplesUri: String?,
|
||||||
|
override val minimumSupportedRustVersion: String? = null,
|
||||||
override val customizationConfig: ObjectNode?,
|
override val customizationConfig: ObjectNode?,
|
||||||
) : CoreRustSettings(
|
) : CoreRustSettings(
|
||||||
service,
|
service,
|
||||||
|
@ -50,6 +51,7 @@ data class ServerRustSettings(
|
||||||
codegenConfig,
|
codegenConfig,
|
||||||
license,
|
license,
|
||||||
examplesUri,
|
examplesUri,
|
||||||
|
minimumSupportedRustVersion,
|
||||||
customizationConfig,
|
customizationConfig,
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -71,6 +73,7 @@ data class ServerRustSettings(
|
||||||
codegenConfig = ServerCodegenConfig.fromCodegenConfigAndNode(coreCodegenConfig, codegenSettingsNode),
|
codegenConfig = ServerCodegenConfig.fromCodegenConfigAndNode(coreCodegenConfig, codegenSettingsNode),
|
||||||
license = coreRustSettings.license,
|
license = coreRustSettings.license,
|
||||||
examplesUri = coreRustSettings.examplesUri,
|
examplesUri = coreRustSettings.examplesUri,
|
||||||
|
minimumSupportedRustVersion = coreRustSettings.minimumSupportedRustVersion,
|
||||||
customizationConfig = coreRustSettings.customizationConfig,
|
customizationConfig = coreRustSettings.customizationConfig,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ fun serverTestRustSettings(
|
||||||
codegenConfig: ServerCodegenConfig = ServerCodegenConfig(),
|
codegenConfig: ServerCodegenConfig = ServerCodegenConfig(),
|
||||||
license: String? = null,
|
license: String? = null,
|
||||||
examplesUri: String? = null,
|
examplesUri: String? = null,
|
||||||
|
minimumSupportedRustVersion: String? = null,
|
||||||
customizationConfig: ObjectNode? = null,
|
customizationConfig: ObjectNode? = null,
|
||||||
) = ServerRustSettings(
|
) = ServerRustSettings(
|
||||||
service,
|
service,
|
||||||
|
@ -93,6 +94,7 @@ fun serverTestRustSettings(
|
||||||
codegenConfig,
|
codegenConfig,
|
||||||
license,
|
license,
|
||||||
examplesUri,
|
examplesUri,
|
||||||
|
minimumSupportedRustVersion,
|
||||||
customizationConfig,
|
customizationConfig,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue