Skip to content

Commit

Permalink
Update to Kotlin 2.0.0 (#223)
Browse files Browse the repository at this point in the history
Description
This updates Kotlin to 2.0.0
Also a bunch of other dependency updates

Motivation and Context
Updating to the latest and greatest to have better compilation performances.

How Has This Been Tested?
Ran samples, published locally
  • Loading branch information
npresseault authored Jul 16, 2024
1 parent 3e87cd9 commit 6364907
Show file tree
Hide file tree
Showing 76 changed files with 200 additions and 224 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ fastlane/test_output

# Android project
.gradle
.kotlin
.android
local.properties
.idea/
Expand Down
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Updates

- Gradle to `8.4`
- AGP to `8.1.2`
- Kotlin `2.0.0`
- Gradle to `8.8`
- AGP to `8.5.0`
- Ktlint to `11.6.1`
- Ktor to `2.3.5`
- Ktor to `2.3.12`
- Kotlin Serialization to `1.6.0`
- Kotlin Wrappers Extensions to `1.0.1-pre.628`
- Androidx Lifecycle to `2.6.2`
- ThreeTen Android Backport to `1.4.6`
- Kingfisher to `7.10.1`
- ReachabilitySwift to `5.2`
- AtomicFu to `0.24.0`
- Accompanist to `0.34.0`
- Okio to `3.9.0`
- Jetpack Compose Compiler plugin to `2.0.0`
- Jetpack Compose Runtime to `1.6.8`

### Breaking Changes

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p>Trikot is a framework that helps building Kotlin Multiplatform applications.<br />iOS, Android and Web are the primary targets.</p>
<a href="https://github.com/mirego/trikot/tags"><img src="https://img.shields.io/github/tag/mirego/trikot.svg?label=latest%20release"></a>
<img src="https://img.shields.io/maven-metadata/v?label=latest%20dev&metadataUrl=https%3A%2F%2Fmirego-maven.s3.amazonaws.com%2Fpublic%2Fcom%2Fmirego%2Ftrikot%2FtrikotFoundation%2Fmaven-metadata.xml" />
<a href="http://kotlinlang.org"><img src="https://img.shields.io/badge/kotlin-1.9.10-blue.svg?logo=kotlin" /></a>
<a href="http://kotlinlang.org"><img src="https://img.shields.io/badge/kotlin-2.0.0-blue.svg?logo=kotlin" /></a>
<a href="https://github.com/mirego/trikot/actions/workflows/ci.yml"><img src="https://github.com/mirego/trikot/actions/workflows/ci.yml/badge.svg" /></a>
<a href="https://github.com/mirego/trikot/actions/workflows/cd.yml"><img src="https://github.com/mirego/trikot/actions/workflows/cd.yml/badge.svg" /></a>
<a href="https://opensource.org/licenses/BSD-3-Clause"><img src="https://img.shields.io/badge/License-BSD_3--Clause-blue.svg" /></a>
Expand Down
10 changes: 10 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val samplesEnabled = !extra.has("disable_samples")

buildscript {
Expand All @@ -20,6 +23,7 @@ buildscript {
plugins {
id("mirego.publish").version("1.0")
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.13.2"
id("org.jetbrains.kotlin.plugin.compose") version Versions.KOTLIN apply false
}

allprojects {
Expand All @@ -31,6 +35,12 @@ allprojects {
maven("https://plugins.gradle.org/m2/")
maven("https://s3.amazonaws.com/mirego-maven/public")
}

tasks.withType<KotlinCompilationTask<*>> {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}

subprojects {
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10")
implementation("com.android.tools.build:gradle:8.1.2")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0")
implementation("com.android.tools.build:gradle:8.5.0")
}
13 changes: 7 additions & 6 deletions buildSrc/src/main/kotlin/Targets.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

@OptIn(ExperimentalKotlinGradlePluginApi::class)
fun KotlinMultiplatformExtension.configureKmmTargets(
js: Boolean = true,
android: Boolean = true,
Expand All @@ -11,7 +9,7 @@ fun KotlinMultiplatformExtension.configureKmmTargets(
watchos: Boolean = true,
macosx: Boolean = true,
) {
targetHierarchy.default()
applyDefaultHierarchyTemplate()
jvmToolchain(Versions.JVM_TOOLCHAIN)

if (android) {
Expand All @@ -23,15 +21,18 @@ fun KotlinMultiplatformExtension.configureKmmTargets(
jvm()
}
if (ios) {
ios()
iosX64()
iosArm64()
iosSimulatorArm64()
}
if (tvos) {
tvos()
tvosX64()
tvosArm64()
tvosSimulatorArm64()
}
if (watchos) {
watchos()
watchosX64()
watchosArm32()
watchosSimulatorArm64()
}
if (macosx) {
Expand Down
33 changes: 16 additions & 17 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
object Versions {
const val KOTLIN = "1.9.10"
const val ATOMIC_FU = "0.22.0"
const val ANDROID_GRADLE_PLUGIN = "8.1.2"
const val JETPACK_COMPOSE_COMPILER = "1.5.3"
const val JETPACK_COMPOSE_RUNTIME = "1.5.0"
const val JETPACK_COMPOSE_MATERIAL_3 = "1.1.1"
const val KOTLIN = "2.0.0"
const val ATOMIC_FU = "0.25.0"
const val ANDROID_GRADLE_PLUGIN = "8.5.1"
const val JETPACK_COMPOSE_RUNTIME = "1.6.8"
const val JETPACK_COMPOSE_MATERIAL_3 = "1.2.1"
const val JETPACK_COMPOSE_TV = "1.0.0-alpha10"
const val COIL = "2.5.0"
const val COIL = "2.6.0"
const val KTLINT = "11.6.1"
const val KOTLINX_SERIALIZATION = "1.6.0"
const val KOTLINX_COROUTINES = "1.7.3"
const val KOTLINX_DATETIME = "0.5.0"
const val KTOR = "2.3.5"
const val KOTLIN_WRAPPERS_EXTENSIONS = "1.0.1-pre.628"
const val ANDROIDX_LIFECYCLE = "2.6.2"
const val OKIO = "3.2.0"
const val KSP = "1.9.10-1.0.13"
const val KOTLIN_POET = "1.14.2"
const val ACCOMPANIST = "0.28.0"
const val KOTLINX_SERIALIZATION = "1.7.0"
const val KOTLINX_COROUTINES = "1.8.1"
const val KOTLINX_DATETIME = "0.6.0"
const val KTOR = "2.3.12"
const val KOTLIN_WRAPPERS_EXTENSIONS = "1.0.1-pre.760"
const val ANDROIDX_LIFECYCLE = "2.8.2"
const val OKIO = "3.9.0"
const val KSP = "2.0.0-1.0.21"
const val KOTLIN_POET = "1.17.0"
const val ACCOMPANIST = "0.34.0"

object Android {
const val TARGET_SDK = 34
Expand Down
4 changes: 1 addition & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
org.gradle.caching=true
kotlin.js.ir.dce=true
kotlin.mpp.stability.nowarn=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx3072m -XX\:+HeapDumpOnOutOfMemoryError -Dfile.encoding\=UTF-8
version=5.4.0
version=5.4.0-SNAPSHOT
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
kapt.incremental.apt=true
kotlin.mpp.androidSourceSetLayoutVersion=2
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion trikot-analytics/firebase-ktx/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("com.android.library")
id("kotlin-platform-android")
id("kotlin-android")
id("maven-publish")
id("mirego.publish")
}
Expand Down
2 changes: 1 addition & 1 deletion trikot-analytics/mixpanel-ktx/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id("com.android.library")
id("kotlin-platform-android")
id("kotlin-android")
id("maven-publish")
id("mirego.publish")
}
Expand Down
1 change: 0 additions & 1 deletion trikot-datasources/datasources-flow/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ kotlin {
}

val jsTest by getting {
dependsOn(commonTest)
dependencies {
implementation("org.jetbrains.kotlin:kotlin-test-js")
}
Expand Down
1 change: 0 additions & 1 deletion trikot-datasources/datasources-streams/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ kotlin {
}

val jsTest by getting {
dependsOn(commonTest)
dependencies {
implementation("org.jetbrains.kotlin:kotlin-test-js")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ public class com/mirego/trikot/foundation/concurrent/dispatchQueue/SequentialDis
public final class com/mirego/trikot/foundation/concurrent/dispatchQueue/SequentialDispatchQueue$Companion {
}

public final class com/mirego/trikot/foundation/concurrent/dispatchQueue/SerialSubscriptionDispatchQueue : com/mirego/trikot/foundation/concurrent/dispatchQueue/JvmDispatchQueue, com/mirego/trikot/foundation/concurrent/dispatchQueue/TrikotDispatchQueue {
public fun <init> ()V
}

public final class com/mirego/trikot/foundation/concurrent/dispatchQueue/SynchronousDispatchQueue : com/mirego/trikot/foundation/concurrent/dispatchQueue/TrikotDispatchQueue {
public fun <init> ()V
public fun dispatch (Lkotlin/jvm/functions/Function0;)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,6 @@ public class com/mirego/trikot/foundation/concurrent/dispatchQueue/SequentialDis
public final class com/mirego/trikot/foundation/concurrent/dispatchQueue/SequentialDispatchQueue$Companion {
}

public final class com/mirego/trikot/foundation/concurrent/dispatchQueue/SerialSubscriptionDispatchQueue : com/mirego/trikot/foundation/concurrent/dispatchQueue/JvmDispatchQueue, com/mirego/trikot/foundation/concurrent/dispatchQueue/TrikotDispatchQueue {
public fun <init> ()V
}

public final class com/mirego/trikot/foundation/concurrent/dispatchQueue/SynchronousDispatchQueue : com/mirego/trikot/foundation/concurrent/dispatchQueue/TrikotDispatchQueue {
public fun <init> ()V
public fun dispatch (Lkotlin/jvm/functions/Function0;)V
Expand Down
3 changes: 1 addition & 2 deletions trikot-foundation/trikotFoundation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ plugins {
kotlin("multiplatform")
id("com.android.library")
id("mirego.publish")
id("org.jetbrains.kotlinx.atomicfu")
}

apply(plugin = "kotlinx-atomicfu")

group = "com.mirego.trikot"

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ actual class UIThreadDispatchQueue actual constructor() : TrikotDispatchQueue {

private val mainLooperHandler: Handler = Handler(Looper.getMainLooper())

override fun isSerial() = true
actual override fun isSerial() = true

override fun dispatch(block: DispatchBlock) {
actual override fun dispatch(block: DispatchBlock) {
val currentCount: Int = count.incrementAndGet()
if (Looper.myLooper() == Looper.getMainLooper() && currentCount == 1) {
runQueueTask(block)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.mirego.trikot.foundation.concurrent.dispatchQueue

expect class OperationDispatchQueue() : TrikotDispatchQueue {
override fun isSerial(): Boolean
override fun dispatch(block: DispatchBlock)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
package com.mirego.trikot.foundation.concurrent.dispatchQueue

expect class UIThreadDispatchQueue() : TrikotDispatchQueue
expect class UIThreadDispatchQueue() : TrikotDispatchQueue {
override fun isSerial(): Boolean
override fun dispatch(block: DispatchBlock)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.mirego.trikot.foundation.concurrent.dispatchQueue

actual class OperationDispatchQueue : IOSGlobalDispatchQueue(), TrikotDispatchQueue

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.mirego.trikot.foundation.date

import com.mirego.trikot.foundation.system.OSVersion
import com.mirego.trikot.foundation.system.osVersionAtLeast
import kotlinx.cinterop.UnsafeNumber
import platform.Foundation.NSDate
import platform.Foundation.NSISO8601DateFormatWithFractionalSeconds
import platform.Foundation.NSISO8601DateFormatWithInternetDateTime
Expand Down Expand Up @@ -48,6 +49,7 @@ actual class Date(val nsDate: NSDate) {
return Date(NSDate(timeIntervalSinceReferenceDate = (epoch.toDouble() / 1000.0) - epochReferenceDateDelta))
}

@OptIn(UnsafeNumber::class)
@ExperimentalUnsignedTypes
private fun getFormatterWithCorrespondingFormatOptions(date: String): NSISO8601DateFormatter =
when {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.mirego.trikot.foundation.concurrent.dispatchQueue

actual open class OperationDispatchQueue : TrikotDispatchQueue {
actual override fun isSerial() = true
actual override fun dispatch(block: DispatchBlock) = block()
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.mirego.trikot.foundation.concurrent.dispatchQueue

actual class UIThreadDispatchQueue : TrikotDispatchQueue {
override fun dispatch(block: DispatchBlock) {
actual override fun dispatch(block: DispatchBlock) {
block()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.mirego.trikot.foundation.concurrent.dispatchQueue

actual class UIThreadDispatchQueue actual constructor() :
TrikotDispatchQueue {
override fun dispatch(block: DispatchBlock) {
actual override fun dispatch(block: DispatchBlock) {
block()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.mirego.trikot.foundation.concurrent.dispatchQueue

actual class OperationDispatchQueue : JvmDispatchQueue(), TrikotDispatchQueue

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package com.mirego.trikot.foundation.concurrent.dispatchQueue
import platform.Foundation.NSThread
import platform.darwin.dispatch_async
import platform.darwin.dispatch_get_main_queue
import kotlin.native.concurrent.AtomicInt
import kotlin.concurrent.AtomicInt

actual class UIThreadDispatchQueue actual constructor() : TrikotDispatchQueue {
private val count = AtomicInt(0)

override fun isSerial() = true
actual override fun isSerial() = true

override fun dispatch(block: DispatchBlock) {
actual override fun dispatch(block: DispatchBlock) {
val currentCount = count.addAndGet(1)
if (currentCount == 1 && NSThread.isMainThread) {
runQueueTask(block)
Expand Down
2 changes: 0 additions & 2 deletions trikot-graphql/graphql/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ kotlin {
}

val jsTest by getting {
dependsOn(commonTest)
dependencies {
implementation("org.jetbrains.kotlin:kotlin-test-js")
}
}

val androidMain by getting {
dependsOn(commonMain)
dependencies {
implementation("androidx.lifecycle:lifecycle-reactivestreams-ktx:${Versions.ANDROIDX_LIFECYCLE}")
}
Expand Down
Loading

0 comments on commit 6364907

Please sign in to comment.