Skip to content

Update dependencies & Clean up deprecated stuff in build scripts #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
4 changes: 2 additions & 2 deletions bonsai-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
id("com.vanniktech.maven.publish")
}

kotlinMultiplatform()
kotlinMultiplatform("cafe.adriel.bonsai.core")

kotlin {
sourceSets {
val commonMain by getting {
commonMain {
dependencies {
compileOnly(compose.runtime)
compileOnly(compose.foundation)
Expand Down
4 changes: 2 additions & 2 deletions bonsai-file-system/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ plugins {
id("com.vanniktech.maven.publish")
}

kotlinMultiplatform()
kotlinMultiplatform("cafe.adriel.bonsai.filesystem")

kotlin {
sourceSets {
val commonMain by getting {
commonMain {
dependencies {
api(projects.bonsaiCore)
api(libs.okio)
Expand Down
4 changes: 2 additions & 2 deletions bonsai-json/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ plugins {
id("com.vanniktech.maven.publish")
}

kotlinMultiplatform()
kotlinMultiplatform("cafe.adriel.bonsai.json")

kotlin {
sourceSets {
val commonMain by getting {
commonMain {
dependencies {
api(projects.bonsaiCore)
api(libs.serialization)
Expand Down
6 changes: 3 additions & 3 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
enableFeaturePreview("VERSION_CATALOGS")

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
}

rootProject.name = "buildSrc"
43 changes: 15 additions & 28 deletions buildSrc/src/main/kotlin/Setup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.android.build.gradle.LibraryExtension
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

private fun BaseExtension.android() {
private fun BaseExtension.android(namespace: String) {
this.namespace = namespace
compileSdkVersion(34)
defaultConfig {
minSdk = 21
Expand All @@ -17,50 +19,35 @@ private fun BaseExtension.android() {
}
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
fun Project.kotlinMultiplatform(
namespace: String,
explicitMode: Boolean = true
) {
extensions.configure<KotlinMultiplatformExtension> {
android {
androidTarget {
publishAllLibraryVariants()
}
jvm("desktop")

sourceSets {
/* Source sets structure
/* Source sets structure
common
├─ jvm
├─ android
├─ desktop
*/
val commonMain by getting
val commonTest by getting

val jvmMain by creating {
dependsOn(commonMain)
}
val jvmTest by creating {
dependsOn(commonTest)
}

val androidMain by getting {
dependsOn(jvmMain)
}
val androidTest by getting {
dependsOn(jvmTest)
}

val desktopMain by getting {
dependsOn(jvmMain)
}
val desktopTest by getting {
dependsOn(jvmTest)
*/
applyHierarchyTemplate {
common {
group("jvm") {
withAndroidTarget()
withJvm()
}
}
}
}

extensions.configure<LibraryExtension> {
android()
android(namespace)
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.mpp.androidGradlePluginCompatibility.nowarn=true

# Maven
GROUP=cafe.adriel.bonsai
Expand Down
25 changes: 13 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
[versions]
plugin-android = "7.1.3"
plugin-ktlint = "10.2.1"
plugin-detekt = "1.20.0-RC1"
plugin-android = "8.3.1"
plugin-ktlint = "12.1.0"
plugin-detekt = "1.23.6"
plugin-maven = "0.18.0"

kotlin = "1.8.22"
okio = "3.0.0"
serialization = "1.5.1"
kotlin = "1.9.23"
okio = "3.9.0"
serialization = "1.6.3"

compose = "1.4.8"
composeMultiplatform = "1.4.3"
composeActivity = "1.7.2"
composeVoyager = "1.0.0-beta16"
material = "1.4.3"
compose = "1.5.11"
composeRuntime = "1.6.5"
composeMultiplatform = "1.6.1"
composeActivity = "1.8.2"
composeVoyager = "1.0.0"
material = "1.6.5"

[libraries]
plugin-android = { module = "com.android.tools.build:gradle", version.ref = "plugin-android" }
Expand All @@ -26,7 +27,7 @@ plugin-compose-multiplatform = { module = "org.jetbrains.compose:compose-gradle-
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "serialization" }

compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" }
compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "composeRuntime" }
compose-material = { module = "androidx.compose.material:material", version.ref = "material" }
compose-material-icons = { module = "androidx.compose.material:material-icons-extended", version.ref = "material" }
compose-activity = { module = "androidx.activity:activity-compose", version.ref = "composeActivity" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 1 addition & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
apply from: "../android-module.gradle"

android {
namespace = "cafe.adriel.bonsai.sample"
defaultConfig {
applicationId "cafe.adriel.bonsai.sample"
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ dependencyResolutionManagement {
}
}

rootProject.name = "bonsai"
include(
":sample",
":bonsai-core",
":bonsai-file-system",
":bonsai-json",
)

enableFeaturePreview("VERSION_CATALOGS")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")