From a5ce6f78706a26824a1c3a0675174d4d4aa89fd8 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 29 Apr 2021 02:04:02 +0600 Subject: [PATCH 1/3] Update gradle.properties --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index efb729c..899b6c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,8 +6,8 @@ kotlin.incremental.js=true android.useAndroidX=true android.enableJetifier=true -kotlin_version=1.4.32 -kotlin_serialisation_core_version=1.1.0 +kotlin_version=1.5.0 +kotlin_serialisation_core_version=1.2.0 # github_release_plugin_version=2.2.12 From dfede7b300678426316d37bbc5aa78bfeefb2d39 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 29 Apr 2021 20:51:38 +0600 Subject: [PATCH 2/3] Update defaultAndroidSettings.gradle --- defaultAndroidSettings.gradle | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/defaultAndroidSettings.gradle b/defaultAndroidSettings.gradle index 65b9e07..1b1a4f0 100644 --- a/defaultAndroidSettings.gradle +++ b/defaultAndroidSettings.gradle @@ -1,6 +1,31 @@ apply plugin: 'com.getkeepsafe.dexcount' android { + ext { + jvmKotlinFolderFile = { + String sep = File.separator + return new File("${project.projectDir}${sep}src${sep}jvmMain${sep}kotlin") + } + + enableIncludingJvmCodeInAndroidPart = { + File jvmKotlinFolder = jvmKotlinFolderFile() + if (jvmKotlinFolder.exists()) { + android.sourceSets.main.java.srcDirs += jvmKotlinFolder.path + } + } + + disableIncludingJvmCodeInAndroidPart = { + File jvmKotlinFolder = jvmKotlinFolderFile() + String[] oldDirs = android.sourceSets.main.java.srcDirs + android.sourceSets.main.java.srcDirs = [] + for (oldDir in oldDirs) { + if (oldDir != jvmKotlinFolder.path) { + android.sourceSets.main.java.srcDirs += oldDir + } + } + } + } + compileSdkVersion "$android_compileSdkVersion".toInteger() buildToolsVersion "$android_buildToolsVersion" From 01fa370e888b354dd7a5d890b1567a0dc5d31bb2 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 29 Apr 2021 20:55:36 +0600 Subject: [PATCH 3/3] Update README.md --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 7b39e2c..f3bb736 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ sdk.dir=/your/path/to/android/sdk In this template there is only one subproject with name `lib`. You are always able to rename it, but remember that in this case you must rename it in `settings.gradle` file. +## JVM sources in Android target + +By default JVM code is not included in Android target. In case you wish to include JVM sources in Android build, use +next method in the end of your `build.gradle`: + +```groovy +enableIncludingJvmCodeInAndroidPart() +``` + +In case when you need to be sure that JVM sources are not included in Android part, use this snippet: + +```groovy +disableIncludingJvmCodeInAndroidPart() +``` + ## Types of projects ### `mppProjectWithSerialization`