Skip to content

Commit

Permalink
Update Kotlin to 1.9.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite committed Jul 20, 2023
1 parent 14fae94 commit 2b0f8b0
Show file tree
Hide file tree
Showing 18 changed files with 309 additions and 544 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ systemProp.org.gradle.internal.http.socketTimeout=120000

kotlin.js.compiler=ir
kotlin.native.ignoreDisabledTargets=true
kotlin.mpp.androidSourceSetLayoutVersion1.nowarn=true
kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.mpp.stability.nowarn=true
kotlin.mpp.commonizerLogLevel=info
kotlin.mpp.enableCInteropCommonization=true
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[versions]
androidx-compose = "1.4.3"
androidx-compose-compiler = "1.4.8"
androidx-compose-compiler = "1.5.0"
auto-service="1.1.1"
compileSdk = "33"
http4k = "4.48.0.0"
kotlin = "1.8.22"
kotlin = "1.9.0"
kotlinx-coroutines = "1.7.2"
kotlinx-serialization = "1.5.1"
okHttp = "4.11.0"
Expand Down
807 changes: 271 additions & 536 deletions kotlin-js-store/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private val ziplineServiceClassId =
internal class FirZiplineApiReader(
output: FirResult,
) {
private val platformOutput = output.platformOutput
private val platformOutput = output.outputs.first()
private val session: FirSession = platformOutput.session

private val ziplineServiceClass: FirClassLikeSymbol<*>? =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.VfsBasedProjectEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.pipeline.GroupedKtSources
import org.jetbrains.kotlin.cli.jvm.compiler.pipeline.ModuleCompilerEnvironment
import org.jetbrains.kotlin.cli.jvm.compiler.pipeline.ModuleCompilerInput
import org.jetbrains.kotlin.cli.jvm.compiler.pipeline.compileModuleToAnalyzedFir
Expand Down Expand Up @@ -104,10 +105,13 @@ internal class KotlinFirLoader(

val input = ModuleCompilerInput(
targetId = TargetId(JvmProtoBufUtil.DEFAULT_MODULE_NAME, targetName),
groupedSources = GroupedKtSources(
platformSources = files.map(::KtVirtualFileSourceFile),
commonSources = emptyList(),
sourcesByModuleName = emptyMap(),
),
commonPlatform = CommonPlatforms.defaultCommonPlatform,
commonSources = emptyList(),
platform = JvmPlatforms.unspecifiedJvmPlatform,
platformSources = files.map(::KtVirtualFileSourceFile),
configuration = configuration,
)

Expand Down
2 changes: 1 addition & 1 deletion zipline-loader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {

kotlin {
jvm()
android {
androidTarget {
publishAllLibraryVariants()
}
if (false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package app.cash.zipline.loader

import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.experimental.ExperimentalNativeApi
import kotlin.native.concurrent.freeze
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.suspendCancellableCoroutine
Expand Down Expand Up @@ -93,6 +94,7 @@ private class CompletionHandler(
}

/** Freeze this when executing on Kotlin/Native's strict memory model. */
@OptIn(ExperimentalNativeApi::class)
private fun <T> T.maybeFreeze(): T {
return if (Platform.memoryModel == MemoryModel.STRICT) {
this.freeze()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(ExperimentalForeignApi::class)

package app.cash.zipline.loader.internal

import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.addressOf
import kotlinx.cinterop.alloc
import kotlinx.cinterop.convert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
package app.cash.zipline.testing

import kotlin.coroutines.CoroutineContext
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.convert
import kotlinx.coroutines.CloseableCoroutineDispatcher
import kotlinx.coroutines.Runnable
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.runBlocking
import platform.Foundation.NSThread

@OptIn(ExperimentalForeignApi::class)
actual fun singleThreadCoroutineDispatcher(
name: String,
stackSize: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package app.cash.zipline.testing

import kotlinx.coroutines.CloseableCoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi

/**
* Returns a CoroutineDispatcher that's confined to a single thread, appropriate for executing
Expand All @@ -24,6 +25,7 @@ import kotlinx.coroutines.CloseableCoroutineDispatcher
* On Apple platforms we need to explicitly set the stack size for background threads; otherwise we
* get the default of 512 KiB which isn't sufficient for our QuickJS programs.
*/
@ExperimentalCoroutinesApi
expect fun singleThreadCoroutineDispatcher(
name: String,
stackSize: Int = 1024 * 1024,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.ThreadPoolExecutor
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.CloseableCoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.asCoroutineDispatcher

@ExperimentalCoroutinesApi
actual fun singleThreadCoroutineDispatcher(
name: String,
stackSize: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
package app.cash.zipline.testing

import kotlinx.coroutines.CloseableCoroutineDispatcher
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.newSingleThreadContext

@ExperimentalCoroutinesApi
actual fun singleThreadCoroutineDispatcher(
name: String,
stackSize: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package app.cash.zipline.testing

import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.toKString
import okio.FileSystem
import platform.posix.getenv
Expand All @@ -23,6 +24,7 @@ actual val systemFileSystem = FileSystem.SYSTEM

actual val resourcesFileSystem: FileSystem? = null

@OptIn(ExperimentalForeignApi::class)
internal actual fun getEnv(name: String): String? = getenv(name)?.toKString()

actual val isJni: Boolean = false
2 changes: 1 addition & 1 deletion zipline/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ tasks.withType<KotlinNativeTest>().configureEach {
}

kotlin {
android {
androidTarget {
publishLibraryVariants("release")
}
jvm()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ internal fun <T : ZiplineService> ziplineServiceAdapter(
* key to identify a serializer for [typeName] that has [serializers] for its type arguments.
*/
@PublishedApi
@OptIn(ExperimentalSerializationApi::class) // Zipline must track ContextualSerializer API changes.
internal fun serialName(typeName: String, serializers: List<KSerializer<*>>): String {
return buildString {
append(typeName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(ExperimentalForeignApi::class)

package app.cash.zipline

import app.cash.zipline.internal.bridge.CallChannel
Expand All @@ -24,6 +26,7 @@ import app.cash.zipline.quickjs.JS_GetPropertyStr
import app.cash.zipline.quickjs.JS_Invoke
import app.cash.zipline.quickjs.JS_NewAtom
import app.cash.zipline.quickjs.JS_NewString
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.memScoped
import kotlinx.cinterop.utf8

Expand Down
4 changes: 4 additions & 0 deletions zipline/src/nativeMain/kotlin/app/cash/zipline/QuickJs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class)

package app.cash.zipline

import app.cash.zipline.internal.bridge.CallChannel
Expand Down Expand Up @@ -86,11 +88,13 @@ import app.cash.zipline.quickjs.JsValueGetInt
import app.cash.zipline.quickjs.JsValueGetNormTag
import app.cash.zipline.quickjs.installFinalizationRegistry
import app.cash.zipline.quickjs.js_free
import kotlin.experimental.ExperimentalNativeApi
import kotlinx.cinterop.CArrayPointer
import kotlinx.cinterop.COpaquePointer
import kotlinx.cinterop.CPointer
import kotlinx.cinterop.CValue
import kotlinx.cinterop.CValuesRef
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.StableRef
import kotlinx.cinterop.UByteVar
import kotlinx.cinterop.alloc
Expand Down
3 changes: 3 additions & 0 deletions zipline/src/nativeMain/kotlin/app/cash/zipline/nativeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(ExperimentalForeignApi::class)

package app.cash.zipline

import kotlinx.cinterop.CArrayPointer
import kotlinx.cinterop.CPointer
import kotlinx.cinterop.CValues
import kotlinx.cinterop.CVariable
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.NativePlacement
import kotlinx.cinterop.allocArray
import kotlinx.cinterop.interpretCPointer
Expand Down

0 comments on commit 2b0f8b0

Please sign in to comment.