Skip to content

Commit

Permalink
Update to the latest Swift export version
Browse files Browse the repository at this point in the history
  • Loading branch information
sbogolepov authored and nikpachoo committed May 17, 2024
1 parent 157cb87 commit 779ccae
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
systemProp.kotlinVersion=2.0.0-RC3
systemProp.kotlinIdeVersion=1.9.20-506
systemProp.kotlinIdeVersionSuffix=IJ8109.175
systemProp.swiftExportVersion=2.0.20-dev-3080
systemProp.swiftExportVersion=2.0.20-dev-3623
systemProp.policy=executor.policy
systemProp.indexes=indexes.json
systemProp.indexesJs=indexesJs.json
Expand Down
10 changes: 5 additions & 5 deletions src/test/kotlin/com/compiler/server/SwiftConverterTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SwiftConverterTest : BaseExecutorTest() {
input = "fun foo(): UInt = 42",
expected = """
public func foo() -> Swift.UInt32 {
fatalError()
stub()
}
""".trimIndent()
)
Expand All @@ -49,10 +49,10 @@ class SwiftConverterTest : BaseExecutorTest() {
public class MyClass : KotlinRuntime.KotlinBase {
public override init() {
fatalError()
stub()
}
public func A() -> Swift.Void {
fatalError()
stub()
}
}
""".trimIndent()
Expand All @@ -69,7 +69,7 @@ class SwiftConverterTest : BaseExecutorTest() {
public extension Playground.foo.bar {
public static var myProperty: Swift.Int32 {
get {
fatalError()
stub()
}
}
}
Expand All @@ -92,7 +92,7 @@ class SwiftConverterTest : BaseExecutorTest() {
input = "fun foo(): Bar = error()",
expected = """
public func foo() -> ERROR_TYPE {
fatalError()
stub()
}
""".trimIndent()
)
Expand Down
10 changes: 9 additions & 1 deletion swift-export-playground/src/main/kotlin/Runner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.jetbrains.kotlin.analysis.project.structure.builder.buildKtLibraryMod
import org.jetbrains.kotlin.analysis.project.structure.builder.buildKtSourceModule
import org.jetbrains.kotlin.platform.konan.NativePlatforms
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.sir.SirFunctionBody
import org.jetbrains.kotlin.sir.SirModule
import org.jetbrains.kotlin.sir.SirMutableDeclarationContainer
import org.jetbrains.kotlin.sir.util.addChild
Expand Down Expand Up @@ -37,7 +38,14 @@ fun runSwiftExport(
}
}
}
SirAsSwiftSourcesPrinter.print(sirModule, stableDeclarationsOrder = true, renderDocComments = true)
SirAsSwiftSourcesPrinter.print(
sirModule,
stableDeclarationsOrder = true,
renderDocComments = true,
emptyBodyStub = SirFunctionBody(
listOf("stub()")
)
)
}
}

Expand Down
8 changes: 4 additions & 4 deletions swift-export-playground/src/test/kotlin/Tests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SwiftExportTests {
""",
"""
public func foo() -> Swift.Int32 {
fatalError()
stub()
}
"""
)
Expand All @@ -42,7 +42,7 @@ class SwiftExportTests {
public class A : KotlinRuntime.KotlinBase {
public override init() {
fatalError()
stub()
}
}
""".trimIndent()
Expand All @@ -59,11 +59,11 @@ class SwiftExportTests {
public class O : KotlinRuntime.KotlinBase {
public static var shared: Playground.O {
get {
fatalError()
stub()
}
}
private override init() {
fatalError()
stub()
}
}
""".trimIndent()
Expand Down

0 comments on commit 779ccae

Please sign in to comment.