Skip to content
Unverified Commit b42f1186 authored by PeterUlb's avatar PeterUlb Committed by GitHub
Browse files

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: default avatarLandon James <lnj@amazon.com>
parent ca450625
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment