From 44be01d300c64d8bf9e5109f02a12d652e92a97c Mon Sep 17 00:00:00 2001 From: Mark Yavorskyi Date: Mon, 13 Nov 2023 12:41:04 +0100 Subject: [PATCH 1/7] Moved namespace from manifest to build.gradle --- drawbox/build.gradle.kts | 1 + drawbox/src/androidMain/AndroidManifest.xml | 2 +- sample/android/build.gradle.kts | 1 + sample/android/src/main/AndroidManifest.xml | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drawbox/build.gradle.kts b/drawbox/build.gradle.kts index b250b8d..ac17344 100644 --- a/drawbox/build.gradle.kts +++ b/drawbox/build.gradle.kts @@ -31,6 +31,7 @@ kotlin { } android { + namespace = "io.github.markyav.drawbox" compileSdk = Android.compileSdk sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") defaultConfig { diff --git a/drawbox/src/androidMain/AndroidManifest.xml b/drawbox/src/androidMain/AndroidManifest.xml index 993955f..de749ac 100644 --- a/drawbox/src/androidMain/AndroidManifest.xml +++ b/drawbox/src/androidMain/AndroidManifest.xml @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/sample/android/build.gradle.kts b/sample/android/build.gradle.kts index d28a254..482e982 100644 --- a/sample/android/build.gradle.kts +++ b/sample/android/build.gradle.kts @@ -20,6 +20,7 @@ dependencies { } android { + namespace = "io.github.markyav.drawbox.android" compileSdk = Android.compileSdk defaultConfig { applicationId = Android.applicationId diff --git a/sample/android/src/main/AndroidManifest.xml b/sample/android/src/main/AndroidManifest.xml index 500893a..a65de84 100644 --- a/sample/android/src/main/AndroidManifest.xml +++ b/sample/android/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ - + Date: Tue, 14 Nov 2023 15:37:49 +0100 Subject: [PATCH 2/7] Upgraded: - updated Compose Multiplatform to 1.5.10 - updated compile and target SDK to 34 - updated Kotlin to 1.9.20 --- buildSrc/src/main/kotlin/Android.kt | 4 ++-- drawbox/build.gradle.kts | 10 ++++++---- gradle.properties | 5 ++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/buildSrc/src/main/kotlin/Android.kt b/buildSrc/src/main/kotlin/Android.kt index 4f5df27..1049ed1 100644 --- a/buildSrc/src/main/kotlin/Android.kt +++ b/buildSrc/src/main/kotlin/Android.kt @@ -1,7 +1,7 @@ object Android { - val compileSdk = 33 + val compileSdk = 34 val minSdk = 24 - val targetSdk = 33 + val targetSdk = 34 val versionCode = Library.version .split(".") .map { it.toInt() } diff --git a/drawbox/build.gradle.kts b/drawbox/build.gradle.kts index ac17344..0397570 100644 --- a/drawbox/build.gradle.kts +++ b/drawbox/build.gradle.kts @@ -9,7 +9,12 @@ group = Library.group version = Library.version kotlin { - android { + androidTarget { + compilations.all { + kotlinOptions { + jvmTarget = "1.8" + } + } publishLibraryVariants("release") } jvm("desktop") { @@ -22,11 +27,8 @@ kotlin { api(compose.foundation) } } - val commonTest by getting val androidMain by getting - val androidTest by getting val desktopMain by getting - val desktopTest by getting } } diff --git a/gradle.properties b/gradle.properties index d3230e4..2b64aa9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,5 @@ kotlin.code.style=official -kotlin.native.enableDependencyPropagation=false android.useAndroidX=true -kotlin.version=1.8.0 +kotlin.version=1.9.20 agp.version=7.3.0 -compose.version=1.3.0 \ No newline at end of file +compose.version=1.5.10 \ No newline at end of file From 4ce2e33450bca8d3d99008762109e43a95663bd3 Mon Sep 17 00:00:00 2001 From: Mark Yavorskyi Date: Wed, 15 Nov 2023 14:29:40 +0100 Subject: [PATCH 3/7] Migrated to TOML and updated: - Gradle from 7.5.1 to 8.4 - AGP from 7.3.0 to 8.1.3 - androidx deps Cleaned up gradle files --- build.gradle.kts | 19 +++++----------- drawbox/build.gradle.kts | 12 +++------- gradle.properties | 6 ++--- gradle/libs.versions.toml | 27 ++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- sample/android/build.gradle.kts | 29 ++++++++++++------------ settings.gradle.kts | 12 +++++----- 7 files changed, 60 insertions(+), 47 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle.kts b/build.gradle.kts index fc2dbcf..a4a809b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,18 +1,11 @@ group = Library.group version = Library.version -allprojects { - repositories { - google() - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - } -} - plugins { - kotlin("multiplatform") apply false - kotlin("android") apply false - id("com.android.application") apply false - id("com.android.library") apply false - id("org.jetbrains.compose") apply false + //trick: for the same plugin versions in all sub-modules + alias(libs.plugins.androidApplication).apply(false) + alias(libs.plugins.androidLibrary).apply(false) + alias(libs.plugins.kotlinAndroid).apply(false) + alias(libs.plugins.kotlinMultiplatform).apply(false) + alias(libs.plugins.compose).apply(false) } \ No newline at end of file diff --git a/drawbox/build.gradle.kts b/drawbox/build.gradle.kts index 0397570..aa5b279 100644 --- a/drawbox/build.gradle.kts +++ b/drawbox/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - kotlin("multiplatform") - id("org.jetbrains.compose") - id("com.android.library") + alias(libs.plugins.kotlinMultiplatform) + alias(libs.plugins.compose) + alias(libs.plugins.androidLibrary) id("convention-publication") } @@ -35,13 +35,7 @@ kotlin { android { namespace = "io.github.markyav.drawbox" compileSdk = Android.compileSdk - sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") defaultConfig { minSdk = Android.minSdk - targetSdk = Android.targetSdk - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 2b64aa9..e5f553f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ kotlin.code.style=official android.useAndroidX=true -kotlin.version=1.9.20 -agp.version=7.3.0 -compose.version=1.5.10 \ No newline at end of file +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..e056292 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,27 @@ +[versions] + +android-targetSdk="34" +android-compileSdk="34" +android-minSdk="24" + +agp = "8.1.3" +kotlin = "1.9.20" +compose = "1.5.10" + +androidx-appcompat = "1.6.1" +androidx-activityCompose = "1.8.0" +androidx-coreKtx = "1.12.0" + +[libraries] + +androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } +androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } +androidx-coreKtx = { module = "androidx.core:core-ktx", version.ref = "androidx-coreKtx" } + +[plugins] + +compose = { id = "org.jetbrains.compose", version.ref = "compose" } +androidApplication = { id = "com.android.application", version.ref = "agp" } +androidLibrary = { id = "com.android.library", version.ref = "agp" } +kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..e411586 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/sample/android/build.gradle.kts b/sample/android/build.gradle.kts index 482e982..78a009f 100644 --- a/sample/android/build.gradle.kts +++ b/sample/android/build.gradle.kts @@ -1,24 +1,12 @@ plugins { - id("org.jetbrains.compose") - id("com.android.application") - kotlin("android") + alias(libs.plugins.compose) + alias(libs.plugins.androidApplication) + alias(libs.plugins.kotlinAndroid) } group = Library.group version = Library.version -repositories { - jcenter() -} - -dependencies { - implementation(project(":drawbox")) - implementation("androidx.activity:activity-compose:1.5.0") - implementation(compose.material) - implementation("androidx.appcompat:appcompat:1.5.1") - implementation("androidx.core:core-ktx:1.9.0") -} - android { namespace = "io.github.markyav.drawbox.android" compileSdk = Android.compileSdk @@ -38,4 +26,15 @@ android { isMinifyEnabled = false } } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + implementation(project(":drawbox")) + implementation(libs.androidx.activityCompose) + implementation(compose.material) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.coreKtx) } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 59d8bf1..c9e2470 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,13 +5,13 @@ pluginManagement { mavenCentral() maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } +} - plugins { - kotlin("multiplatform").version(extra["kotlin.version"] as String) - kotlin("android").version(extra["kotlin.version"] as String) - id("com.android.application").version(extra["agp.version"] as String) - id("com.android.library").version(extra["agp.version"] as String) - id("org.jetbrains.compose").version(extra["compose.version"] as String) +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } } From ecd50342580f02d80139e32a6296258ac88f95f5 Mon Sep 17 00:00:00 2001 From: Mark Yavorskyi Date: Wed, 15 Nov 2023 15:10:21 +0100 Subject: [PATCH 4/7] Fixed bug with target language version, cleaned gradle.properties --- drawbox/build.gradle.kts | 14 +++++++------- drawbox/src/androidMain/AndroidManifest.xml | 2 -- gradle.properties | 11 ++++++++++- 3 files changed, 17 insertions(+), 10 deletions(-) delete mode 100644 drawbox/src/androidMain/AndroidManifest.xml diff --git a/drawbox/build.gradle.kts b/drawbox/build.gradle.kts index aa5b279..f13ed2a 100644 --- a/drawbox/build.gradle.kts +++ b/drawbox/build.gradle.kts @@ -21,14 +21,10 @@ kotlin { jvmToolchain(11) } sourceSets { - val commonMain by getting { - dependencies { - api(compose.runtime) - api(compose.foundation) - } + commonMain.dependencies { + api(compose.runtime) + api(compose.foundation) } - val androidMain by getting - val desktopMain by getting } } @@ -38,4 +34,8 @@ android { defaultConfig { minSdk = Android.minSdk } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } } \ No newline at end of file diff --git a/drawbox/src/androidMain/AndroidManifest.xml b/drawbox/src/androidMain/AndroidManifest.xml deleted file mode 100644 index de749ac..0000000 --- a/drawbox/src/androidMain/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e5f553f..96a3d69 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,14 @@ +#Gradle +org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.caching=true +org.gradle.configuration-cache=true + +#Kotlin kotlin.code.style=official +kotlin.mpp.androidSourceSetLayoutVersion=2 + +#Android android.useAndroidX=true +android.nonTransitiveRClass=true android.defaults.buildfeatures.buildconfig=true -android.nonTransitiveRClass=false android.nonFinalResIds=false \ No newline at end of file From 7e999f8b11ea4c9c93d10abd0dd3fe02d4508f8c Mon Sep 17 00:00:00 2001 From: Mark Yavorskyi Date: Wed, 15 Nov 2023 15:48:00 +0100 Subject: [PATCH 5/7] Moved values from Android class into TOML --- buildSrc/src/main/kotlin/Android.kt | 10 ---------- drawbox/build.gradle.kts | 4 ++-- sample/android/build.gradle.kts | 12 ++++++------ 3 files changed, 8 insertions(+), 18 deletions(-) delete mode 100644 buildSrc/src/main/kotlin/Android.kt diff --git a/buildSrc/src/main/kotlin/Android.kt b/buildSrc/src/main/kotlin/Android.kt deleted file mode 100644 index 1049ed1..0000000 --- a/buildSrc/src/main/kotlin/Android.kt +++ /dev/null @@ -1,10 +0,0 @@ -object Android { - val compileSdk = 34 - val minSdk = 24 - val targetSdk = 34 - val versionCode = Library.version - .split(".") - .map { it.toInt() } - .reduce { acc, i -> acc * 10 + i } - val applicationId = Library.group + "android" -} \ No newline at end of file diff --git a/drawbox/build.gradle.kts b/drawbox/build.gradle.kts index f13ed2a..08eb909 100644 --- a/drawbox/build.gradle.kts +++ b/drawbox/build.gradle.kts @@ -30,9 +30,9 @@ kotlin { android { namespace = "io.github.markyav.drawbox" - compileSdk = Android.compileSdk + compileSdk = libs.versions.android.compileSdk.get().toInt() defaultConfig { - minSdk = Android.minSdk + minSdk = libs.versions.android.minSdk.get().toInt() } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 diff --git a/sample/android/build.gradle.kts b/sample/android/build.gradle.kts index 78a009f..809dadb 100644 --- a/sample/android/build.gradle.kts +++ b/sample/android/build.gradle.kts @@ -9,13 +9,13 @@ version = Library.version android { namespace = "io.github.markyav.drawbox.android" - compileSdk = Android.compileSdk + compileSdk = libs.versions.android.compileSdk.get().toInt() defaultConfig { - applicationId = Android.applicationId - minSdk = Android.minSdk - targetSdk = Android.targetSdk - versionCode = Android.versionCode - versionName = Library.version + applicationId = "io.github.markyav.sample" + minSdk = libs.versions.android.minSdk.get().toInt() + targetSdk = libs.versions.android.targetSdk.get().toInt() + versionCode = 1 + versionName = "1.0" } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 From 07aab5839933643de78660113c747d609761f5d5 Mon Sep 17 00:00:00 2001 From: Mark Yavorskyi Date: Fri, 17 Nov 2023 11:58:28 +0100 Subject: [PATCH 6/7] Upgraded AGP from 8.1.3 to 8.1.4 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e056292..8fa00a3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,7 +4,7 @@ android-targetSdk="34" android-compileSdk="34" android-minSdk="24" -agp = "8.1.3" +agp = "8.1.4" kotlin = "1.9.20" compose = "1.5.10" From 5f9e9b41493f06686df27e9185dca2b4be1a65e8 Mon Sep 17 00:00:00 2001 From: Mark Yavorskyi Date: Fri, 17 Nov 2023 12:00:03 +0100 Subject: [PATCH 7/7] Prepared for release 1.3.1 --- README.md | 2 +- buildSrc/src/main/kotlin/Library.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2fc500b..0506d79 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ DrawBox(drawController = controller, modifier = Modifier.fillMaxSize()) Using Gradle Kotlin DSL: ```kotlin -implementation("io.github.markyav.drawbox:drawbox:1.3.0") +implementation("io.github.markyav.drawbox:drawbox:1.3.1") ``` ## Examples diff --git a/buildSrc/src/main/kotlin/Library.kt b/buildSrc/src/main/kotlin/Library.kt index 7c6c285..c378c9e 100644 --- a/buildSrc/src/main/kotlin/Library.kt +++ b/buildSrc/src/main/kotlin/Library.kt @@ -5,7 +5,7 @@ object Library { val group = "io.github.markyav.drawbox" val artifact = "drawbox" - val version = "1.3.0" + val version = "1.3.1" object License { val name = "Apache-2.0"