diff --git a/aws/sdk-adhoc-test/build.gradle.kts b/aws/sdk-adhoc-test/build.gradle.kts index 2fbfe88ec8..c5459b1244 100644 --- a/aws/sdk-adhoc-test/build.gradle.kts +++ b/aws/sdk-adhoc-test/build.gradle.kts @@ -20,7 +20,6 @@ java { } val smithyVersion: String by project -val defaultRustDocFlags: String by project val properties = PropertyRetriever(rootProject, project) val pluginName = "rust-client-codegen" @@ -89,7 +88,7 @@ tasks["smithyBuild"].dependsOn("generateSmithyBuild") tasks["assemble"].finalizedBy("generateCargoWorkspace") project.registerModifyMtimeTask() -project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile, defaultRustDocFlags) +project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile) tasks["test"].finalizedBy(cargoCommands(properties).map { it.toString }) diff --git a/aws/sdk/build.gradle.kts b/aws/sdk/build.gradle.kts index 025e1239e4..2f977bd039 100644 --- a/aws/sdk/build.gradle.kts +++ b/aws/sdk/build.gradle.kts @@ -31,7 +31,6 @@ configure { } val smithyVersion: String by project -val defaultRustDocFlags: String by project val properties = PropertyRetriever(rootProject, project) val crateHasherToolPath = rootProject.projectDir.resolve("tools/ci-build/crate-hasher") @@ -461,7 +460,7 @@ tasks.register("copyCheckedInCargoLock") { into(outputDir) } -project.registerCargoCommandsTasks(outputDir.asFile, defaultRustDocFlags) +project.registerCargoCommandsTasks(outputDir.asFile) project.registerGenerateCargoConfigTomlTask(outputDir.asFile) //The task name "test" is already registered by one of our plugins diff --git a/buildSrc/src/main/kotlin/CodegenTestCommon.kt b/buildSrc/src/main/kotlin/CodegenTestCommon.kt index 8bf253ab6d..3c025288ac 100644 --- a/buildSrc/src/main/kotlin/CodegenTestCommon.kt +++ b/buildSrc/src/main/kotlin/CodegenTestCommon.kt @@ -205,13 +205,15 @@ fun Project.registerGenerateCargoWorkspaceTask( fun Project.registerGenerateCargoConfigTomlTask(outputDir: File) { this.tasks.register("generateCargoConfigToml") { description = "generate `.cargo/config.toml`" + // TODO(https://github.com/smithy-lang/smithy-rs/issues/1068): Once doc normalization + // is completed, warnings can be prohibited in rustdoc by setting `rustdocflags` to `-D warnings`. doFirst { outputDir.resolve(".cargo").mkdirs() outputDir.resolve(".cargo/config.toml") .writeText( """ [build] - rustflags = ["--deny", "warnings"] + rustflags = ["--deny", "warnings", "--cfg", "aws_sdk_unstable"] """.trimIndent(), ) } @@ -256,10 +258,7 @@ fun Project.registerModifyMtimeTask() { } } -fun Project.registerCargoCommandsTasks( - outputDir: File, - defaultRustDocFlags: String, -) { +fun Project.registerCargoCommandsTasks(outputDir: File) { val dependentTasks = listOfNotNull( "assemble", @@ -270,29 +269,29 @@ fun Project.registerCargoCommandsTasks( this.tasks.register(Cargo.CHECK.toString) { dependsOn(dependentTasks) workingDir(outputDir) - environment("RUSTFLAGS", "--cfg aws_sdk_unstable") commandLine("cargo", "check", "--lib", "--tests", "--benches", "--all-features") } this.tasks.register(Cargo.TEST.toString) { dependsOn(dependentTasks) workingDir(outputDir) - environment("RUSTFLAGS", "--cfg aws_sdk_unstable") commandLine("cargo", "test", "--all-features", "--no-fail-fast") } this.tasks.register(Cargo.DOCS.toString) { dependsOn(dependentTasks) workingDir(outputDir) - environment("RUSTDOCFLAGS", defaultRustDocFlags) - environment("RUSTFLAGS", "--cfg aws_sdk_unstable") - commandLine("cargo", "doc", "--no-deps", "--document-private-items") + val args = + mutableListOf( + "--no-deps", + "--document-private-items", + ) + commandLine("cargo", "doc", *args.toTypedArray()) } this.tasks.register(Cargo.CLIPPY.toString) { dependsOn(dependentTasks) workingDir(outputDir) - environment("RUSTFLAGS", "--cfg aws_sdk_unstable") commandLine("cargo", "clippy") } } diff --git a/codegen-client-test/build.gradle.kts b/codegen-client-test/build.gradle.kts index ac03a03490..21a90ac47b 100644 --- a/codegen-client-test/build.gradle.kts +++ b/codegen-client-test/build.gradle.kts @@ -15,7 +15,6 @@ plugins { } val smithyVersion: String by project -val defaultRustDocFlags: String by project val properties = PropertyRetriever(rootProject, project) fun getSmithyRuntimeMode(): String = properties.get("smithy.runtime.mode") ?: "orchestrator" @@ -134,7 +133,7 @@ tasks["smithyBuild"].dependsOn("generateSmithyBuild") tasks["assemble"].finalizedBy("generateCargoWorkspace") project.registerModifyMtimeTask() -project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile, defaultRustDocFlags) +project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile) tasks["test"].finalizedBy(cargoCommands(properties).map { it.toString }) diff --git a/codegen-server-test/build.gradle.kts b/codegen-server-test/build.gradle.kts index 8c4d5618bc..509b921877 100644 --- a/codegen-server-test/build.gradle.kts +++ b/codegen-server-test/build.gradle.kts @@ -16,7 +16,6 @@ plugins { } val smithyVersion: String by project -val defaultRustDocFlags: String by project val properties = PropertyRetriever(rootProject, project) val pluginName = "rust-server-codegen" @@ -112,7 +111,7 @@ tasks["smithyBuild"].dependsOn("generateSmithyBuild") tasks["assemble"].finalizedBy("generateCargoWorkspace", "generateCargoConfigToml") project.registerModifyMtimeTask() -project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile, defaultRustDocFlags) +project.registerCargoCommandsTasks(layout.buildDirectory.dir(workingDirUnderBuildDir).get().asFile) tasks["test"].finalizedBy(cargoCommands(properties).map { it.toString }) diff --git a/codegen-server-test/python/build.gradle.kts b/codegen-server-test/python/build.gradle.kts index 8fa340e7d4..2cfe8c5f99 100644 --- a/codegen-server-test/python/build.gradle.kts +++ b/codegen-server-test/python/build.gradle.kts @@ -16,7 +16,6 @@ plugins { } val smithyVersion: String by project -val defaultRustDocFlags: String by project val properties = PropertyRetriever(rootProject, project) val buildDir = layout.buildDirectory.get().asFile @@ -128,7 +127,7 @@ tasks["smithyBuild"].dependsOn("generateSmithyBuild") tasks["assemble"].finalizedBy("generateCargoWorkspace") project.registerModifyMtimeTask() -project.registerCargoCommandsTasks(buildDir.resolve(workingDirUnderBuildDir), defaultRustDocFlags) +project.registerCargoCommandsTasks(buildDir.resolve(workingDirUnderBuildDir)) tasks["test"].finalizedBy(cargoCommands(properties).map { it.toString }) diff --git a/codegen-server-test/typescript/build.gradle.kts b/codegen-server-test/typescript/build.gradle.kts index 428da17df6..22c27b7d90 100644 --- a/codegen-server-test/typescript/build.gradle.kts +++ b/codegen-server-test/typescript/build.gradle.kts @@ -16,7 +16,6 @@ plugins { } val smithyVersion: String by project -val defaultRustDocFlags: String by project val properties = PropertyRetriever(rootProject, project) val buildDir = layout.buildDirectory.get().asFile @@ -49,7 +48,7 @@ tasks["smithyBuild"].dependsOn("generateSmithyBuild") tasks["assemble"].finalizedBy("generateCargoWorkspace") project.registerModifyMtimeTask() -project.registerCargoCommandsTasks(buildDir.resolve(workingDirUnderBuildDir), defaultRustDocFlags) +project.registerCargoCommandsTasks(buildDir.resolve(workingDirUnderBuildDir)) tasks["test"].finalizedBy(cargoCommands(properties).map { it.toString }) diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerUnionGenerator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerUnionGenerator.kt index ef5a043a50..227d38df48 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerUnionGenerator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerUnionGenerator.kt @@ -154,7 +154,8 @@ class PythonServerUnionGenerator( ) { if (member.isTargetUnit()) { writer.rust( - "/// Tries to convert the union instance into [`$variantName`].", + "/// Tries to convert the enum instance into [`$variantName`](#T::$variantName), extracting the inner `()`.", + unionSymbol, ) writer.rust("/// :rtype None:") writer.rustBlockTemplate("pub fn as_$funcNamePart(&self) -> #{pyo3}::PyResult<()>", "pyo3" to pyo3) { diff --git a/gradle.properties b/gradle.properties index 6d06ec08dc..3180aa95ff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -32,9 +32,3 @@ ktlintVersion=1.0.1 kotestVersion=5.8.0 # Avoid registering dependencies/plugins/tasks that are only used for testing purposes isTestingEnabled=true - -# TODO(https://github.com/smithy-lang/smithy-rs/issues/1068): Once doc normalization -# is completed, warnings can be prohibited in rustdoc. -# -# defaultRustDocFlags=-D warnings -defaultRustDocFlags=