Loading CHANGELOG.next.toml +6 −0 Original line number Diff line number Diff line Loading @@ -27,3 +27,9 @@ message = "Add comments for docker settings needed when using this sdk" references = ["aws-sdk-rust#540"] meta = { "breaking" = false, "tada" = false, "bug" = false } author = "jmklix" [[smithy-rs]] message = "Fix issue with codegen on Windows where module names were incorrectly determined from filenames" references = ["smithy-rs#1505"] meta = { "breaking" = false, "tada" = false, "bug" = true } author = "kiiadi" codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustWriter.kt +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import software.amazon.smithy.rust.codegen.smithy.isOptional import software.amazon.smithy.rust.codegen.smithy.rustType import software.amazon.smithy.rust.codegen.util.orNull import software.amazon.smithy.utils.AbstractCodeWriter import java.io.File import java.util.function.BiFunction /** Loading Loading @@ -393,7 +394,7 @@ class RustWriter private constructor( } fun module(): String? = if (filename.startsWith("src") && filename.endsWith(".rs")) { filename.removeSuffix(".rs").split('/').last() filename.removeSuffix(".rs").substringAfterLast(File.separatorChar) } else null fun safeName(prefix: String = "var"): String { Loading codegen/src/test/kotlin/software/amazon/smithy/rust/lang/RustWriterTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -143,4 +143,10 @@ class RustWriterTest { ) sut.toString().shouldContain("inner: hello, regular: http::foo") } @Test fun `can handle file paths properly when determining module`() { val sut = RustWriter.forModule("src/module_name") sut.module().shouldBe("module_name") } } Loading
CHANGELOG.next.toml +6 −0 Original line number Diff line number Diff line Loading @@ -27,3 +27,9 @@ message = "Add comments for docker settings needed when using this sdk" references = ["aws-sdk-rust#540"] meta = { "breaking" = false, "tada" = false, "bug" = false } author = "jmklix" [[smithy-rs]] message = "Fix issue with codegen on Windows where module names were incorrectly determined from filenames" references = ["smithy-rs#1505"] meta = { "breaking" = false, "tada" = false, "bug" = true } author = "kiiadi"
codegen/src/main/kotlin/software/amazon/smithy/rust/codegen/rustlang/RustWriter.kt +2 −1 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import software.amazon.smithy.rust.codegen.smithy.isOptional import software.amazon.smithy.rust.codegen.smithy.rustType import software.amazon.smithy.rust.codegen.util.orNull import software.amazon.smithy.utils.AbstractCodeWriter import java.io.File import java.util.function.BiFunction /** Loading Loading @@ -393,7 +394,7 @@ class RustWriter private constructor( } fun module(): String? = if (filename.startsWith("src") && filename.endsWith(".rs")) { filename.removeSuffix(".rs").split('/').last() filename.removeSuffix(".rs").substringAfterLast(File.separatorChar) } else null fun safeName(prefix: String = "var"): String { Loading
codegen/src/test/kotlin/software/amazon/smithy/rust/lang/RustWriterTest.kt +6 −0 Original line number Diff line number Diff line Loading @@ -143,4 +143,10 @@ class RustWriterTest { ) sut.toString().shouldContain("inner: hello, regular: http::foo") } @Test fun `can handle file paths properly when determining module`() { val sut = RustWriter.forModule("src/module_name") sut.module().shouldBe("module_name") } }