Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade kotlin to 1.9.23 #2586

Merged
merged 20 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

kotlinOptions {
Expand All @@ -77,6 +78,6 @@ dependencies {
implementation(project(":network"))
implementation(project(":cryptography"))
implementation(project(":logic"))

implementation(libs.bundles.android)
coreLibraryDesugaring(libs.desugarJdkLibs)
}
22 changes: 13 additions & 9 deletions android/src/main/kotlin/com/wire/kalium/KaliumApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ package com.wire.kalium

import android.app.Application
import androidx.work.Configuration
import com.wire.kalium.android.R
import com.wire.kalium.logger.KaliumLogLevel
import com.wire.kalium.logic.CoreLogger
import com.wire.kalium.logic.CoreLogic
import com.wire.kalium.logic.featureFlags.KaliumConfigs
import com.wire.kalium.logic.sync.ForegroundNotificationDetailsProvider
import com.wire.kalium.logic.sync.WrapperWorkerFactory
import com.wire.kalium.android.R
import java.io.File

class KaliumApplication : Application(), Configuration.Provider {
Expand All @@ -48,14 +48,18 @@ class KaliumApplication : Application(), Configuration.Provider {
)
}

override fun getWorkManagerConfiguration(): Configuration {
val myWorkerFactory = WrapperWorkerFactory(coreLogic, object : ForegroundNotificationDetailsProvider {
override fun getSmallIconResId(): Int = R.drawable.ic_launcher_foreground
})
override val workManagerConfiguration: Configuration
get() {
val myWorkerFactory = WrapperWorkerFactory(
coreLogic,
object : ForegroundNotificationDetailsProvider {
override fun getSmallIconResId(): Int = R.drawable.ic_launcher_foreground
}
)

return Configuration.Builder()
.setWorkerFactory(myWorkerFactory)
.build()
}
return Configuration.Builder()
.setWorkerFactory(myWorkerFactory)
.build()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ package com.wire.kalium.plugins

import com.android.build.gradle.LibraryExtension
import org.gradle.api.JavaVersion
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget

private const val BASE_NAMESPACE = "com.wire.kalium"

fun KotlinAndroidTarget.commmonKotlinAndroidTargetConfig() {
@OptIn(ExperimentalKotlinGradlePluginApi::class) // this is experimental API and will likely change in the future into more robust DSL
instrumentedTestVariant {
sourceSetTree.set(KotlinSourceSetTree.test)
}
/** NO-OP. Nothing to do here for now **/
}

Expand Down Expand Up @@ -52,6 +58,7 @@ fun LibraryExtension.commonAndroidLibConfig(
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
isCoreLibraryDesugaringEnabled = true
}

packaging {
Expand Down
26 changes: 20 additions & 6 deletions buildSrc/src/main/kotlin/com/wire/kalium/plugins/Multiplatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package com.wire.kalium.plugins

import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.gradle.kotlin.dsl.dependencies
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

/**
Expand All @@ -30,7 +30,6 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
*
* @see commonDokkaConfig
*/
@OptIn(ExperimentalKotlinGradlePluginApi::class)
fun Project.configureDefaultMultiplatform(
enableApple: Boolean,
enableJs: Boolean,
Expand All @@ -44,10 +43,15 @@ fun Project.configureDefaultMultiplatform(
"No multiplatform extension found. Is the Kotlin Multiplatform plugin applied to this module?"
}
kotlinExtension.apply {
targetHierarchy.default()
applyDefaultHierarchyTemplate()
jvm { commonJvmConfig(includeNativeInterop, enableIntegrationTests) }

androidTarget { commmonKotlinAndroidTargetConfig() }
androidTarget {
commmonKotlinAndroidTargetConfig()
dependencies {
add("coreLibraryDesugaring", library("desugarJdkLibs"))
}
}

if (enableJs) {
js { commonJsConfig(enableJsTests) }
Expand All @@ -64,8 +68,6 @@ fun Project.configureDefaultMultiplatform(
}

kotlinExtension.sourceSets.getByName("androidInstrumentedTest") {
// Add dependency to commonTest, as it isn't added by default anymore since Kotlin 1.9
dependsOn(kotlinExtension.sourceSets.getByName("commonTest"))

dependencies {
// Add common runner and rules to Android Instrumented Tests
Expand All @@ -75,6 +77,18 @@ fun Project.configureDefaultMultiplatform(
}
}

kotlinExtension.sourceSets.getByName("commonTest") {
dependencies {
implementation(library("kotlin.test"))
}
}

configurations.all {
resolutionStrategy {
force("org.jetbrains.kotlin:kotlin-test:${libs.findVersion("kotlin").get().requiredVersion}")
}
}

kotlinExtension.sourceSets.all {
languageSettings {
// Most of the native code requires this opt-in
Expand Down
7 changes: 4 additions & 3 deletions buildSrc/src/main/kotlin/scripts/detekt.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ dependencies {
val detektVersion = libs.findVersion("detekt").get()
detekt("io.gitlab.arturbosch.detekt:detekt-cli:$detektVersion")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
detektPlugins("com.wire:detekt-rules:1.0.0-SNAPSHOT") {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-rules-libraries:$detektVersion")
detektPlugins("com.wire:detekt-rules:1.0.0-1.23.6") {
isChanging = true
}
}
Expand All @@ -39,8 +40,8 @@ detekt {
buildUponDefaultConfig = true
// activate all available (even unstable) rules.
// allRules = false
config = files("$rootDir/detekt/detekt.yml")
source = files("$rootDir")
config.setFrom(files("$rootDir/detekt/detekt.yml"))
source.setFrom(files("$rootDir"))
// a way of suppressing issues before introducing detekt
baseline = file("$rootDir/detekt/baseline.xml")

Expand Down
4 changes: 1 addition & 3 deletions calling/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ kotlin {
}

val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
dependencies { }
}
}
}
24 changes: 5 additions & 19 deletions cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,21 @@ tasks.jar {
}

kotlin {
val jvmTarget = jvm() {
applyDefaultHierarchyTemplate()
val jvmTarget = jvm {
commonJvmConfig(includeNativeInterop = false)
tasks.named("run", JavaExec::class) {
isIgnoreExitValue = true
standardInput = System.`in`
standardOutput = System.out
}
}
macosX64() {
macosX64 {
binaries {
executable()
}
}
macosArm64() {
macosArm64 {
binaries {
executable()
}
Expand All @@ -77,26 +78,16 @@ kotlin {
}
}
val jvmMain by getting {
dependsOn(commonMain)

dependencies {
implementation(libs.ktor.okHttp)
implementation(libs.okhttp.loggingInterceptor)
}
}
val appleMain by creating {
dependsOn(commonMain)

val macosMain by getting {
dependencies {
implementation(libs.ktor.iosHttp)
}
}
val macosX64Main by getting {
dependsOn(appleMain)
}
val macosArm64Main by getting {
dependsOn(appleMain)
}

tasks.withType<JavaExec> {
// code to make run task in kotlin multiplatform work
Expand All @@ -113,8 +104,3 @@ kotlin {
}

commonDokkaConfig()

tasks.withType<Wrapper> {
gradleVersion = "7.3.1"
distributionType = Wrapper.DistributionType.BIN
}
13 changes: 0 additions & 13 deletions cryptography/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,7 @@ kaliumLibrary {
}
}

android {
compileOptions {
isCoreLibraryDesugaringEnabled = true
}
}

kotlin {
androidTarget {
dependencies {
coreLibraryDesugaring(libs.desugarJdkLibs)
}
}

ios {
binaries.all {
linkerOpts("-framework", "Security")
Expand All @@ -71,7 +59,6 @@ kotlin {
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(libs.coroutines.test)
implementation(libs.okio.test)
}
Expand Down
Loading
Loading