[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:
Aleksei.Cherepanov
2022-10-26 09:45:27 +00:00
committed by Space Team
parent 50cd560d09
commit 26e7c29a91
17 changed files with 416 additions and 355 deletions
@@ -1,79 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.build
import junit.framework.TestCase
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.junit.Assert.assertNotEquals
import org.junit.Test
class BuildMetaInfoTest : TestCase() {
@Test
fun testJvmSerialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val actual = JvmBuildMetaInfo.serializeToString(info)
val expectedKeys = listOf(
"apiVersionString",
"bytecodeVersionMajor",
"bytecodeVersionMinor",
"bytecodeVersionPatch",
"compilerBuildVersion",
"coroutinesVersion",
"isEAP",
"languageVersionString",
"metadataVersionMajor",
"metadataVersionMinor",
"metadataVersionPatch",
"multiplatformEnable",
"multiplatformVersion",
"ownVersion",
"pluginClasspaths"
)
assertEquals(expectedKeys, actual.split("\r\n", "\n").map { line -> line.split("=").first() })
}
@Test
fun testJvmSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testJsSerializationDeserialization() {
val args = K2JVMCompilerArguments()
val info = JvmBuildMetaInfo.create(args)
val serialized = JvmBuildMetaInfo.serializeToString(info)
val deserialized = JvmBuildMetaInfo.deserializeFromString(serialized)
assertEquals(info, deserialized)
}
@Test
fun testJvmEquals() {
val args1 = K2JVMCompilerArguments()
val info1 = JvmBuildMetaInfo.create(args1)
val args2 = K2JVMCompilerArguments()
val info2 = JvmBuildMetaInfo.create(args2)
assertEquals(info1, info2)
assertEquals(info1, info2.copy())
}
}
@@ -0,0 +1,59 @@
/*
* Copyright 2010-2022 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.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()
)
}
}