diff --git a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/IncrementalModuleInfo.kt b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/IncrementalModuleInfo.kt index 6f1eeb29816..74d8e053858 100644 --- a/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/IncrementalModuleInfo.kt +++ b/compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/IncrementalModuleInfo.kt @@ -24,7 +24,7 @@ class IncrementalModuleInfo( val dirToModule: Map, val nameToModules: Map>, val jarToClassListFile: Map, - // only for js + // only for js and mpp val jarToModule: Map ) : Serializable { companion object { diff --git a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/multiproject/ModulesApiHistory.kt b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/multiproject/ModulesApiHistory.kt index e2d3a5cd8ca..16a79021fc3 100644 --- a/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/multiproject/ModulesApiHistory.kt +++ b/compiler/incremental-compilation-impl/src/org/jetbrains/kotlin/incremental/multiproject/ModulesApiHistory.kt @@ -91,6 +91,11 @@ abstract class ModulesApiHistoryBase(protected val modulesInfo: IncrementalModul class ModulesApiHistoryJvm(modulesInfo: IncrementalModuleInfo) : ModulesApiHistoryBase(modulesInfo) { override fun getBuildHistoryFilesForJar(jar: File): Either> { + val moduleInfoFromJar = modulesInfo.jarToModule[jar] + if (moduleInfoFromJar != null) { + return Either.Success(setOf(moduleInfoFromJar.buildHistoryFile)) + } + val classListFile = modulesInfo.jarToClassListFile[jar] ?: return Either.Error("Unknown jar: $jar") if (!classListFile.isFile) return Either.Error("Class list file does not exist $classListFile") diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt index 78b81b31058..218a612b989 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/kotlin/org/jetbrains/kotlin/gradle/NewMultiplatformIT.kt @@ -10,10 +10,7 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind import org.jetbrains.kotlin.gradle.plugin.mpp.UnusedSourceSetsChecker import org.jetbrains.kotlin.gradle.plugin.sources.METADATA_CONFIGURATION_NAME_SUFFIX import org.jetbrains.kotlin.gradle.plugin.sources.SourceSetConsistencyChecks -import org.jetbrains.kotlin.gradle.util.checkBytecodeContains -import org.jetbrains.kotlin.gradle.util.isWindows -import org.jetbrains.kotlin.gradle.util.modify -import org.jetbrains.kotlin.gradle.util.testResolveAllConfigurations +import org.jetbrains.kotlin.gradle.util.* import org.jetbrains.kotlin.konan.target.CompilerOutputKind import org.jetbrains.kotlin.konan.target.HostManager import org.junit.Assert @@ -1552,4 +1549,42 @@ class NewMultiplatformIT : BaseGradleIT() { } } } + + @Test + fun testIncrementalCompilation() = with(Project("new-mpp-jvm-js-ic", gradleVersion)) { + build("build") { + assertSuccessful() + } + + val libCommonClassKt = projectDir.getFileByName("LibCommonClass.kt") + val libCommonClassJsKt = projectDir.getFileByName("LibCommonClassJs.kt") + libCommonClassJsKt.modify { it.checkedReplace("platform = \"js\"", "platform = \"Kotlin/JS\"") } + + val libCommonClassJvmKt = projectDir.getFileByName("LibCommonClassJvm.kt") + libCommonClassJvmKt.modify { it.checkedReplace("platform = \"jvm\"", "platform = \"Kotlin/JVM\"") } + build("build") { + assertSuccessful() + assertCompiledKotlinSources(project.relativize(libCommonClassKt, libCommonClassJsKt, libCommonClassJvmKt)) + } + + val libJvmPlatformUtilKt = projectDir.getFileByName("libJvmPlatformUtil.kt") + libJvmPlatformUtilKt.modify { + it.checkedReplace("fun libJvmPlatformUtil", "inline fun libJvmPlatformUtil") + } + build("build") { + assertSuccessful() + val useLibJvmPlatformUtilKt = projectDir.getFileByName("useLibJvmPlatformUtil.kt") + assertCompiledKotlinSources(project.relativize(libJvmPlatformUtilKt, useLibJvmPlatformUtilKt)) + } + + val libJsPlatformUtilKt = projectDir.getFileByName("libJsPlatformUtil.kt") + libJsPlatformUtilKt.modify { + it.checkedReplace("fun libJsPlatformUtil", "inline fun libJsPlatformUtil") + } + build("build") { + assertSuccessful() + val useLibJsPlatformUtilKt = projectDir.getFileByName("useLibJsPlatformUtil.kt") + assertCompiledKotlinSources(project.relativize(libJsPlatformUtilKt, useLibJsPlatformUtilKt)) + } + } } \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/build.gradle new file mode 100644 index 00000000000..aae3b07b376 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/build.gradle @@ -0,0 +1,7 @@ +apply from: "$rootDir/configure-targets.gradle" + +kotlin.sourceSets.commonMain { + dependencies { + implementation project(":lib") + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/commonMain/kotlin/AppCommonClass.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/commonMain/kotlin/AppCommonClass.kt new file mode 100644 index 00000000000..1a4e4cc2259 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/commonMain/kotlin/AppCommonClass.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +expect class AppCommonClass { + val platform: String +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/commonMain/kotlin/AppCommonDummy.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/commonMain/kotlin/AppCommonDummy.kt new file mode 100644 index 00000000000..bb14282d598 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/commonMain/kotlin/AppCommonDummy.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +class AppCommonDummy \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/AppCommonClassJs.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/AppCommonClassJs.kt new file mode 100644 index 00000000000..12f131d312b --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/AppCommonClassJs.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +actual class AppCommonClass { + actual val platform = "js" +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/AppJsDummy.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/AppJsDummy.kt new file mode 100644 index 00000000000..cb4e9ba82c9 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/AppJsDummy.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +class AppJsDummy \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/useLibJsPlatformUtil.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/useLibJsPlatformUtil.kt new file mode 100644 index 00000000000..88609d8cd5d --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jsMain/kotlin/useLibJsPlatformUtil.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +fun useLibJsPlatformUtil() = libJsPlatformUtil() \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/AppCommonClassJvm.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/AppCommonClassJvm.kt new file mode 100644 index 00000000000..6b6ba57f3ff --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/AppCommonClassJvm.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +actual class AppCommonClass { + actual val platform = "jvm" +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/AppJvmDummy.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/AppJvmDummy.kt new file mode 100644 index 00000000000..959e62fc0e1 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/AppJvmDummy.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +class AppJvmDummy \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/useLibJvmPlatformUtil.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/useLibJvmPlatformUtil.kt new file mode 100644 index 00000000000..c0f5679cb6b --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/app/src/jvmMain/kotlin/useLibJvmPlatformUtil.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +fun useLibJvmPlatformUtil() = libJvmPlatformUtil() \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/build.gradle new file mode 100644 index 00000000000..e29325edc24 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/build.gradle @@ -0,0 +1,16 @@ +buildscript { + repositories { + mavenLocal() + jcenter() + } + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +subprojects { + repositories { + mavenLocal() + jcenter() + } +} diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/configure-targets.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/configure-targets.gradle new file mode 100644 index 00000000000..f5ddc55927b --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/configure-targets.gradle @@ -0,0 +1,25 @@ +apply plugin: "kotlin-multiplatform" + +kotlin { + targets { + fromPreset(presets.jvm, 'jvm') + fromPreset(presets.js, 'js') + } + sourceSets { + commonMain { + dependencies { + implementation 'org.jetbrains.kotlin:kotlin-stdlib-common' + } + } + jvmMain { + dependencies { + implementation 'org.jetbrains.kotlin:kotlin-stdlib' + } + } + jsMain { + dependencies { + implementation 'org.jetbrains.kotlin:kotlin-stdlib-js' + } + } + } +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/build.gradle new file mode 100644 index 00000000000..d6b34af43a5 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/build.gradle @@ -0,0 +1 @@ +apply from: "$rootDir/configure-targets.gradle" diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/commonMain/kotlin/LibCommonClass.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/commonMain/kotlin/LibCommonClass.kt new file mode 100644 index 00000000000..36205c356f1 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/commonMain/kotlin/LibCommonClass.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +expect class LibCommonClass { + val platform: String +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/commonMain/kotlin/LibCommonDummy.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/commonMain/kotlin/LibCommonDummy.kt new file mode 100644 index 00000000000..861f7fb82bb --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/commonMain/kotlin/LibCommonDummy.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +class LibCommonDummy \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/LibCommonClassJs.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/LibCommonClassJs.kt new file mode 100644 index 00000000000..57d943e5e59 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/LibCommonClassJs.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +actual class LibCommonClass { + actual val platform = "js" +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/LibJsDummy.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/LibJsDummy.kt new file mode 100644 index 00000000000..ac31d8aa323 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/LibJsDummy.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +class LibJsDummy \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/libJsPlatformUtil.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/libJsPlatformUtil.kt new file mode 100644 index 00000000000..57529da659f --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jsMain/kotlin/libJsPlatformUtil.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +fun libJsPlatformUtil(): Int = 0 diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/LibCommonClassJvm.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/LibCommonClassJvm.kt new file mode 100644 index 00000000000..ded8cae0fb3 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/LibCommonClassJvm.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +actual class LibCommonClass { + actual val platform = "jvm" +} \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/LibJvmDummy.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/LibJvmDummy.kt new file mode 100644 index 00000000000..05fa67136a5 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/LibJvmDummy.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +class LibJvmDummy \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/libJvmPlatformUtil.kt b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/libJvmPlatformUtil.kt new file mode 100644 index 00000000000..60aa00b1278 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/lib/src/jvmMain/kotlin/libJvmPlatformUtil.kt @@ -0,0 +1,6 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +fun libJvmPlatformUtil(): Int = 0 diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/settings.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/settings.gradle new file mode 100644 index 00000000000..c0b70ce1c99 --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/src/test/resources/testProject/new-mpp-jvm-js-ic/settings.gradle @@ -0,0 +1 @@ +include ':app', ':lib' \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt index c22fee1c20a..40dd68088d7 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt @@ -20,6 +20,7 @@ import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.invocation.Gradle import org.gradle.api.plugins.JavaPluginConvention +import org.gradle.api.tasks.bundling.AbstractArchiveTask import org.gradle.jvm.tasks.Jar import org.jetbrains.kotlin.build.JvmSourceRoot import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments @@ -29,8 +30,10 @@ import org.jetbrains.kotlin.cli.common.arguments.K2MetadataCompilerArguments import org.jetbrains.kotlin.cli.common.messages.MessageCollector import org.jetbrains.kotlin.daemon.client.CompileServiceSession import org.jetbrains.kotlin.daemon.common.* +import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.plugin.internal.state.TaskLoggers import org.jetbrains.kotlin.gradle.logging.kotlinDebug +import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.tasks.* import org.jetbrains.kotlin.gradle.utils.newTmpFile import org.jetbrains.kotlin.gradle.utils.relativeToRoot @@ -206,6 +209,15 @@ internal open class GradleCompilerRunner(protected val task: Task) { project.tasks.withType(InspectClassesForMultiModuleIC::class.java).forEach { task -> jarToClassListFile[File(task.archivePath)] = task.classesListFile } + project.extensions.findByType(KotlinMultiplatformExtension::class.java)?.let { kotlinExt -> + for (target in kotlinExt.targets) { + val mainCompilation = target.compilations.findByName(KotlinCompilation.MAIN_COMPILATION_NAME) ?: continue + val kotlinTask = mainCompilation.compileKotlinTask as? AbstractKotlinCompile<*> ?: continue + val module = IncrementalModuleEntry(project.path, kotlinTask.moduleName, project.buildDir, kotlinTask.buildHistoryFile) + val jarTask = project.tasks.findByName(target.artifactsTaskName) as? AbstractArchiveTask ?: continue + jarToModule[jarTask.archivePath] = module + } + } } return IncrementalModuleInfo(