Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Migrate build to version catalogs #26

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
kotlin("multiplatform")
id("com.android.application")
id("org.jetbrains.compose")
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.android.application)
alias(libs.plugins.compose.multiplatform)
}

kotlin {
Expand All @@ -16,15 +16,15 @@ kotlin {
}

android {
compileSdk = (findProperty("android.compileSdk") as String).toInt()
compileSdk = libs.versions.android.compileSdk.get().toInt()
namespace = "com.myapplication"

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")

defaultConfig {
applicationId = "com.myapplication.MyApplication"
minSdk = (findProperty("android.minSdk") as String).toInt()
targetSdk = (findProperty("android.targetSdk") as String).toInt()
minSdk = libs.versions.android.minSdk.get().toInt()
targetSdk = libs.versions.android.targetSdk.get().toInt()
versionCode = 1
versionName = "1.0"
}
Expand Down
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
// this is necessary to avoid the plugins to be loaded multiple times
// in each subproject's classloader
kotlin("multiplatform").apply(false)
id("com.android.application").apply(false)
id("com.android.library").apply(false)
id("org.jetbrains.compose").apply(false)
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.compose.multiplatform) apply false
}
6 changes: 3 additions & 3 deletions desktopApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
kotlin("multiplatform")
id("org.jetbrains.compose")
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.compose.multiplatform)
}

kotlin {
jvm()
sourceSets {
val jvmMain by getting {
val jvmMain by getting {
dependencies {
implementation(compose.desktop.currentOs)
implementation(project(":shared"))
Expand Down
8 changes: 0 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ org.jetbrains.compose.experimental.uikit.enabled=true

#Android
android.useAndroidX=true
android.compileSdk=34
android.targetSdk=34
android.minSdk=24

#Versions
kotlin.version=1.9.10
agp.version=8.0.2
compose.version=1.5.2
23 changes: 23 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[versions]
kotlin = "1.9.10"
android-gradle-plugin = "8.0.2"
compose = "1.5.2"

androidx-activity-compose = "1.7.2"
androidx-appcompat-appcompat = "1.6.1"
androidx-core-ktx = "1.12.0"

android-compileSdk = "34"
android-targetSdk = "34"
android-minSdk = "24"

[libraries]
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity-compose" }
androidx-appcompat-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat-appcompat" }
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "androidx-core-ktx" }

[plugins]
android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" }
android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
compose-multiplatform = { id = "org.jetbrains.compose", version.ref = "compose" }
15 changes: 0 additions & 15 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ pluginManagement {
google()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

plugins {
val kotlinVersion = extra["kotlin.version"] as String
val agpVersion = extra["agp.version"] as String
val composeVersion = extra["compose.version"] as String

kotlin("jvm").version(kotlinVersion)
kotlin("multiplatform").version(kotlinVersion)
kotlin("android").version(kotlinVersion)

id("com.android.application").version(agpVersion)
id("com.android.library").version(agpVersion)

id("org.jetbrains.compose").version(composeVersion)
}
}

plugins {
Expand Down
16 changes: 8 additions & 8 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
kotlin("multiplatform")
id("com.android.library")
id("org.jetbrains.compose")
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.android.library)
alias(libs.plugins.compose.multiplatform)
}

kotlin {
Expand Down Expand Up @@ -32,9 +32,9 @@ kotlin {
}
val androidMain by getting {
dependencies {
api("androidx.activity:activity-compose:1.7.2")
api("androidx.appcompat:appcompat:1.6.1")
api("androidx.core:core-ktx:1.10.1")
api(libs.androidx.activity.compose)
api(libs.androidx.appcompat.appcompat)
api(libs.androidx.core.ktx)
}
}
val iosX64Main by getting
Expand All @@ -55,15 +55,15 @@ kotlin {
}

android {
compileSdk = (findProperty("android.compileSdk") as String).toInt()
compileSdk = libs.versions.android.compileSdk.get().toInt()
namespace = "com.myapplication.common"

sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
sourceSets["main"].res.srcDirs("src/androidMain/res")
sourceSets["main"].resources.srcDirs("src/commonMain/resources")

defaultConfig {
minSdk = (findProperty("android.minSdk") as String).toInt()
minSdk = libs.versions.android.minSdk.get().toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
Expand Down