diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cc8f62767..09e9e8bdb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ # 1.7.2 - In Progress +- [Refactor] Update to Kotlin 2.0 - [FIX] Distinct fap items by id in paging sources - [FIX] Battery level charge - [FIX] Button arrow tint diff --git a/build-logic/plugins/convention/build.gradle.kts b/build-logic/plugins/convention/build.gradle.kts index 4ff5519ecc..5fb40a9b08 100644 --- a/build-logic/plugins/convention/build.gradle.kts +++ b/build-logic/plugins/convention/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { implementation(libs.square.anvil.gradle) implementation(libs.ktorfit.gradle) implementation(libs.compose.multiplatform.gradle) + implementation(libs.compose.gradle) implementation(libs.kotlin.jvm.gradle) implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) diff --git a/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesPlugin.kt b/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesPlugin.kt index e8e0b41682..7e3f3f9690 100644 --- a/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesPlugin.kt +++ b/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesPlugin.kt @@ -17,13 +17,13 @@ class FlipperMultiplatformDependenciesPlugin : Plugin { } else { fullSourceSetName } - - target.extensions.create( - "${noMainSourceSetName}Dependencies", - FlipperMultiplatformDependenciesScope::class, - target, - fullSourceSetName - ) + sourceSet.dependencies { + target.extensions.create( + "${noMainSourceSetName}Dependencies", + FlipperMultiplatformDependenciesScope::class, + this + ) + } } } diff --git a/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesScope.kt b/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesScope.kt index 5ed6495c65..a54b883738 100644 --- a/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesScope.kt +++ b/build-logic/plugins/convention/src/main/kotlin/com/flipperdevices/buildlogic/plugin/FlipperMultiplatformDependenciesScope.kt @@ -1,14 +1,7 @@ package com.flipperdevices.buildlogic.plugin -import com.flipperdevices.buildlogic.util.ProjectExt.kotlin -import org.gradle.api.Project import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler -import org.jetbrains.kotlin.gradle.plugin.mpp.DefaultKotlinDependencyHandler open class FlipperMultiplatformDependenciesScope( - project: Project, - name: String -) : KotlinDependencyHandler by DefaultKotlinDependencyHandler( - parent = project.kotlin.sourceSets.getByName(name), - project = project -) + handler: KotlinDependencyHandler +) : KotlinDependencyHandler by handler diff --git a/build-logic/plugins/convention/src/main/kotlin/commonAndroid.kt b/build-logic/plugins/convention/src/main/kotlin/commonAndroid.kt index ca32a041d2..7594a0098c 100644 --- a/build-logic/plugins/convention/src/main/kotlin/commonAndroid.kt +++ b/build-logic/plugins/convention/src/main/kotlin/commonAndroid.kt @@ -11,6 +11,7 @@ import org.gradle.api.artifacts.Dependency import org.gradle.api.artifacts.dsl.DependencyHandler import org.gradle.kotlin.dsl.add import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile private const val SPLASH_SCREEN_ACTIVITY = "com.flipperdevices.singleactivity.impl.SingleActivity" @@ -101,21 +102,21 @@ private fun BaseExtension.configureCompileOptions() { private fun Project.suppressOptIn() { tasks.withType() .configureEach { - kotlinOptions { - jvmTarget = "11" - - freeCompilerArgs = freeCompilerArgs + listOf( - "-opt-in=com.google.accompanist.pager.ExperimentalPagerApi", - "-opt-in=androidx.compose.ui.ExperimentalComposeUiApi", - "-opt-in=androidx.compose.foundation.ExperimentalFoundationApi", - "-opt-in=kotlinx.serialization.ExperimentalSerializationApi", - "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", - "-opt-in=com.squareup.anvil.annotations.ExperimentalAnvilApi", - "-opt-in=kotlin.time.ExperimentalTime", - "-opt-in=kotlin.RequiresOptIn", - "-opt-in=androidx.compose.animation.ExperimentalAnimationApi", - "-opt-in=com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi", // ktlint-disable max-line-length - "-opt-in=androidx.compose.foundation.layout.ExperimentalLayoutApi" + compilerOptions { + jvmTarget.set(JvmTarget.JVM_11) + + optIn.addAll( + "com.google.accompanist.pager.ExperimentalPagerApi", + "androidx.compose.ui.ExperimentalComposeUiApi", + "androidx.compose.foundation.ExperimentalFoundationApi", + "kotlinx.serialization.ExperimentalSerializationApi", + "kotlinx.coroutines.ExperimentalCoroutinesApi", + "com.squareup.anvil.annotations.ExperimentalAnvilApi", + "kotlin.time.ExperimentalTime", + "kotlin.RequiresOptIn", + "androidx.compose.animation.ExperimentalAnimationApi", + "com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi", // ktlint-disable max-line-length + "androidx.compose.foundation.layout.ExperimentalLayoutApi" ) } } diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.android-app.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.android-app.gradle.kts index 4a9a63453e..a5ae633e3d 100644 --- a/build-logic/plugins/convention/src/main/kotlin/flipper.android-app.gradle.kts +++ b/build-logic/plugins/convention/src/main/kotlin/flipper.android-app.gradle.kts @@ -9,6 +9,7 @@ plugins { id("kotlin-android") id("io.sentry.android.gradle") id("flipper.lint") + id("org.jetbrains.kotlin.plugin.compose") } @Suppress("UnstableApiUsage") diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.android-compose.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.android-compose.gradle.kts index c932489866..2e10a90f23 100644 --- a/build-logic/plugins/convention/src/main/kotlin/flipper.android-compose.gradle.kts +++ b/build-logic/plugins/convention/src/main/kotlin/flipper.android-compose.gradle.kts @@ -1,14 +1,4 @@ -import com.android.build.gradle.BaseExtension - plugins { id("flipper.android-lib") -} - -@Suppress("UnstableApiUsage") -configure { - buildFeatures.compose = true - - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } + id("org.jetbrains.kotlin.plugin.compose") } diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.anvil.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.anvil.gradle.kts index 3e238b094b..d25c17a615 100644 --- a/build-logic/plugins/convention/src/main/kotlin/flipper.anvil.gradle.kts +++ b/build-logic/plugins/convention/src/main/kotlin/flipper.anvil.gradle.kts @@ -3,17 +3,16 @@ plugins { } anvil { - generateDaggerFactories.set(true) + useKsp(contributesAndFactoryGeneration = true) + generateDaggerFactories = true } pluginManager.withPlugin("kotlin-kapt") { - anvil { - generateDaggerFactories.set(false) - } + error("Please, use `id(\"flipper.anvil.kapt\")` instead") } dependencies { "implementation"(libs.dagger) "implementation"(libs.anvil.utils.annotations) - "anvil"(libs.anvil.utils.compiler) + "ksp"(libs.anvil.utils.compiler) } diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.anvil.kapt.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.anvil.kapt.gradle.kts new file mode 100644 index 0000000000..3c567fa456 --- /dev/null +++ b/build-logic/plugins/convention/src/main/kotlin/flipper.anvil.kapt.gradle.kts @@ -0,0 +1,29 @@ +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion +import org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + id("com.squareup.anvil") +} + +tasks.withType().configureEach { + // TODO necessary until anvil supports something for K2 contribution merging + compilerOptions { + progressiveMode.set(false) + languageVersion.set(KotlinVersion.KOTLIN_1_9) + } +} + +tasks.withType().configureEach { + // TODO necessary until anvil supports something for K2 contribution merging + compilerOptions { + progressiveMode.set(false) + languageVersion.set(KotlinVersion.KOTLIN_1_9) + } +} + +dependencies { + "implementation"(libs.dagger) + "implementation"(libs.anvil.utils.annotations) + "anvil"(libs.anvil.utils.compiler) +} diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform-compose.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform-compose.gradle.kts index 8070edd831..bf0378fd2b 100644 --- a/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform-compose.gradle.kts +++ b/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform-compose.gradle.kts @@ -1,8 +1,10 @@ import com.android.build.gradle.BaseExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { id("org.jetbrains.kotlin.multiplatform") id("org.jetbrains.compose") + id("org.jetbrains.kotlin.plugin.compose") id("com.android.library") id("flipper.lint") } @@ -13,10 +15,8 @@ configure { kotlin { androidTarget { - compilations.all { - kotlinOptions { - jvmTarget = "1.8" - } + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 } } jvm("desktop") diff --git a/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform.gradle.kts b/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform.gradle.kts index 2bed5d0fb3..3d30a1360b 100644 --- a/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform.gradle.kts +++ b/build-logic/plugins/convention/src/main/kotlin/flipper.multiplatform.gradle.kts @@ -1,4 +1,5 @@ import com.android.build.gradle.BaseExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { id("org.jetbrains.kotlin.multiplatform") @@ -12,10 +13,8 @@ configure { kotlin { androidTarget { - compilations.all { - kotlinOptions { - jvmTarget = "1.8" - } + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 } } jvm("desktop") diff --git a/build.gradle.kts b/build.gradle.kts index 94b4610a82..0712955fe5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,8 +7,9 @@ plugins { alias(libs.plugins.square.anvil) apply false alias(libs.plugins.protobuf) apply false alias(libs.plugins.google.gms) apply false - id("flipper.lint") alias(libs.plugins.android.test) apply false alias(libs.plugins.baselineprofile) apply false + id("flipper.lint") + alias(libs.plugins.compose) apply false alias(libs.plugins.buildkonfig) apply false } diff --git a/components/bridge/connection/sample/build.gradle.kts b/components/bridge/connection/sample/build.gradle.kts index 004532bca4..6fa33a0672 100644 --- a/components/bridge/connection/sample/build.gradle.kts +++ b/components/bridge/connection/sample/build.gradle.kts @@ -1,6 +1,6 @@ plugins { id("flipper.android-app") - id("flipper.anvil") + id("flipper.anvil.kapt") id("kotlin-kapt") id("kotlinx-serialization") } @@ -9,9 +9,6 @@ android.namespace = "com.flipperdevices.bridge.connection" android { buildFeatures.compose = true - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } } android { diff --git a/components/faphub/appcard/composable/src/main/java/com/flipperdevices/faphub/appcard/composable/AppCard.kt b/components/faphub/appcard/composable/src/main/java/com/flipperdevices/faphub/appcard/composable/AppCard.kt index 7a62ab31a1..1f821a4e02 100644 --- a/components/faphub/appcard/composable/src/main/java/com/flipperdevices/faphub/appcard/composable/AppCard.kt +++ b/components/faphub/appcard/composable/src/main/java/com/flipperdevices/faphub/appcard/composable/AppCard.kt @@ -77,7 +77,7 @@ fun AppCard( private fun AppCardTop( fapItem: FapItemShort?, modifier: Modifier = Modifier, - installationButton: @Composable (modifier: Modifier) -> Unit + installationButton: @Composable (Modifier) -> Unit ) { Row( modifier = modifier @@ -110,7 +110,7 @@ private fun AppCardTop( ) } installationButton( - modifier = Modifier + Modifier .fillMaxHeight() .padding(vertical = 4.dp) ) diff --git a/components/nfceditor/sample/build.gradle.kts b/components/nfceditor/sample/build.gradle.kts index 68905f8708..cc6afab77d 100644 --- a/components/nfceditor/sample/build.gradle.kts +++ b/components/nfceditor/sample/build.gradle.kts @@ -1,18 +1,11 @@ plugins { id("flipper.android-app") - id("flipper.anvil") + id("flipper.anvil.kapt") id("kotlin-kapt") } android.namespace = "com.flipperdevices.nfceditor.sample" -android { - buildFeatures.compose = true - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } -} - android { defaultConfig { applicationId = "com.flipperdevices.nfceditor.sample" diff --git a/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/BrandsDecomposeComponent.kt b/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/BrandsDecomposeComponent.kt index 5e5eca3b60..2533e25f6d 100644 --- a/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/BrandsDecomposeComponent.kt +++ b/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/BrandsDecomposeComponent.kt @@ -3,6 +3,7 @@ package com.flipperdevices.remotecontrols.impl.brands.presentation.decompose import com.arkivanov.decompose.ComponentContext import com.flipperdevices.ifrmvp.backend.model.BrandModel import com.flipperdevices.remotecontrols.impl.brands.presentation.util.charSection +import com.flipperdevices.ui.decompose.DecomposeOnBackParameter import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.collections.immutable.toImmutableSet @@ -49,7 +50,7 @@ interface BrandsDecomposeComponent { fun createBrandsComponent( componentContext: ComponentContext, categoryId: Long, - onBackClicked: () -> Unit, + onBackClicked: DecomposeOnBackParameter, onBrandClicked: (brandId: Long) -> Unit ): BrandsDecomposeComponent } diff --git a/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/internal/BrandsDecomposeComponentImpl.kt b/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/internal/BrandsDecomposeComponentImpl.kt index 772121d08c..df98864dd5 100644 --- a/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/internal/BrandsDecomposeComponentImpl.kt +++ b/components/remote-controls/brands/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/brands/presentation/decompose/internal/BrandsDecomposeComponentImpl.kt @@ -8,6 +8,7 @@ import com.flipperdevices.ifrmvp.backend.model.BrandModel import com.flipperdevices.remotecontrols.impl.brands.presentation.decompose.BrandsDecomposeComponent import com.flipperdevices.remotecontrols.impl.brands.presentation.viewmodel.BrandsListViewModel import com.flipperdevices.remotecontrols.impl.brands.presentation.viewmodel.QueryViewModel +import com.flipperdevices.ui.decompose.DecomposeOnBackParameter import dagger.assisted.Assisted import dagger.assisted.AssistedInject import kotlinx.collections.immutable.toImmutableList @@ -23,7 +24,7 @@ import javax.inject.Provider @ContributesAssistedFactory(AppGraph::class, BrandsDecomposeComponent.Factory::class) class BrandsDecomposeComponentImpl @AssistedInject constructor( @Assisted componentContext: ComponentContext, - @Assisted private val onBackClicked: () -> Unit, + @Assisted private val onBackClicked: DecomposeOnBackParameter, @Assisted private val onBrandClicked: (brandId: Long) -> Unit, @Assisted categoryId: Long, createBrandsListViewModel: BrandsListViewModel.Factory, diff --git a/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/DeviceCategoriesComponent.kt b/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/DeviceCategoriesComponent.kt index b9e059bf80..b43ed8fedf 100644 --- a/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/DeviceCategoriesComponent.kt +++ b/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/DeviceCategoriesComponent.kt @@ -2,6 +2,7 @@ package com.flipperdevices.remotecontrols.impl.categories.presentation.decompose import com.arkivanov.decompose.ComponentContext import com.flipperdevices.ifrmvp.backend.model.DeviceCategory +import com.flipperdevices.ui.decompose.DecomposeOnBackParameter import kotlinx.collections.immutable.ImmutableList import kotlinx.coroutines.flow.StateFlow @@ -23,7 +24,7 @@ interface DeviceCategoriesComponent { fun interface Factory { fun invoke( componentContext: ComponentContext, - onBackClicked: () -> Unit, + onBackClicked: DecomposeOnBackParameter, onCategoryClicked: (categoryId: Long) -> Unit ): DeviceCategoriesComponent } diff --git a/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/internal/DeviceCategoriesComponentImpl.kt b/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/internal/DeviceCategoriesComponentImpl.kt index 3a5214649b..425c0fb00d 100644 --- a/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/internal/DeviceCategoriesComponentImpl.kt +++ b/components/remote-controls/categories/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/categories/presentation/decompose/internal/DeviceCategoriesComponentImpl.kt @@ -6,6 +6,7 @@ import com.flipperdevices.core.di.AppGraph import com.flipperdevices.ifrmvp.backend.model.DeviceCategory import com.flipperdevices.remotecontrols.impl.categories.presentation.decompose.DeviceCategoriesComponent import com.flipperdevices.remotecontrols.impl.categories.presentation.viewmodel.DeviceCategoryListViewModel +import com.flipperdevices.ui.decompose.DecomposeOnBackParameter import dagger.assisted.Assisted import dagger.assisted.AssistedInject import me.gulya.anvil.assisted.ContributesAssistedFactory @@ -14,7 +15,7 @@ import javax.inject.Provider @ContributesAssistedFactory(AppGraph::class, DeviceCategoriesComponent.Factory::class) class DeviceCategoriesComponentImpl @AssistedInject constructor( @Assisted componentContext: ComponentContext, - @Assisted private val onBackClicked: () -> Unit, + @Assisted private val onBackClicked: DecomposeOnBackParameter, @Assisted private val onCategoryClicked: (categoryId: Long) -> Unit, createDeviceCategoryListViewModel: Provider, ) : DeviceCategoriesComponent, @@ -26,7 +27,7 @@ class DeviceCategoriesComponentImpl @AssistedInject constructor( override val model = deviceCategoryListFeature.model override fun onCategoryClicked(category: DeviceCategory) { - onCategoryClicked.invoke(category.id) + onCategoryClicked(category.id) } override fun onBackClicked() = onBackClicked.invoke() diff --git a/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/SetupComponent.kt b/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/SetupComponent.kt index c0a1324eea..75cc2e1ad5 100644 --- a/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/SetupComponent.kt +++ b/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/SetupComponent.kt @@ -4,6 +4,7 @@ import com.arkivanov.decompose.ComponentContext import com.flipperdevices.ifrmvp.backend.model.IfrFileModel import com.flipperdevices.ifrmvp.backend.model.SignalResponseModel import com.flipperdevices.remotecontrols.api.SetupScreenDecomposeComponent +import com.flipperdevices.ui.decompose.DecomposeOnBackParameter import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow @@ -42,7 +43,7 @@ interface SetupComponent { fun createSetupComponent( componentContext: ComponentContext, param: SetupScreenDecomposeComponent.Param, - onBack: () -> Unit, + onBack: DecomposeOnBackParameter, onIfrFileFound: (ifrFileId: Long) -> Unit ): SetupComponent } diff --git a/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/internal/SetupComponentImpl.kt b/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/internal/SetupComponentImpl.kt index 140be094cc..ef751be6b9 100644 --- a/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/internal/SetupComponentImpl.kt +++ b/components/remote-controls/setup/impl/src/main/kotlin/com/flipperdevices/remotecontrols/impl/setup/presentation/decompose/internal/SetupComponentImpl.kt @@ -15,6 +15,7 @@ import com.flipperdevices.remotecontrols.impl.setup.presentation.decompose.Setup import com.flipperdevices.remotecontrols.impl.setup.presentation.decompose.internal.mapping.toFFFormat import com.flipperdevices.remotecontrols.impl.setup.presentation.viewmodel.CurrentSignalViewModel import com.flipperdevices.remotecontrols.impl.setup.presentation.viewmodel.HistoryViewModel +import com.flipperdevices.ui.decompose.DecomposeOnBackParameter import dagger.assisted.Assisted import dagger.assisted.AssistedInject import kotlinx.coroutines.CoroutineScope @@ -33,7 +34,7 @@ import javax.inject.Provider class SetupComponentImpl @AssistedInject constructor( @Assisted componentContext: ComponentContext, @Assisted override val param: SetupScreenDecomposeComponent.Param, - @Assisted private val onBackClicked: () -> Unit, + @Assisted private val onBackClicked: DecomposeOnBackParameter, @Assisted private val onIfrFileFound: (ifrFileId: Long) -> Unit, currentSignalViewModelFactory: CurrentSignalViewModel.Factory, createHistoryViewModel: Provider, diff --git a/gradle.properties b/gradle.properties index d7578dc140..919399c67f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,6 +7,8 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx4g -XX:+UseParallelGC -Dkotlin.daemon.jvm.options\="-Xmx4096M" +#org.gradle.debug=true +#kotlin.compiler.execution.strategy=in-process # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects @@ -20,14 +22,4 @@ android.enableJetifier=false # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official android.nonTransitiveRClass=true -org.gradle.parallel=true -org.gradle.unsafe.configuration-cache=false -org.gradle.unsafe.configuration-cache-problems=fail -org.gradle.caching=false -# Workaround for OOM in AGP 8.1.0 -org.gradle.daemon=false -# https://github.com/square/anvil/issues/693 -kotlin.incremental.useClasspathSnapshot=false -kotlin.incremental=false -# https://developer.android.com/build/releases/gradle-plugin -android.suppressUnsupportedCompileSdk=34 \ No newline at end of file +org.gradle.parallel=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f7d43c465f..c094b5412f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,18 +1,18 @@ [versions] # You also need to bump the version of ksp, anvil, compose -kotlin-general = "1.9.24" # https://kotlinlang.org/docs/releases.html#release-details +kotlin-general = "2.0.0" # https://kotlinlang.org/docs/releases.html#release-details kotlin-immutable-collections = "0.3.7" # https://github.com/Kotlin/kotlinx.collections.immutable/releases kotlin-datetime = "0.6.0" # https://github.com/Kotlin/kotlinx-datetime/releases kotlinx = "1.8.1" # https://github.com/Kotlin/kotlinx.coroutines/releases -ksp = "1.9.24-1.0.20" # https://github.com/google/ksp/releases -anvil = "2.4.9" # https://github.com/square/anvil/releases -anvil-utils = "0.1.0" # https://github.com/IlyaGulya/anvil-utils/releases -android-gradle = "8.5.0" # https://developer.android.com/studio/releases/gradle-plugin +ksp = "2.0.0-1.0.21" # https://github.com/google/ksp/releases +anvil = "2.5.0-beta09" # https://github.com/square/anvil/releases +anvil-utils = "0.2.1-beta01" # https://github.com/IlyaGulya/anvil-utils/releases +android-gradle = "8.5.1" # https://developer.android.com/studio/releases/gradle-plugin protobuf = "4.26.1" # https://github.com/protocolbuffers/protobuf/releases protobuf-gradle = "0.9.4" # https://github.com/google/protobuf-gradle-plugin/releases -compose-material = "1.6.7" # https://developer.android.com/jetpack/androidx/releases/compose#versions -compose-foundation = "1.6.7" # https://developer.android.com/jetpack/androidx/releases/compose#versions -compose-ui = "1.6.7" # https://developer.android.com/jetpack/androidx/releases/compose#versions +compose-material = "1.6.8" # https://developer.android.com/jetpack/androidx/releases/compose#versions +compose-foundation = "1.6.8" # https://developer.android.com/jetpack/androidx/releases/compose#versions +compose-ui = "1.6.8" # https://developer.android.com/jetpack/androidx/releases/compose#versions compose-wear = "1.3.1" # https://developer.android.com/jetpack/androidx/releases/wear-compose compose-wear-preview = "1.0.0" # https://mvnrepository.com/artifact/androidx.wear/wear-tooling-preview compose-compiler = "1.5.14" # https://developer.android.com/jetpack/androidx/releases/compose#versions @@ -23,9 +23,9 @@ compose-paging = "3.3.0" # https://developer.android.com/jetpack/androidx/releas compose-drag-drop = "0.9.6" # https://github.com/aclassen/ComposeReorderable/releases compose-multiplatform = "1.6.10" # https://github.com/JetBrains/compose-multiplatform/releases horologist = "0.6.11" # https://github.com/google/horologist/releases -serialization-json = "1.6.3" # https://github.com/Kotlin/kotlinx.serialization/releases +serialization-json = "1.7.0" # https://github.com/Kotlin/kotlinx.serialization/releases wear = "1.3.0" # https://developer.android.com/jetpack/androidx/releases/wear -wear-gms = "18.1.0" # https://mvnrepository.com/artifact/com.google.android.gms/play-services-wearable?repo=google +wear-gms = "18.2.0" # https://mvnrepository.com/artifact/com.google.android.gms/play-services-wearable?repo=google wear-interaction-phone = "1.1.0-alpha04" # https://developer.android.com/jetpack/androidx/releases/wear wear-interaction-remote = "1.0.0" # https://developer.android.com/jetpack/androidx/releases/wear room = "2.6.1" # https://developer.android.com/jetpack/androidx/releases/room @@ -37,8 +37,8 @@ sentry-gradle = "4.6.0" # https://github.com/getsentry/sentry-android-gradle-plu zip4j = "2.11.5" # https://github.com/srikanth-lingala/zip4j/releases ktx = "1.13.1" # https://developer.android.com/jetpack/androidx/releases/core ktx-activity = "1.9.0" # https://developer.android.com/jetpack/androidx/releases/activity -ktx-testing = "1.1.5" # https://developer.android.com/jetpack/androidx/releases/test -lifecycle = "2.8.0" # https://developer.android.com/jetpack/androidx/releases/lifecycle +ktx-testing = "1.2.1" # https://developer.android.com/jetpack/androidx/releases/test +lifecycle = "2.8.3" # https://developer.android.com/jetpack/androidx/releases/lifecycle fastutil = "8.5.13" # https://github.com/vigna/fastutil/tags ble = "2.7.5" # https://github.com/NordicSemiconductor/Android-BLE-Library/releases ble-scan = "1.6.0" # https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/releases @@ -50,13 +50,13 @@ lottie = "6.4.0" # https://github.com/airbnb/lottie/blob/master/android-compose. material = "1.12.0" # https://github.com/material-components/material-components-android/releases splashscreen = "1.1.0-rc01" # https://developer.android.com/jetpack/androidx/releases/core annotations = "1.8.0" # https://developer.android.com/jetpack/androidx/releases/annotation -appcompat = "1.6.1" # https://developer.android.com/jetpack/androidx/releases/appcompat +appcompat = "1.7.0" # https://developer.android.com/jetpack/androidx/releases/appcompat datastore = "1.1.1" # https://developer.android.com/topic/libraries/architecture/datastore # https://github.com/vsch/flexmark-java/issues/442 flexmark = "0.42.14" # https://github.com/vsch/flexmark-java/tags markdown = "0.16.0" # https://github.com/mikepenz/multiplatform-markdown-renderer/releases ktor = "2.3.11" # https://ktor.io/ -apache-compress = "1.26.1" # https://commons.apache.org/proper/commons-compress/ +apache-compress = "1.26.2" # https://commons.apache.org/proper/commons-compress/ apache-codec = "1.17.0" # https://mvnrepository.com/artifact/commons-codec/commons-codec countly = "24.4.0" # https://github.com/Countly/countly-sdk-android/releases grgit-gradle = "8d818b74b9" @@ -65,8 +65,8 @@ coil = "2.6.0" # https://github.com/coil-kt/coil/releases play-core = "2.1.0" # https://developer.android.com/guide/playcore#java-kotlin-in-app-update # don't upgrade to 1.14+ until Kotlin is upgraded to 2.0. https://github.com/Foso/Ktorfit/releases/tag/1.14.0 ktorfit = "1.13.0" # https://github.com/Foso/Ktorfit/releases -decompose = "3.0.0" # https://github.com/arkivanov/Decompose/releases -essenty = "2.0.0" # https://github.com/arkivanov/Essenty/releases +decompose = "3.1.0" # https://github.com/arkivanov/Decompose/releases +essenty = "2.1.0" # https://github.com/arkivanov/Essenty/releases zoomable = "1.6.1" #https://github.com/usuiat/Zoomable # Testing junit = "4.13.2" # https://github.com/junit-team/junit4/releases @@ -75,7 +75,7 @@ roboelectric = "4.12.2" # https://github.com/robolectric/robolectric/releases mockk = "1.13.11" # https://mockk.io/ # Testing UI -espresso-core = "3.5.1" # https://github.com/android/android-test +espresso-core = "3.6.1" # https://github.com/android/android-test uiautomator = "2.3.0" # https://developer.android.com/training/testing/other-components/ui-automator#set-ui benchmark-macro-junit4 = "1.2.4" # https://developer.android.com/jetpack/androidx/releases/benchmark baselineprofile = "1.2.4" # https://developer.android.com/topic/performance/baselineprofiles/overview#recommended-versions @@ -155,10 +155,10 @@ compose-swipetorefresh = { module = "com.google.accompanist:accompanist-swiperef compose-constraint = { module = "androidx.constraintlayout:constraintlayout-compose", version.ref = "compose-constraint" } compose-paging = { module = "androidx.paging:paging-compose", version.ref = "compose-paging" } compose-drag-drop = { module = "org.burnoutcrew.composereorderable:reorderable", version.ref = "compose-drag-drop" } -compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "compose-compiler" } # Need for renovate # UI - Compose multiplatform compose-multiplatform-gradle = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "compose-multiplatform" } +compose-gradle = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin-general" } # Coil @@ -297,4 +297,5 @@ protobuf = { id = "com.google.protobuf", version.ref = "protobuf-gradle" } square-anvil = { id = "com.squareup.anvil", version.ref = "anvil" } google-gms = { id = "com.google.gms.google-services", version.ref = "google-gms-gradle" } baselineprofile = { id = "androidx.baselineprofile", version.ref = "baselineprofile" } +compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin-general" } buildkonfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildkonfig" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c49..2c3521197d 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4f..dedd5d1e69 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.9-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1a53..f5feea6d6b 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -84,7 +86,8 @@ done # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -145,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +205,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/gradlew.bat b/gradlew.bat index 6689b85bee..9b42019c79 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,6 +13,8 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem @if "%DEBUG%"=="" @echo off @rem ########################################################################## @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail diff --git a/instances/android/app/build.gradle.kts b/instances/android/app/build.gradle.kts index 9dac9c5f04..e03623cb1d 100644 --- a/instances/android/app/build.gradle.kts +++ b/instances/android/app/build.gradle.kts @@ -6,7 +6,7 @@ import com.flipperdevices.buildlogic.SourceInstall plugins { id("flipper.android-app") - id("flipper.anvil") + id("flipper.anvil.kapt") id("kotlin-kapt") alias(libs.plugins.google.gms) alias(libs.plugins.baselineprofile) diff --git a/instances/wearable/build.gradle.kts b/instances/wearable/build.gradle.kts index 564afe1641..50b1b220ce 100644 --- a/instances/wearable/build.gradle.kts +++ b/instances/wearable/build.gradle.kts @@ -1,20 +1,10 @@ plugins { id("flipper.android-app") - id("flipper.anvil") + id("flipper.anvil.kapt") id("kotlin-kapt") } -android { - namespace = "com.flipperdevices.wearable" - - buildFeatures { - compose = true - } - - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() - } -} +android.namespace = "com.flipperdevices.wearable" dependencies { implementation(projects.components.core.di)