Skip to content

Commit 32115b4

Browse files
hlbarberrcoh
authored andcommitted
Prevent build stalling with overlapping projections (#2602)
## Motivation and Context Smithy CLI runs projections concurrently, for some currently unknown reason this causes the build to stall. ## Description - Switch `defaultRustMetadata` in `BaseSymbolMetadataProvider` from a `val` to a `fun`. - Remove unused `RustType::TestModule` companion object. ## Notes A deadlock occurs when the client/server plugins both attempt to grab file locks. While this fixes this deadlock it is unknown whether there still exist conditions where it can happen. ## Testing 1. Checkout crisidev/smithy-rs-pokemon-service@d276bb9, run `./gradlew assemble`, and observe the build halting. 2. Run the following commands to switch to this branch: ```bash git submodule update --init --recursive --remote cd smithy-rs git checkout harryb/remove-build-deadlock cd .. ./gradlew assemble ``` 3. Observe the build succeeding.
1 parent 17ca4f2 commit 32115b4

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/rustlang/RustType.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,15 +422,6 @@ data class RustMetadata(
422422
fun hasDebugDerive(): Boolean {
423423
return derives.contains(RuntimeType.Debug)
424424
}
425-
426-
companion object {
427-
val TestModule = RustMetadata(
428-
visibility = Visibility.PRIVATE,
429-
additionalAttributes = listOf(
430-
Attribute.CfgTest,
431-
),
432-
)
433-
}
434425
}
435426

436427
data class Argument(val argument: String, val value: String, val type: String)

codegen-core/src/main/kotlin/software/amazon/smithy/rust/codegen/core/smithy/SymbolMetadataProvider.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ class BaseSymbolMetadataProvider(
137137

138138
// Only the server subproject uses these, so we provide a sane and conservative default implementation here so that
139139
// the rest of symbol metadata providers can just delegate to it.
140-
private val defaultRustMetadata = RustMetadata(visibility = Visibility.PRIVATE)
140+
private fun defaultRustMetadata() = RustMetadata(visibility = Visibility.PRIVATE)
141141

142-
override fun listMeta(listShape: ListShape) = defaultRustMetadata
143-
override fun mapMeta(mapShape: MapShape) = defaultRustMetadata
144-
override fun stringMeta(stringShape: StringShape) = defaultRustMetadata
145-
override fun numberMeta(numberShape: NumberShape) = defaultRustMetadata
146-
override fun blobMeta(blobShape: BlobShape) = defaultRustMetadata
142+
override fun listMeta(listShape: ListShape) = defaultRustMetadata()
143+
override fun mapMeta(mapShape: MapShape) = defaultRustMetadata()
144+
override fun stringMeta(stringShape: StringShape) = defaultRustMetadata()
145+
override fun numberMeta(numberShape: NumberShape) = defaultRustMetadata()
146+
override fun blobMeta(blobShape: BlobShape) = defaultRustMetadata()
147147
}
148148

149149
private const val META_KEY = "meta"

0 commit comments

Comments
 (0)