Commit b42f118
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>1 parent ca45062 commit b42f118
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
0 commit comments