fix(build): use invariantSeparatorsPath for PROJECT_DIR to ensure...
fix(build): use invariantSeparatorsPath for PROJECT_DIR to ensure cross-platform consistency (#4310) ## Motivation and Context On windows, the task `:smithy-rs:codegen-core:compileKotlin` fails: ``` > Task :smithy-rs:codegen-core:compileKotlin FAILED e: file:///C:/Users/.../.../smithy/smithy-rs/codegen-core/build/generated/src/main/kotlin/BuildEnvironment.kt:6:40 Unsupported escape sequence. ``` This means I cannot run the task to generate the server sdk crate on windows (`smithyBuild`) Example generated file: ``` object BuildEnvironment { const val MSRV: String = "1.86.0" const val PROJECT_DIR: String = "C:\Users\...\smithy\smithy-rs" } ``` ## Description Using `invariantSeparatorsPath` to use the invariant separator '/' to separate the names in the name sequence. The forward slashes as seperator still work on windows. ## Testing Executed task on windows and inspected BuildEnvironment.kt files. Now has forward slashes. ``` object BuildEnvironment { const val MSRV: String = "1.86.0" const val PROJECT_DIR: String = "C:/Users/.../smithy/smithy-rs" } ``` ## Checklist Not applicable ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ Co-authored-by:Landon James <lnj@amazon.com>
Loading
Please sign in to comment