[JPS] Rebuild module on facet change
The logic of detecting changes in Kotlin facets was changed from "Include selected fields" to "Include all compiler arguments and exclude selected". This will help to avoid multiple IC issues when new change-sensitive compiler arguments will be added (#KTIJ-17137, #KT-51536, #KTIJ-17170, #KTIJ-17300, #KT-47983) Fixed Merge-request: KT-MR-7455 Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
50cd560d09
commit
26e7c29a91
+2
-2
@@ -108,11 +108,11 @@ abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJpsTest()
|
||||
}.sortedBy { it.target.jpsModuleBuildTarget.presentableName }
|
||||
|
||||
allTargets.forEach { (chunk, target) ->
|
||||
val metaBuildInfo = chunk.buildMetaInfoFile(target.jpsModuleBuildTarget)
|
||||
val compilerArgumentsFile = chunk.compilerArgumentsFile(target.jpsModuleBuildTarget)
|
||||
dumpCachesForTarget(
|
||||
printer, paths, target.jpsModuleBuildTarget,
|
||||
target.localCacheVersionManager.versionFileForTesting,
|
||||
metaBuildInfo.toFile(),
|
||||
compilerArgumentsFile.toFile(),
|
||||
subdirectory = KOTLIN_CACHE_DIRECTORY_NAME
|
||||
)
|
||||
}
|
||||
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.jps.build
|
||||
|
||||
import junit.framework.TestCase
|
||||
|
||||
class JoinToReadableStringTest : TestCase() {
|
||||
fun test0() {
|
||||
assertEquals(
|
||||
"",
|
||||
listOf<String>().joinToReadableString()
|
||||
)
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
assertEquals(
|
||||
"a",
|
||||
listOf("a").joinToReadableString()
|
||||
)
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
assertEquals(
|
||||
"a and b",
|
||||
listOf("a", "b").joinToReadableString()
|
||||
)
|
||||
}
|
||||
|
||||
fun test3() {
|
||||
assertEquals(
|
||||
"a, b and c",
|
||||
listOf("a", "b", "c").joinToReadableString()
|
||||
)
|
||||
}
|
||||
|
||||
fun test4() {
|
||||
assertEquals(
|
||||
"a, b, c and d",
|
||||
listOf("a", "b", "c", "d").joinToReadableString()
|
||||
)
|
||||
}
|
||||
|
||||
fun test5() {
|
||||
assertEquals(
|
||||
"a, b, c, d and e",
|
||||
listOf("a", "b", "c", "d", "e").joinToReadableString()
|
||||
)
|
||||
}
|
||||
|
||||
fun test6() {
|
||||
assertEquals(
|
||||
"a, b, c, d, e and 1 more",
|
||||
listOf("a", "b", "c", "d", "e", "f").joinToReadableString()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.kotlin.codegen.AsmUtil
|
||||
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
|
||||
import org.jetbrains.kotlin.config.IncrementalCompilation
|
||||
import org.jetbrains.kotlin.config.JvmDefaultMode
|
||||
import org.jetbrains.kotlin.config.KotlinFacetSettings
|
||||
import org.jetbrains.kotlin.incremental.components.LookupTracker
|
||||
import org.jetbrains.kotlin.jps.build.KotlinJpsBuildTestBase.LibraryDependency.*
|
||||
@@ -828,6 +829,121 @@ open class KotlinJpsBuildTest : KotlinJpsBuildTestBase() {
|
||||
checkWhen(emptyArray(), null, packageClasses("kotlinProject", "src/test1.kt", "Test1Kt"))
|
||||
}
|
||||
|
||||
@WorkingDir("KotlinProject")
|
||||
fun testModuleRebuildOnJvmTargetChange() {
|
||||
initProject(JVM_MOCK_RUNTIME)
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
(facet.compilerArguments as K2JVMCompilerArguments).jvmTarget = "1.8"
|
||||
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
buildAllModules().assertSuccessful()
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
(facet.compilerArguments as K2JVMCompilerArguments).jvmTarget = "9"
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
|
||||
checkWhen(emptyArray(), null, packageClasses("kotlinProject", "src/test1.kt", "Test1Kt"))
|
||||
}
|
||||
|
||||
@WorkingDir("KotlinProject")
|
||||
fun testModuleRebuildOnBackendChange() {
|
||||
initProject(JVM_MOCK_RUNTIME)
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
(facet.compilerArguments as K2JVMCompilerArguments).useK2 = false
|
||||
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
buildAllModules().assertSuccessful()
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
(facet.compilerArguments as K2JVMCompilerArguments).useK2 = true
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
|
||||
checkWhen(emptyArray(), null, packageClasses("kotlinProject", "src/test1.kt", "Test1Kt"))
|
||||
}
|
||||
|
||||
@WorkingDir("KotlinProject")
|
||||
fun testModuleRebuildOnJvmDefaultChange() {
|
||||
initProject(JVM_MOCK_RUNTIME)
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
(facet.compilerArguments as K2JVMCompilerArguments).jvmDefault = JvmDefaultMode.DEFAULT.description
|
||||
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
buildAllModules().assertSuccessful()
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
(facet.compilerArguments as K2JVMCompilerArguments).jvmDefault = JvmDefaultMode.ALL_COMPATIBILITY.description
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
|
||||
checkWhen(emptyArray(), null, packageClasses("kotlinProject", "src/test1.kt", "Test1Kt"))
|
||||
}
|
||||
|
||||
@WorkingDir("KotlinProject")
|
||||
fun testModuleRebuildOnAddJavaMoudlesChange() {
|
||||
initProject(JVM_MOCK_RUNTIME)
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
buildAllModules().assertSuccessful()
|
||||
myProject.modules.forEach {
|
||||
val facet = KotlinFacetSettings()
|
||||
facet.useProjectSettings = false
|
||||
facet.compilerArguments = K2JVMCompilerArguments()
|
||||
(facet.compilerArguments as K2JVMCompilerArguments).additionalJavaModules = arrayOf("ALL-MODULE-PATH")
|
||||
it.container.setChild(
|
||||
JpsKotlinFacetModuleExtension.KIND,
|
||||
JpsKotlinFacetModuleExtension(facet)
|
||||
)
|
||||
}
|
||||
|
||||
checkWhen(emptyArray(), null, packageClasses("kotlinProject", "src/test1.kt", "Test1Kt"))
|
||||
}
|
||||
|
||||
fun testBuildAfterGdwBuild() {
|
||||
initProject(JVM_FULL_RUNTIME)
|
||||
findModule("module2").let {
|
||||
|
||||
Reference in New Issue
Block a user