From a4b8b64a09e28cee28f946610f68b89486e67ac1 Mon Sep 17 00:00:00 2001 From: Nicolas Presseault Date: Thu, 20 Jun 2024 16:55:24 -0400 Subject: [PATCH 1/4] WIP --- .gitignore | 1 + README.md | 3 +++ build.gradle.kts | 1 + components/android/coil/build.gradle.kts | 5 +---- components/android/material3/build.gradle.kts | 5 +---- components/common/build.gradle.kts | 11 +++++++---- gradle.properties | 3 +-- gradle/libs.versions.toml | 13 +++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- navigation/common/build.gradle.kts | 13 ++++++++----- 10 files changed, 31 insertions(+), 26 deletions(-) diff --git a/.gitignore b/.gitignore index 2dda5422..1ad09da9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea/ +.kotlin/ .gradle *.iml /local.properties diff --git a/README.md b/README.md index 9a643636..189e199a 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ Each [release](https://github.com/mirego/viewmodel-pilot/releases) outlines what kotlin 1.9.230.2.10 + + kotlin 2.0.00.3.0 + ## Libraries diff --git a/build.gradle.kts b/build.gradle.kts index 3ee820ea..f47dc439 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,7 @@ plugins { alias(libs.plugins.ktlint) apply false alias(libs.plugins.mirego.publish) apply false alias(libs.plugins.kotlinx.binaryCompatibilityValidator) apply false + alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.dokka) } diff --git a/components/android/coil/build.gradle.kts b/components/android/coil/build.gradle.kts index 5ad6ae29..c72920f7 100644 --- a/components/android/coil/build.gradle.kts +++ b/components/android/coil/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id("buildlogic.android.library") + alias(libs.plugins.compose.compiler) } group = "com.mirego.pilot" @@ -12,10 +13,6 @@ android { buildFeatures { compose = true } - - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } } dependencies { diff --git a/components/android/material3/build.gradle.kts b/components/android/material3/build.gradle.kts index dfbb072f..0001b030 100644 --- a/components/android/material3/build.gradle.kts +++ b/components/android/material3/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id("buildlogic.android.library") + alias(libs.plugins.compose.compiler) } group = "com.mirego.pilot" @@ -12,10 +13,6 @@ android { buildFeatures { compose = true } - - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } } dependencies { diff --git a/components/common/build.gradle.kts b/components/common/build.gradle.kts index 39e1aeff..9ea9dbed 100644 --- a/components/common/build.gradle.kts +++ b/components/common/build.gradle.kts @@ -1,21 +1,24 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType + plugins { id("buildlogic.kotlin.multiplatform") + alias(libs.plugins.compose.compiler) } group = "com.mirego.pilot" +composeCompiler { + targetKotlinPlatforms.set(setOf(KotlinPlatformType.androidJvm)) +} + android { namespace = "com.mirego.pilot.components" buildFeatures { compose = true } - - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } } kotlin { diff --git a/gradle.properties b/gradle.properties index fd2830d6..39f8a751 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,6 @@ org.gradle.configureondemand=false org.gradle.jvmargs=-Xmx4g android.enableJetifier=true android.useAndroidX=true -kotlin.native.cacheKind=none kotlin.mpp.stability.nowarn=true kotlin.mpp.androidGradlePluginCompatibility.nowarn=true -version=0.2.14-SNAPSHOT +version=0.3.0-SNAPSHOT diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 114519bb..5d3863fb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,15 +1,15 @@ [versions] -kotlin = "1.9.23" -agp = "8.4.0" +kotlin = "2.0.0" +agp = "8.5.0" ktlint = "12.1.0" binary-compatibility = "0.13.2" -androidx-compose-runtime = "1.6.7" +androidx-compose-runtime = "1.6.8" androidx-compose-material3 = "1.2.1" -androidx-lifecycle = "2.7.0" +androidx-lifecycle = "2.8.2" androidx-navigation = "2.7.7" androidx-activity-compose = "1.9.0" -androidx-compose-compiler = "1.5.13" -kotlinx-coroutines = "1.8.0" +androidx-compose-compiler = "1.5.14" +kotlinx-coroutines = "1.8.1" mirego-publish = "1.5" coil = "2.5.0" dokka = "1.9.20" @@ -45,6 +45,7 @@ kotlinx-binaryCompatibilityValidator = { group = "org.jetbrains.kotlinx", name = android-library = { id = "com.android.library", version.ref = "agp" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } kotlinx-binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility" } mirego-publish = { id = "mirego.publish", version.ref = "mirego-publish" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a..a4413138 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/navigation/common/build.gradle.kts b/navigation/common/build.gradle.kts index dc90887e..02b2f0fd 100644 --- a/navigation/common/build.gradle.kts +++ b/navigation/common/build.gradle.kts @@ -1,7 +1,10 @@ @file:Suppress("DSL_SCOPE_VIOLATION") +import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType + plugins { id("buildlogic.kotlin.multiplatform") + alias(libs.plugins.compose.compiler) } group = "com.mirego.pilot" @@ -13,16 +16,16 @@ ktlint { } } +composeCompiler { + targetKotlinPlatforms.set(setOf(KotlinPlatformType.androidJvm)) +} + android { namespace = "com.mirego.pilot.navigation" buildFeatures { compose = true } - - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } } kotlin { @@ -35,13 +38,13 @@ kotlin { val commonTest by getting { dependencies { implementation(libs.kotlin.test) - implementation(libs.kotlin.test.junit) implementation(libs.kotlinx.coroutines.test) implementation(libs.assertk) } } val androidMain by getting { dependencies { + implementation(libs.kotlin.test.junit) implementation(libs.kotlin.stdlib.jdk8) implementation(libs.bundles.lifecycle) implementation(libs.androidx.compose.ui) From b0605c56d6db450309494460cd59cc34ffce8a19 Mon Sep 17 00:00:00 2001 From: Nicolas Presseault Date: Fri, 21 Jun 2024 08:56:04 -0400 Subject: [PATCH 2/4] Cleanup --- gradle/libs.versions.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5d3863fb..3a823c84 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,7 +8,6 @@ androidx-compose-material3 = "1.2.1" androidx-lifecycle = "2.8.2" androidx-navigation = "2.7.7" androidx-activity-compose = "1.9.0" -androidx-compose-compiler = "1.5.14" kotlinx-coroutines = "1.8.1" mirego-publish = "1.5" coil = "2.5.0" From 03006091dfe37bc6d6576eaf521612699ff6153c Mon Sep 17 00:00:00 2001 From: Nicolas Presseault Date: Fri, 21 Jun 2024 11:08:17 -0400 Subject: [PATCH 3/4] fix namespace --- components/android/coil/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/android/coil/build.gradle.kts b/components/android/coil/build.gradle.kts index c72920f7..c2baa61f 100644 --- a/components/android/coil/build.gradle.kts +++ b/components/android/coil/build.gradle.kts @@ -8,7 +8,7 @@ plugins { group = "com.mirego.pilot" android { - namespace = "com.mirego.pilot.components.material3" + namespace = "com.mirego.pilot.components.coil" buildFeatures { compose = true From 07db218ebcdb7d5bbdcbe75cb8b65e4017018c89 Mon Sep 17 00:00:00 2001 From: Nicolas Presseault Date: Mon, 15 Jul 2024 11:11:35 -0400 Subject: [PATCH 4/4] Fix warnings --- .../mirego/viewmodel/pilot/KotlinAndroid.kt | 22 +++++++++++++------ build.gradle.kts | 7 ++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt index 40a0b52e..da553fe9 100644 --- a/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/com/mirego/viewmodel/pilot/KotlinAndroid.kt @@ -4,7 +4,9 @@ import com.android.build.api.dsl.CommonExtension import org.gradle.api.JavaVersion import org.gradle.api.Project import org.gradle.kotlin.dsl.withType -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile private object Constants { val JAVA_VERSION = JavaVersion.VERSION_17 @@ -30,12 +32,18 @@ internal fun Project.configureKotlinAndroid( } private fun Project.configureKotlin() { - tasks.withType().configureEach { - kotlinOptions { - jvmTarget = Constants.JAVA_VERSION.toString() - freeCompilerArgs += listOf( - "-Xopt-in=kotlin.RequiresOptIn", - "-Xopt-in=com.mirego.pilot.components.InternalPilotComponentsApi" + tasks.withType().configureEach { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_17) + } + } + tasks.withType> { + compilerOptions { + optIn.addAll( + listOf( + "kotlin.RequiresOptIn", + "com.mirego.pilot.components.InternalPilotComponentsApi", + ), ) } } diff --git a/build.gradle.kts b/build.gradle.kts index f47dc439..ee3b7a86 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,4 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask plugins { alias(libs.plugins.kotlin.android) apply false @@ -16,6 +17,12 @@ allprojects { google() mavenCentral() } + + tasks.withType> { + compilerOptions { + freeCompilerArgs.add("-Xexpect-actual-classes") + } + } } subprojects {