From 9c8943f735e9800be3258163d75b1222726b640f Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Sun, 5 Nov 2023 19:35:20 +0100 Subject: [PATCH] [Oztechan/TraceFit#31] Re-organise TOML and gradle files (#32) * [Oztechan/TraceFit#29] Create buildScr module for ProjectSettings * [Oztechan/TraceFit#31] Re-organise TOML and gradle files --- composeApp/build.gradle.kts | 20 +++++++++++-------- gradle/libs.versions.toml | 40 +++++++++++++++---------------------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 519e82f..ab6906c 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -2,9 +2,11 @@ import org.jetbrains.compose.ExperimentalComposeLibrary import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi plugins { - alias(libs.plugins.kotlinMultiplatform) - alias(libs.plugins.androidApplication) - alias(libs.plugins.jetbrainsCompose) + libs.plugins.apply { + alias(kotlinMultiplatform) + alias(androidApplication) + alias(jetbrainsCompose) + } } kotlin { @@ -33,9 +35,11 @@ kotlin { sourceSets { val androidMain by getting { dependencies { - implementation(libs.compose.ui) - implementation(libs.compose.ui.tooling.preview) - implementation(libs.androidx.activity.compose) + libs.android.apply { + implementation(composeUi) + implementation(composeUiToolingPreview) + implementation(activityCompose) + } } } val commonMain by getting { @@ -76,7 +80,7 @@ android { compose = true } composeOptions { - kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() + kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() } packaging { resources { @@ -90,7 +94,7 @@ android { } dependencies { - debugImplementation(libs.compose.ui.tooling) + debugImplementation(libs.android.composeUiTooling) } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f614407..81d88a9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,38 +1,30 @@ [versions] -compose = "1.5.4" -compose-plugin = "1.5.3" -compose-compiler = "1.5.3" -agp = "8.1.2" -androidx-activityCompose = "1.8.0" -androidx-core-ktx = "1.12.0" -androidx-appcompat = "1.6.1" -androidx-material = "1.10.0" -androidx-constraintlayout = "2.1.4" -androidx-espresso-core = "3.5.1" kotlin = "1.9.10" atomicfu = "0.17.3" kover = "0.6.1" +compose = "1.5.4" +jetbrainsCompose = "1.5.3" +composeCompiler = "1.5.3" +androidGradlePlugin = "8.1.2" +androidx-activityCompose = "1.8.0" [libraries] +# COMMON kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } -compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } -compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } -compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } -compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } -compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } -androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" } -androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "androidx-espresso-core" } -androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" } -androidx-material = { group = "com.google.android.material", name = "material", version.ref = "androidx-material" } -androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "androidx-constraintlayout" } -androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } +common-ComposeCompiler = { module = "androidx.compose.compiler:compiler", version.ref = "composeCompiler" } # Workaround for compose compiler update + +# ANDROID +android-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } +android-composeUi = { module = "androidx.compose.ui:ui", version.ref = "compose" } +android-composeUiTooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } +android-composeUiToolingPreview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } -# Classpaths +# CLASSPATHS classpaths-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } [plugins] -jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" } -androidApplication = { id = "com.android.application", version.ref = "agp" } +jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "jetbrainsCompose" } +androidApplication = { id = "com.android.application", version.ref = "androidGradlePlugin" } kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } atomicfu = { id = "kotlinx-atomicfu" } kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }