Skip to content

Commit 8f08be6

Browse files
wojtek-kalicinskiSpace Team
authored andcommitted
[KGP] Workaround a crash in SwiftExportRunner due to older stdlib used
Gradle brings an older kotlin-stdlib to isolated workers which doesn't contain `sequenceOf(element:T)` See gradle/gradle#34442
1 parent 78adde6 commit 8f08be6

File tree

1 file changed

+4
-2
lines changed
  • native/swift/swift-export-standalone/src/org/jetbrains/kotlin/swiftexport/standalone

1 file changed

+4
-2
lines changed

native/swift/swift-export-standalone/src/org/jetbrains/kotlin/swiftexport/standalone/SwiftExportRunner.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ private fun writeRuntimeSupportModule(
203203

204204
val runtimeSupportContent = config.javaClass.getResource("/swift/KotlinRuntimeSupport.swift")?.readText()
205205
?: error("Can't find runtime support module")
206-
dumpTextAtFile(sequenceOf(runtimeSupportContent), outputPath.toFile())
206+
// arrayOf() used as workaround to target method from older kotlin-stlib due to https://github.com/gradle/gradle/issues/34442
207+
dumpTextAtFile(sequenceOf(*arrayOf(runtimeSupportContent)), outputPath.toFile())
207208

208209
return SwiftExportModule.SwiftOnly(
209210
swiftApi = outputPath,
@@ -213,7 +214,8 @@ private fun writeRuntimeSupportModule(
213214
}
214215

215216
private fun TranslationResult.writeModule(config: SwiftExportConfig): SwiftExportModule {
216-
val swiftSources = sequenceOf(swiftModuleSources) + moduleConfig.unsupportedDeclarationReporter.messages.map { "// $it" }
217+
// arrayOf() used as workaround to target method from older kotlin-stlib due to https://github.com/gradle/gradle/issues/34442
218+
val swiftSources = sequenceOf(*arrayOf(swiftModuleSources)) + moduleConfig.unsupportedDeclarationReporter.messages.map { "// $it" }
217219
val modulePath = config.outputPath / swiftModuleName
218220
val outputFiles = SwiftExportFiles(
219221
swiftApi = (modulePath / "$swiftModuleName.swift"),

0 commit comments

Comments
 (0)