Skip to content

Commit

Permalink
[#13] Reorganise TOML, gradle files and gradle properties (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan authored Nov 3, 2023
1 parent 8793691 commit 677a6c5
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 42 deletions.
15 changes: 9 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
}
39 changes: 17 additions & 22 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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 {
}
}

}
}

Expand Down
10 changes: 7 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
22 changes: 13 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 677a6c5

Please sign in to comment.