From 23e0e40acc554a53342e3f55635c36a4cd84c1c8 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Wed, 15 Nov 2023 16:56:51 +0100 Subject: [PATCH] Create a copy of shared code for building JVM part of native interop runtime This is required because IDEA cannot import the same directory in multiple modules. --- kotlin-native/Interop/Runtime/build.gradle.kts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kotlin-native/Interop/Runtime/build.gradle.kts b/kotlin-native/Interop/Runtime/build.gradle.kts index 055fd674f65..3ba811ef31e 100644 --- a/kotlin-native/Interop/Runtime/build.gradle.kts +++ b/kotlin-native/Interop/Runtime/build.gradle.kts @@ -52,7 +52,19 @@ dependencies { implementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false } } -sourceSets.main.get().java.srcDir("src/jvm/kotlin") +val prepareSharedSourcesForJvm by tasks.registering(Sync::class) { + from("src/main/kotlin") + into("$buildDir/src/main/kotlin") +} +val prepareKotlinIdeaImport by tasks.registering { + dependsOn(prepareSharedSourcesForJvm) +} + +sourceSets.main.configure { + kotlin.setSrcDirs(emptyList()) + kotlin.srcDir("src/jvm/kotlin") + kotlin.srcDir(prepareSharedSourcesForJvm) +} tasks.withType().configureEach {