From 5494671ee1cfac5ebb1a176cbdd415a90a0649da Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 29 Jan 2022 21:47:34 +0600 Subject: [PATCH] updates and migration onto toml --- .gitignore | 4 +++- build.gradle | 10 ++++---- defaultAndroidSettings.gradle | 8 +++---- gradle.properties | 19 --------------- gradle/libs.versions.toml | 38 ++++++++++++++++++++++++++++++ mppAndroidProject.gradle | 14 ++++++++--- mppJavaProject.gradle | 10 ++++---- mppJsProject.gradle | 11 +++++---- mppProjectWithSerialization.gradle | 20 ++++++++-------- settings.gradle | 2 ++ 10 files changed, 84 insertions(+), 52 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/.gitignore b/.gitignore index 8a04b36..7e5545b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ build/ out/ secret.gradle -local.properties +local.* +local/ +kotlin-js-store/ publishing.sh diff --git a/build.gradle b/build.gradle index c334c73..36c0e25 100644 --- a/build.gradle +++ b/build.gradle @@ -7,11 +7,11 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.2.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" - classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:$dexcount_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" + classpath libs.android.tools.build + classpath libs.android.dexcount + classpath libs.kotlin.gradle.plugin + classpath libs.kotlin.serialization.plugin + classpath libs.kotlin.dokka.plugin } } diff --git a/defaultAndroidSettings.gradle b/defaultAndroidSettings.gradle index 1b1a4f0..1902595 100644 --- a/defaultAndroidSettings.gradle +++ b/defaultAndroidSettings.gradle @@ -26,12 +26,12 @@ android { } } - compileSdkVersion "$android_compileSdkVersion".toInteger() - buildToolsVersion "$android_buildToolsVersion" + compileSdkVersion libs.versions.android.compileSdk.get().toInteger() + buildToolsVersion libs.versions.android.buildTools.get() defaultConfig { - minSdkVersion "$android_minSdkVersion".toInteger() - targetSdkVersion "$android_compileSdkVersion".toInteger() + minSdkVersion libs.versions.android.minSdk.get().toInteger() + targetSdkVersion libs.versions.android.compileSdk.get().toInteger() versionCode "${android_code_version}".toInteger() versionName "$version" } diff --git a/gradle.properties b/gradle.properties index 4604e42..1759e8f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,25 +6,6 @@ kotlin.incremental.js=true android.useAndroidX=true android.enableJetifier=true -kotlin_version=1.6.10 -kotlin_serialisation_core_version=1.3.2 - -# github_release_plugin_version=2.2.12 - -# ANDROID - -android_minSdkVersion=21 -android_compileSdkVersion=32 -android_buildToolsVersion=32.0.0 -dexcount_version=3.0.1 -junit_version=4.12 -test_ext_junit_version=1.1.2 -espresso_core=3.3.0 - -# Dokka - -dokka_version=1.6.10 - # Project data group=project_group diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..386f167 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,38 @@ +[versions] + +kotlin = "1.6.10" +kotlin-serialization = "1.3.2" +kotlin-gradle-plugin = "7.0.2" + +dexcount = "3.0.1" +junit_version = "4.12" +test_ext_junit_version = "1.1.2" +espresso_core = "3.3.0" + +android-minSdk = "21" +android-compileSdk = "32" +android-buildTools = "32.0.0" + +[libraries] + +kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" } +kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization" } +kotlin-test-common = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlin" } +kotlin-test-annotations-common = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlin" } +kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } +kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" } +android-test-junit = { module = "androidx.test.ext:junit", version.ref = "test_ext_junit_version" } +android-test-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espresso_core" } + +# buildscript classpaths + +android-tools-build = { module = "com.android.tools.build:gradle", version.ref = "kotlin-gradle-plugin" } +android-dexcount = { module = "com.getkeepsafe.dexcount:dexcount-gradle-plugin", version.ref = "dexcount" } +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kotlin-serialization-plugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" } +kotlin-dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "kotlin" } + +[plugins] + +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } diff --git a/mppAndroidProject.gradle b/mppAndroidProject.gradle index af688ee..ad4e0d9 100644 --- a/mppAndroidProject.gradle +++ b/mppAndroidProject.gradle @@ -11,13 +11,21 @@ kotlin { sourceSets { commonMain { dependencies { - implementation kotlin('stdlib') + implementation libs.kotlin + api libs.kotlin.serialization } } commonTest { dependencies { - implementation kotlin('test-common') - implementation kotlin('test-annotations-common') + implementation libs.kotlin.test.common + implementation libs.kotlin.test.annotations.common + } + } + androidTest { + dependencies { + implementation libs.kotlin.test.junit + implementation libs.android.test.junit + implementation libs.android.test.espresso.core } } } diff --git a/mppJavaProject.gradle b/mppJavaProject.gradle index 231bdfc..22a767c 100644 --- a/mppJavaProject.gradle +++ b/mppJavaProject.gradle @@ -9,19 +9,19 @@ kotlin { sourceSets { commonMain { dependencies { - implementation kotlin('stdlib') + implementation libs.kotlin + api libs.kotlin.serialization } } commonTest { dependencies { - implementation kotlin('test-common') - implementation kotlin('test-annotations-common') + implementation libs.kotlin.test.common + implementation libs.kotlin.test.annotations.common } } - jvmTest { dependencies { - implementation kotlin('test-junit') + implementation libs.kotlin.test.junit } } } diff --git a/mppJsProject.gradle b/mppJsProject.gradle index ec05237..9f27e75 100644 --- a/mppJsProject.gradle +++ b/mppJsProject.gradle @@ -12,19 +12,20 @@ kotlin { sourceSets { commonMain { dependencies { - implementation kotlin('stdlib') + implementation libs.kotlin + api libs.kotlin.serialization } } commonTest { dependencies { - implementation kotlin('test-common') - implementation kotlin('test-annotations-common') + implementation libs.kotlin.test.common + implementation libs.kotlin.test.annotations.common } } jsTest { dependencies { - implementation kotlin('test-js') - implementation kotlin('test-junit') + implementation libs.kotlin.test.js + implementation libs.kotlin.test.junit } } } diff --git a/mppProjectWithSerialization.gradle b/mppProjectWithSerialization.gradle index 12c521b..a60b395 100644 --- a/mppProjectWithSerialization.gradle +++ b/mppProjectWithSerialization.gradle @@ -16,32 +16,32 @@ kotlin { sourceSets { commonMain { dependencies { - implementation kotlin('stdlib') - api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_core_version" + implementation libs.kotlin + api libs.kotlin.serialization } } commonTest { dependencies { - implementation kotlin('test-common') - implementation kotlin('test-annotations-common') + implementation libs.kotlin.test.common + implementation libs.kotlin.test.annotations.common } } jvmTest { dependencies { - implementation kotlin('test-junit') + implementation libs.kotlin.test.junit } } jsTest { dependencies { - implementation kotlin('test-js') - implementation kotlin('test-junit') + implementation libs.kotlin.test.js + implementation libs.kotlin.test.junit } } androidTest { dependencies { - implementation kotlin('test-junit') - implementation "androidx.test.ext:junit:$test_ext_junit_version" - implementation "androidx.test.espresso:espresso-core:$espresso_core" + implementation libs.kotlin.test.junit + implementation libs.android.test.junit + implementation libs.android.test.espresso.core } } } diff --git a/settings.gradle b/settings.gradle index 7bb91d0..298254f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,3 +14,5 @@ includes.each { originalName -> project.name = projectName project.projectDir = new File(projectDirectory) } + +enableFeaturePreview("VERSION_CATALOGS")