From a274a9c7b5297632dab107b33c295f5e367f8b94 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 10:03:23 +0000 Subject: [PATCH] Update Freeletics Gradle Plugin to v0.7.0 (#578) * Update Freeletics Gradle Plugin to v0.7.0 * update build config --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Gabriel Ittner --- build.gradle.kts | 1 + compose/compose.gradle.kts | 13 +++--- .../compose/ComposeFlowReduxStateMachine.kt | 3 +- flowredux/flowredux.gradle.kts | 2 - gradle/libs.versions.toml | 41 ++++++++++--------- sample/android/sample-android.gradle.kts | 38 +---------------- .../shared_code/sample-shared_code.gradle.kts | 2 +- settings.gradle.kts | 8 +--- 8 files changed, 32 insertions(+), 76 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7bb85958..0b345acd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.kotlin.multiplatform).apply(false) alias(libs.plugins.android.app).apply(false) alias(libs.plugins.android.library).apply(false) + alias(libs.plugins.jetbrains.compose).apply(false) alias(libs.plugins.dependency.analysis).apply(false) alias(libs.plugins.dokka).apply(false) alias(libs.plugins.publish).apply(false) diff --git a/compose/compose.gradle.kts b/compose/compose.gradle.kts index 741f51b9..f2c70339 100644 --- a/compose/compose.gradle.kts +++ b/compose/compose.gradle.kts @@ -1,18 +1,15 @@ plugins { alias(libs.plugins.fgp.multiplatform) alias(libs.plugins.fgp.publish) - alias(libs.plugins.compose.multiplatform) } freeletics { - explicitApi() + useCompose() // TODO https://github.com/JetBrains/compose-multiplatform/issues/3344 - // addCommonTargets(androidNativeTargets = false) -} - -compose { - kotlinCompilerPlugin.set(libs.versions.compose.multiplatform.compiler) + // multiplatform { + // addCommonTargets() + // } } kotlin { @@ -47,6 +44,6 @@ kotlin { dependencies { commonMainApi(projects.flowredux) - commonMainApi(libs.compose.multiplatform.runtime) + commonMainApi(libs.jetbrains.compose.runtime) commonMainImplementation(libs.coroutines.core) } diff --git a/compose/src/commonMain/kotlin/com/freeletics/flowredux/compose/ComposeFlowReduxStateMachine.kt b/compose/src/commonMain/kotlin/com/freeletics/flowredux/compose/ComposeFlowReduxStateMachine.kt index 434c1a56..ad2cb7cb 100644 --- a/compose/src/commonMain/kotlin/com/freeletics/flowredux/compose/ComposeFlowReduxStateMachine.kt +++ b/compose/src/commonMain/kotlin/com/freeletics/flowredux/compose/ComposeFlowReduxStateMachine.kt @@ -72,7 +72,8 @@ public fun FlowReduxStateMachine.rememberStateAndDispat val state = stateMachine.rememberState() val dispatchAction = remember(scope, stateMachine) { - { action: A -> + { + action: A -> scope.launch { stateMachine.dispatch(action) } diff --git a/flowredux/flowredux.gradle.kts b/flowredux/flowredux.gradle.kts index b4ffe4fe..41b3a34d 100644 --- a/flowredux/flowredux.gradle.kts +++ b/flowredux/flowredux.gradle.kts @@ -4,8 +4,6 @@ plugins { } freeletics { - explicitApi() - multiplatform { addCommonTargets() } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a02132b4..df5c66a8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,6 @@ [versions] kotlin = "1.9.10" coroutines = "1.7.3" -compose-multiplatform = "1.5.2" -compose-multiplatform-compiler = "1.5.2" java-target = "1.8" java-toolchain = "19" @@ -11,15 +9,19 @@ android-gradle = "8.1.1" android-min = "21" android-target = "34" android-compile = "34" -androidx-activity = "1.7.2" -androidx-annotation = "1.7.0" -androidx-appcompat = "1.6.1" + androidx-compose-compiler = "1.5.3" androidx-compose-runtime = "1.5.2" androidx-compose-ui = "1.5.2" androidx-compose-foundation = "1.5.2" androidx-compose-material = "1.5.2" androidx-compose-material3 = "1.1.2" +jetbrains-compose = "1.5.2" +jetbrains-compose-compiler = "1.5.2" + +androidx-activity = "1.7.2" +androidx-annotation = "1.7.0" +androidx-appcompat = "1.6.1" androidx-constraintlayout = "2.1.4" androidx-core = "1.12.0" androidx-lifecycle = "2.6.2" @@ -34,9 +36,8 @@ mad = "0.15.0" turbine = "1.0.0" kotlinx-collections-immutable= "0.3.5" -jetbrains-compose-runtime = "1.5.2" -fgp = "0.6.1" +fgp = "0.7.0" publish = "0.25.3" dokka = "1.9.0" binarycompatibility = "0.13.2" @@ -46,22 +47,23 @@ dependency-analysis = "1.22.0" kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kotlin-test-annotations = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlin" } kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } -compose-multiplatform-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "compose-multiplatform" } -compose-multiplatform-compiler = { module = "org.jetbrains.compose.compiler:compiler", version.ref = "compose-multiplatform-compiler" } coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } -androidx-activity = { module = "androidx.activity:activity-ktx", version.ref = "androidx-activity" } -androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" } -androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } -androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "androidx-compose-compiler" } androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "androidx-compose-runtime" } androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "androidx-compose-ui" } androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "androidx-compose-foundation" } androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "androidx-compose-material" } androidx-compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "androidx-compose-material3" } +jetbrains-compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "jetbrains-compose" } +jetbrains-compose-compiler = { module = "org.jetbrains.compose.compiler:compiler", version.ref = "jetbrains-compose-compiler" } + +androidx-activity = { module = "androidx.activity:activity-ktx", version.ref = "androidx-activity" } +androidx-annotation = { module = "androidx.annotation:annotation", version.ref = "androidx-annotation" } +androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "androidx-constraintlayout" } androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } androidx-lifecycle = { module = "androidx.lifecycle:lifecycle-common", version.ref = "androidx-lifecycle" } @@ -78,14 +80,13 @@ mad-statemachine = { module = "com.freeletics.mad:state-machine", version.ref = turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" } -jetbrains-compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "jetbrains-compose-runtime" } [plugins] -fgp-android = { id = "com.freeletics.gradle.common.android", version.ref = "fgp" } -fgp-android-app = { id = "com.freeletics.gradle.common.android.app", version.ref = "fgp" } -fgp-jvm = { id = "com.freeletics.gradle.common.jvm", version.ref = "fgp" } -fgp-multiplatform = { id = "com.freeletics.gradle.common.multiplatform", version.ref = "fgp" } -fgp-publish = { id = "com.freeletics.gradle.common.publish.oss", version.ref = "fgp" } +fgp-android = { id = "com.freeletics.gradle.android", version.ref = "fgp" } +fgp-android-app = { id = "com.freeletics.gradle.android.app", version.ref = "fgp" } +fgp-jvm = { id = "com.freeletics.gradle.jvm", version.ref = "fgp" } +fgp-multiplatform = { id = "com.freeletics.gradle.multiplatform", version.ref = "fgp" } +fgp-publish = { id = "com.freeletics.gradle.publish.oss", version.ref = "fgp" } fgp-root = { id = "com.freeletics.gradle.root", version.ref = "fgp" } fgp-settings = { id = "com.freeletics.gradle.settings", version.ref = "fgp" } @@ -93,7 +94,7 @@ android-app = { id = "com.android.application", version.ref = "android-gradle" } android-library = { id = "com.android.library", version.ref = "android-gradle" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } -compose-multiplatform = { id = "org.jetbrains.compose", version.ref = "compose-multiplatform" } +jetbrains-compose = { id = "org.jetbrains.compose", version.ref = "jetbrains-compose" } publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } binarycompatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binarycompatibility" } diff --git a/sample/android/sample-android.gradle.kts b/sample/android/sample-android.gradle.kts index 15a03475..753b40f2 100644 --- a/sample/android/sample-android.gradle.kts +++ b/sample/android/sample-android.gradle.kts @@ -5,19 +5,13 @@ plugins { freeletics { optIn("kotlinx.coroutines.ExperimentalCoroutinesApi") + useCompose() android { - enableCompose() enableViewBinding() } } -android { - kotlinOptions { - freeCompilerArgs = freeCompilerArgs + buildComposeMetricsParameters() - } -} - dependencies { implementation(libs.androidx.core) implementation(libs.androidx.annotation) @@ -44,33 +38,3 @@ dependencies { implementation(projects.flowredux) implementation(projects.compose) } - -fun Project.buildComposeMetricsParameters(): List = buildList(4) { - val enableMetricsProvider = project.providers.gradleProperty("enableComposeCompilerMetrics") - val enableMetrics = enableMetricsProvider.orNull == "true" - if (enableMetrics) { - val metricsFolderAbsolutePath = project.layout.buildDirectory - .file("compose-metrics") - .map { it.asFile.absolutePath } - .get() - - add("-P") - add( - "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$metricsFolderAbsolutePath", - ) - } - - val enableReportsProvider = project.providers.gradleProperty("enableComposeCompilerReports") - val enableReports = enableReportsProvider.orNull == "true" - if (enableReports) { - val reportsFolderAbsolutePath = project.layout.buildDirectory - .file("compose-reports") - .map { it.asFile.absolutePath } - .get() - - add("-P") - add( - "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$reportsFolderAbsolutePath", - ) - } -} diff --git a/sample/shared_code/sample-shared_code.gradle.kts b/sample/shared_code/sample-shared_code.gradle.kts index cad78f91..8d840d1d 100644 --- a/sample/shared_code/sample-shared_code.gradle.kts +++ b/sample/shared_code/sample-shared_code.gradle.kts @@ -14,5 +14,5 @@ freeletics { dependencies { commonMainApi(projects.flowredux) commonMainApi(libs.kotlinx.collections.immutable) - commonMainCompileOnly(libs.jetbrains.compose.runtime) + commonMainApi(libs.jetbrains.compose.runtime) } diff --git a/settings.gradle.kts b/settings.gradle.kts index b9f9ff9f..37529d13 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -6,14 +6,8 @@ pluginManagement { } } -dependencyResolutionManagement { - repositories { - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } -} - plugins { - id("com.freeletics.gradle.settings").version("0.6.1") + id("com.freeletics.gradle.settings").version("0.7.0") } rootProject.name = "flowredux-library"