From 1f2cab64dcc77d198b6dc37ee9a1f05a816bdc8c Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Tue, 31 Oct 2023 15:04:23 +0100 Subject: [PATCH 1/5] [Oztechan/TraceFit#13] Reorganis TOML, gradle files and gradle properties --- build.gradle.kts | 15 +++++---- composeApp/build.gradle.kts | 39 +++++++++++------------- gradle.properties | 10 ++++-- gradle/libs.versions.toml | 22 +++++++------ gradle/wrapper/gradle-wrapper.properties | 4 +-- 5 files changed, 48 insertions(+), 42 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4f25d24..0c24120 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,16 +1,19 @@ plugins { - alias(libs.plugins.multiplatform).apply(false) - alias(libs.plugins.compose).apply(false) - alias(libs.plugins.android.application).apply(false) + libs.plugins.apply { + alias(kotlinMultiplatform).apply(false) + alias(compose).apply(false) + alias(androidApplication).apply(false) + } } +// todo CMP bug needs to be removed when fixed +// https://youtrack.jetbrains.com/issue/KT-41821/Kotlin-1.4.10-ios-target-java.lang.IllegalStateException-failed-to-resolve-Kotlin-library-org.jetbrains.kotlinx-atomicfu-common buildscript { dependencies { - // Use the same version in the error - classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.17.3") + classpath(libs.classpaths.atomicfu) } } allprojects { - apply(plugin = "kotlinx-atomicfu") + apply(plugin = rootProject.libs.plugins.atomicfu.get().pluginId) } diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 301043b..35e33cc 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -1,7 +1,9 @@ plugins { - alias(libs.plugins.multiplatform) - alias(libs.plugins.compose) - alias(libs.plugins.android.application) + libs.plugins.apply { + alias(kotlinMultiplatform) + alias(compose) + alias(androidApplication) + } } @OptIn(org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi::class) @@ -34,33 +36,26 @@ kotlin { } val commonMain by getting { dependencies { - implementation(compose.runtime) - implementation(compose.material3) - implementation(compose.materialIconsExtended) - @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) - implementation(compose.components.resources) + compose.apply { + implementation(runtime) + implementation(material3) + implementation(materialIconsExtended) + @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) + implementation(components.resources) + } } } - val commonTest by getting { - dependencies { - implementation(kotlin("test")) - } - } val androidMain by getting { dependencies { - implementation(libs.androidx.appcompat) - implementation(libs.androidx.activityCompose) - implementation(libs.compose.uitooling) + libs.android.apply { + implementation(composeActivity) + implementation(composeToolingPreview) + implementation(appcompat) + } } } - - val iosMain by getting { - dependencies { - } - } - } } diff --git a/gradle.properties b/gradle.properties index eda0360..992d50b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,10 +1,14 @@ - #Gradle -org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=2g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx8g" +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.daemon=true +org.gradle.configureondemand=true +org.gradle.kotlin.dsl.allWarningsAsErrors=true #Kotlin kotlin.code.style=official -kotlin.js.compiler=ir +kotlin.incremental=true #Compose org.jetbrains.compose.experimental.uikit.enabled=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 70fab52..dd886c2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,20 +1,24 @@ [versions] kotlin = "1.9.10" -agp = "8.1.2" +androidGradlePlugin = "8.1.2" compose = "1.5.1" -androidx-appcompat = "1.6.1" -androidx-activityCompose = "1.7.2" -compose-uitooling = "1.5.1" +composeActivity = "1.7.2" +appcompat = "1.6.1" +atomicfu = "0.17.3" [libraries] -androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } -androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } -compose-uitooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-uitooling" } +android-composeActivity = { module = "androidx.activity:activity-compose", version.ref = "composeActivity" } +android-composeToolingPreview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } +android-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } + +# Classpaths +classpaths-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } [plugins] -multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } compose = { id = "org.jetbrains.compose", version.ref = "compose" } -android-application = { id = "com.android.application", version.ref = "agp" } +androidApplication = { id = "com.android.application", version.ref = "androidGradlePlugin" } +atomicfu = { id = "kotlinx-atomicfu" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 428175a..309b4e1 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.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 1ce95e3037cbcb7f39c07cf65b8803f0e2d5be0f Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Wed, 1 Nov 2023 09:17:20 +0100 Subject: [PATCH 2/5] [Oztechan/TraceFit#9] Setup Kover --- .github/workflows/main.yml | 8 +++++++- build.gradle.kts | 7 +++++++ gradle/libs.versions.toml | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a118410..799b07d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,13 @@ jobs: - name: Run Quality Jobs uses: gradle/gradle-build-action@v2.9.0 with: - arguments: check + arguments: check koverMergedXmlReport --parallel + + - name: Upload Coverage Report + uses: actions/upload-artifact@v3.1.3 + with: + name: coverageReport + path: build/reports/kover/report.xml - name: Cancel other jobs if this fails if: failure() diff --git a/build.gradle.kts b/build.gradle.kts index 0c24120..7eb7770 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,7 @@ plugins { alias(kotlinMultiplatform).apply(false) alias(compose).apply(false) alias(androidApplication).apply(false) + alias(libs.plugins.kover) } } @@ -15,5 +16,11 @@ buildscript { } allprojects { + apply(plugin = rootProject.libs.plugins.kover.get().pluginId).also { + rootProject.dependencies.add("kover", project(path)) + } + + // todo CMP bug needs to be removed when fixed + // https://youtrack.jetbrains.com/issue/KT-41821/Kotlin-1.4.10-ios-target-java.lang.IllegalStateException-failed-to-resolve-Kotlin-library-org.jetbrains.kotlinx-atomicfu-common apply(plugin = rootProject.libs.plugins.atomicfu.get().pluginId) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dd886c2..6855a5e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,6 +6,7 @@ compose = "1.5.1" composeActivity = "1.7.2" appcompat = "1.6.1" atomicfu = "0.17.3" +kover = "0.7.4" [libraries] @@ -22,3 +23,4 @@ kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = compose = { id = "org.jetbrains.compose", version.ref = "compose" } androidApplication = { id = "com.android.application", version.ref = "androidGradlePlugin" } atomicfu = { id = "kotlinx-atomicfu" } +kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } From 833ea1d8f453b20ad096af9f4d81518878569624 Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Wed, 1 Nov 2023 09:21:58 +0100 Subject: [PATCH 3/5] [Oztechan/TraceFit#9] Setup Kover --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 799b07d..2debccd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,7 +66,7 @@ jobs: - name: Run Quality Jobs uses: gradle/gradle-build-action@v2.9.0 with: - arguments: check koverMergedXmlReport --parallel + arguments: check koverXmlReport --parallel - name: Upload Coverage Report uses: actions/upload-artifact@v3.1.3 From c17eeb6a6f73552b6f31634474ce6ec3cee49911 Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Wed, 1 Nov 2023 09:23:12 +0100 Subject: [PATCH 4/5] [Oztechan/TraceFit#9] Setup Kover --- .github/workflows/main.yml | 4 ++-- gradle/libs.versions.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2debccd..c21f566 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,13 +66,13 @@ jobs: - name: Run Quality Jobs uses: gradle/gradle-build-action@v2.9.0 with: - arguments: check koverXmlReport --parallel + arguments: check koverMergedXmlReport --parallel - name: Upload Coverage Report uses: actions/upload-artifact@v3.1.3 with: name: coverageReport - path: build/reports/kover/report.xml + path: build/reports/kover/merged/xml/report.xml - name: Cancel other jobs if this fails if: failure() diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6855a5e..1198ccb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ compose = "1.5.1" composeActivity = "1.7.2" appcompat = "1.6.1" atomicfu = "0.17.3" -kover = "0.7.4" +kover = "0.6.1" [libraries] From e107852ee259b0744aeb984024df4087c35a2ed4 Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Wed, 1 Nov 2023 09:29:58 +0100 Subject: [PATCH 5/5] [Oztechan/TraceFit#9] Setup Kover --- build.gradle.kts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7eb7770..747da32 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,7 +17,17 @@ buildscript { allprojects { apply(plugin = rootProject.libs.plugins.kover.get().pluginId).also { - rootProject.dependencies.add("kover", project(path)) + koverMerged { + filters { + annotations { + excludes += listOf( + "androidx.compose.ui.tooling.preview.Preview", + "androidx.compose.runtime.Composable" + ) + } + } + enable() + } } // todo CMP bug needs to be removed when fixed