From 2f9aa585f1f32215faa252166dadf60566ece923 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Wed, 21 Apr 2021 01:52:17 +0600 Subject: [PATCH] fix for repos in building --- defaultAndroidSettings.gradle | 21 +++++++++++++++++---- repos/common/build.gradle | 4 +++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/defaultAndroidSettings.gradle b/defaultAndroidSettings.gradle index 36e4815f02a..0153cd8dc0b 100644 --- a/defaultAndroidSettings.gradle +++ b/defaultAndroidSettings.gradle @@ -1,5 +1,21 @@ apply plugin: 'com.getkeepsafe.dexcount' +ext { + enableIncludingJvmCodeInAndroidPart = { + String sep = File.separator + File jvmKotlinFolder = new File("${project.projectDir}${sep}src${sep}jvmMain${sep}kotlin") + if (jvmKotlinFolder.exists()) { + android.sourceSets.main.java.srcDirs += jvmKotlinFolder.path + } + } + + disableIncludingJvmCodeInAndroidPart = { + String sep = File.separator + File jvmKotlinFolder = new File("${project.projectDir}${sep}src${sep}jvmMain${sep}kotlin") + android.sourceSets.main.java.srcDirs -= jvmKotlinFolder.path + } +} + android { compileSdkVersion "$android_compileSdkVersion".toInteger() buildToolsVersion "$android_buildToolsVersion" @@ -37,9 +53,6 @@ android { sourceSets { String sep = File.separator main.java.srcDirs += "src${sep}main${sep}kotlin" - File jvmKotlinFolder = new File("${project.projectDir}${sep}src${sep}jvmMain${sep}kotlin") - if (jvmKotlinFolder.exists()) { - main.java.srcDirs += jvmKotlinFolder.path - } + enableIncludingJvmCodeInAndroidPart() } } diff --git a/repos/common/build.gradle b/repos/common/build.gradle index 3a41642d0cd..acc9dcb0875 100644 --- a/repos/common/build.gradle +++ b/repos/common/build.gradle @@ -30,4 +30,6 @@ kotlin { } } } -} \ No newline at end of file +} + +disableIncludingJvmCodeInAndroidPart()