diff --git a/README.md b/README.md index f3bb736..b7734bf 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,21 @@ 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`: +next method in the `sourceSets` section of your `build.gradle`: ```groovy -enableIncludingJvmCodeInAndroidPart() +kotlin { + sourceSets { + // Some other code + androidMain { + // Some other code (like dependencies) + dependsOn jvmMain + } + } +} ``` -In case when you need to be sure that JVM sources are not included in Android part, use this snippet: - -```groovy -disableIncludingJvmCodeInAndroidPart() -``` +In case when you need to be sure that JVM sources are not included in Android part, just remove line with `dependsOn jvmMain` ## Types of projects diff --git a/defaultAndroidSettings.gradle b/defaultAndroidSettings.gradle index 1902595..62b320f 100644 --- a/defaultAndroidSettings.gradle +++ b/defaultAndroidSettings.gradle @@ -1,31 +1,6 @@ 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 libs.versions.android.compileSdk.get().toInteger() buildToolsVersion libs.versions.android.buildTools.get()