diff --git a/.gitignore b/.gitignore index 202ee72a2..6cd6a1432 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.iml .gradle .idea +.kotlin /local.properties /.idea/caches /.idea/libraries diff --git a/build.gradle.kts b/build.gradle.kts index b925251af..5b422b593 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,7 @@ +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile buildscript { repositories { @@ -17,6 +20,7 @@ plugins { id("com.autonomousapps.dependency-analysis") version libs.versions.dependencyAnalysis.get() id("release-dependencies-diff-compare") id("release-dependencies-diff-create") apply false + alias(libs.plugins.compose.compiler) apply false } dependencyAnalysis { @@ -85,6 +89,16 @@ tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } +tasks.withType(KotlinJvmCompile::class.java).configureEach { + compilerOptions { + jvmTarget.set(JvmTarget.JVM_11) + apiVersion.set(KotlinVersion.KOTLIN_1_9) + languageVersion.set(KotlinVersion.KOTLIN_1_9) + // Generate default methods for implementations in interfaces. This is required for KAPT4. + freeCompilerArgs.add("-Xjvm-default=all") + } +} + allprojects { configurations.all { resolutionStrategy.dependencySubstitution { diff --git a/gradle.properties b/gradle.properties index dac2ecdb1..924b999b2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,4 +4,3 @@ org.gradle.parallel=true android.useAndroidX=true kotlin.code.style=official library.version=1.5.0 -android.experimental.lint.version=8.3.0 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b08607b23..00ddd6b53 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,28 +9,28 @@ androidx-lifecycle = "2.6.1" androidx-navigation-compose = "2.5.1" coil = "2.2.1" composeBom = "2024.04.00" -composeCompiler = "1.5.11" ribs = "0.39.0" mvicore = "1.2.6" -coroutines = "1.6.4" -kotlin = "1.9.23" +coroutines = "1.9.0-RC.2" +kotlin = "2.0.20" junit5 = "5.8.2" -detekt = "1.22.0" +detekt = "1.23.6" dependencyAnalysis = "1.31.0" [libraries] androidx-activity-compose = "androidx.activity:activity-compose:1.7.2" -androidx-appcompat = "androidx.appcompat:appcompat:1.3.1" -androidx-arch-core-testing = "androidx.arch.core:core-testing:2.1.0" -androidx-core = "androidx.core:core-ktx:1.9.0" -androidx-core-splashscreen = "androidx.core:core-splashscreen:1.0.0" +androidx-appcompat = "androidx.appcompat:appcompat:1.6.1" +androidx-arch-core-testing = "androidx.arch.core:core-testing:2.2.0" +androidx-core = "androidx.core:core-ktx:1.12.0" +androidx-core-splashscreen = "androidx.core:core-splashscreen:1.0.1" androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidx-lifecycle" } androidx-lifecycle-java8 = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref = "androidx-lifecycle" } androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androidx-lifecycle" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidx-navigation-compose" } -androidx-test-espresso-core = "androidx.test.espresso:espresso-core:3.5.0" -androidx-test-junit = "androidx.test.ext:junit:1.1.3" -androidx-test-rules = "androidx.test:rules:1.4.0" +androidx-tracing = "androidx.tracing:tracing:1.2.0" +androidx-test-espresso-core = "androidx.test.espresso:espresso-core:3.6.0" +androidx-test-junit = "androidx.test.ext:junit:1.2.0" +androidx-test-rules = "androidx.test:rules:1.6.0" coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" } compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" } # compose versions are resolved by BOM @@ -76,8 +76,9 @@ plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version. plugin-detekt = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" } plugin-android = "com.android.tools.build:gradle:8.2.2" -detekt-compose = "io.nlopez.compose.rules:detekt:0.1.5" +detekt-compose = "io.nlopez.compose.rules:detekt:0.1.6" toolargetool = "com.gu.android:toolargetool:0.3.0" [plugins] +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } diff --git a/libraries/core/build.gradle.kts b/libraries/core/build.gradle.kts index 663f56662..f60486504 100644 --- a/libraries/core/build.gradle.kts +++ b/libraries/core/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("kotlin-parcelize") id("appyx-publish-android") @@ -30,9 +31,6 @@ android { kotlinOptions { jvmTarget = JvmTarget.JVM_11.toString() } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } testOptions { unitTests.all { // interface method default implementation @@ -52,6 +50,7 @@ dependencies { api(libs.androidx.appcompat) api(libs.kotlin.coroutines.android) + debugImplementation(libs.androidx.tracing) // Espresso fails without this implementation(composeBom) implementation(libs.androidx.activity.compose) implementation(libs.androidx.lifecycle.java8) diff --git a/libraries/core/src/main/kotlin/com/bumble/appyx/core/children/ChildNodeCreationManager.kt b/libraries/core/src/main/kotlin/com/bumble/appyx/core/children/ChildNodeCreationManager.kt index 1b020aa96..29e9724fc 100644 --- a/libraries/core/src/main/kotlin/com/bumble/appyx/core/children/ChildNodeCreationManager.kt +++ b/libraries/core/src/main/kotlin/com/bumble/appyx/core/children/ChildNodeCreationManager.kt @@ -49,7 +49,8 @@ internal class ChildNodeCreationManager( when (keepMode) { ChildEntry.KeepMode.KEEP -> { navModelKeepKeys = - (state.onScreen + state.offScreen).mapNotNullToSet { element -> element.key } + state.onScreen.mapNotNullToSet { element -> element.key } + + state.offScreen.mapNotNullToSet { element -> element.key } navModelSuspendKeys = emptySet() navModelKeys = navModelKeepKeys } diff --git a/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Child.kt b/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Child.kt index da743771f..56439c01e 100644 --- a/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Child.kt +++ b/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Child.kt @@ -38,8 +38,8 @@ fun ParentNode.Child( transitionParams: TransitionParams, transitionHandler: TransitionHandler, decorator: @Composable ChildTransitionScope.( - child: ChildRenderer, - transitionDescriptor: TransitionDescriptor + ChildRenderer, + TransitionDescriptor ) -> Unit ) { val childEntry = remember(navElement.key.id) { childOrCreate(navElement.key) } @@ -55,11 +55,11 @@ fun ParentNode.Child( ) transitionScope.decorator( - child = ChildRendererImpl( + ChildRendererImpl( node = childEntry.node, transitionModifier = transitionScope.transitionModifier ), - transitionDescriptor = descriptor, + descriptor, ) } } diff --git a/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Children.kt b/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Children.kt index 9b27ff37e..7bafa664c 100644 --- a/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Children.kt +++ b/libraries/core/src/main/kotlin/com/bumble/appyx/core/composable/Children.kt @@ -91,12 +91,10 @@ class ChildrenTransitionScope( @Composable fun ParentNode.children( clazz: KClass, - block: @Composable ChildTransitionScope.(child: ChildRenderer) -> Unit, + block: @Composable ChildTransitionScope.(ChildRenderer) -> Unit, ) { _children(clazz) { scope, child, _ -> - scope.block( - child = child - ) + scope.block(child) } } @@ -104,14 +102,14 @@ class ChildrenTransitionScope( fun ParentNode.children( clazz: KClass, block: @Composable ChildTransitionScope.( - child: ChildRenderer, - transitionDescriptor: TransitionDescriptor + ChildRenderer, + TransitionDescriptor ) -> Unit, ) { _children(clazz) { scope, child, descriptor -> scope.block( - transitionDescriptor = descriptor, - child = child, + child, + descriptor, ) } } diff --git a/libraries/interop-ribs/build.gradle.kts b/libraries/interop-ribs/build.gradle.kts index 3543839c1..a86e2c23f 100644 --- a/libraries/interop-ribs/build.gradle.kts +++ b/libraries/interop-ribs/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("kotlin-parcelize") id("appyx-publish-android") @@ -22,9 +23,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/libraries/testing-junit4/build.gradle.kts b/libraries/testing-junit4/build.gradle.kts index f7d6969a5..06ccc4fda 100644 --- a/libraries/testing-junit4/build.gradle.kts +++ b/libraries/testing-junit4/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("appyx-publish-android") id("appyx-lint") @@ -21,9 +22,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/libraries/testing-junit5/build.gradle.kts b/libraries/testing-junit5/build.gradle.kts index a9f5b34dd..0ad856ea7 100644 --- a/libraries/testing-junit5/build.gradle.kts +++ b/libraries/testing-junit5/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("appyx-publish-android") id("appyx-lint") @@ -21,9 +22,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } packagingOptions { resources { excludes += setOf("META-INF/LICENSE.md", "META-INF/LICENSE-notice.md") diff --git a/libraries/testing-ui-activity/build.gradle.kts b/libraries/testing-ui-activity/build.gradle.kts index 35cac02f3..844187df9 100644 --- a/libraries/testing-ui-activity/build.gradle.kts +++ b/libraries/testing-ui-activity/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("appyx-publish-android") id("appyx-lint") @@ -19,9 +20,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/libraries/testing-ui/build.gradle.kts b/libraries/testing-ui/build.gradle.kts index ef7d0021b..2897f9337 100644 --- a/libraries/testing-ui/build.gradle.kts +++ b/libraries/testing-ui/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("appyx-publish-android") id("appyx-lint") @@ -21,9 +22,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/libraries/testing-unit-common/build.gradle.kts b/libraries/testing-unit-common/build.gradle.kts index 2201965fa..2c4fae76d 100644 --- a/libraries/testing-unit-common/build.gradle.kts +++ b/libraries/testing-unit-common/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("appyx-publish-android") id("appyx-lint") @@ -21,9 +22,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/plugins/publish-plugin/build.gradle.kts b/plugins/publish-plugin/build.gradle.kts index 10728ff46..473ecef62 100644 --- a/plugins/publish-plugin/build.gradle.kts +++ b/plugins/publish-plugin/build.gradle.kts @@ -16,7 +16,7 @@ java { targetCompatibility = JavaVersion.VERSION_11 } -tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile::class.java).configureEach { +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile::class.java).configureEach { kotlinOptions.jvmTarget = JvmTarget.JVM_11.toString() } diff --git a/samples/app/build.gradle.kts b/samples/app/build.gradle.kts index cdc902576..935cbd991 100644 --- a/samples/app/build.gradle.kts +++ b/samples/app/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.application") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("kotlin-parcelize") id("appyx-lint") @@ -49,10 +50,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } - compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 @@ -79,9 +76,4 @@ dependencies { implementation(libs.compose.ui.tooling) implementation(libs.compose.ui.ui) implementation(libs.google.material) - - androidTestImplementation(composeBom) - androidTestImplementation(libs.androidx.test.espresso.core) - androidTestImplementation(libs.androidx.test.junit) - androidTestImplementation(libs.compose.ui.test.junit4) } diff --git a/samples/common/build.gradle.kts b/samples/common/build.gradle.kts index 4d2ae1196..f1a82b85c 100644 --- a/samples/common/build.gradle.kts +++ b/samples/common/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("kotlin-parcelize") id("appyx-lint") @@ -21,9 +22,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/samples/navigation-compose/build.gradle.kts b/samples/navigation-compose/build.gradle.kts index e056d1a2f..fc2a079f2 100644 --- a/samples/navigation-compose/build.gradle.kts +++ b/samples/navigation-compose/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("kotlin-parcelize") id("appyx-lint") @@ -30,10 +31,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } - compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/samples/navmodel-samples/build.gradle.kts b/samples/navmodel-samples/build.gradle.kts index d2acb4772..735fd9b70 100644 --- a/samples/navmodel-samples/build.gradle.kts +++ b/samples/navmodel-samples/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.library") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("kotlin-parcelize") id("appyx-lint") @@ -21,10 +22,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } - compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 diff --git a/samples/sandbox/build.gradle.kts b/samples/sandbox/build.gradle.kts index cff15557b..b83eddb24 100644 --- a/samples/sandbox/build.gradle.kts +++ b/samples/sandbox/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.config.JvmTarget plugins { id("com.android.application") + alias(libs.plugins.compose.compiler) id("kotlin-android") id("kotlin-parcelize") id("appyx-lint") @@ -33,9 +34,6 @@ android { buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } packagingOptions { resources { excludes += setOf("META-INF/AL2.0", "META-INF/LGPL2.1")