IC: Add IC test with fix on rename file with only class inside
"fails" on JS and JPS tests - the IC logic there is less precise.
This commit is contained in:
@@ -24,7 +24,8 @@ data class BuildLogFinder(
|
||||
private val isJsEnabled: Boolean = false,
|
||||
private val isScopeExpansionEnabled: Boolean = false,
|
||||
private val isKlibEnabled: Boolean = false,
|
||||
private val isFirEnabled: Boolean = false
|
||||
private val isFirEnabled: Boolean = false,
|
||||
private val isJpsBuild: Boolean = false,
|
||||
) {
|
||||
companion object {
|
||||
private const val JS_LOG = "js-build.log"
|
||||
@@ -35,6 +36,7 @@ data class BuildLogFinder(
|
||||
const val JS_JPS_LOG = "js-jps-build.log"
|
||||
private const val FIR_LOG = "fir-build.log"
|
||||
private const val GRADLE_FIR_LOG = "gradle-fir-build.log"
|
||||
const val JPS_LOG = "jps-build.log"
|
||||
private const val SIMPLE_LOG = "build.log"
|
||||
|
||||
fun isJpsLogFile(file: File): Boolean =
|
||||
@@ -45,6 +47,7 @@ data class BuildLogFinder(
|
||||
val names = dir.list() ?: arrayOf()
|
||||
val files = names.filter { File(dir, it).isFile }.toSet()
|
||||
val matchedName = when {
|
||||
isJpsBuild && JPS_LOG in files -> JPS_LOG
|
||||
isScopeExpansionEnabled && SCOPE_EXPANDING_LOG in files -> SCOPE_EXPANDING_LOG
|
||||
isKlibEnabled && KLIB_LOG in files -> KLIB_LOG
|
||||
isJsEnabled && JS_LOG in files -> JS_LOG
|
||||
|
||||
+3
-3
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.fir.visitors.FirVisitor
|
||||
import org.jetbrains.kotlin.metadata.ProtoBuf
|
||||
import org.jetbrains.kotlin.modules.TargetId
|
||||
import org.jetbrains.kotlin.name.SpecialNames
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
import org.jetbrains.org.objectweb.asm.commons.Method
|
||||
import java.io.File
|
||||
|
||||
@@ -113,10 +112,11 @@ internal fun collectNewDirtySources(
|
||||
withMetadataSerializer(metadata, data) { serializer ->
|
||||
klass.acceptChildren(this, data)
|
||||
serializer.serialize(metadata)?.let { (classProto, nameTable) ->
|
||||
caches.platformCache.collectClassChangesByFeMetadata(
|
||||
JvmClassName.byClassId(klass.classId),
|
||||
caches.platformCache.saveFrontendClassToCache(
|
||||
klass.classId,
|
||||
classProto as ProtoBuf.Class,
|
||||
nameTable,
|
||||
null, // TODO: !!
|
||||
changesCollector
|
||||
)
|
||||
}
|
||||
|
||||
+5
@@ -577,6 +577,11 @@ public class IncrementalFirICLightTreeJvmCompilerRunnerTestGenerated extends Abs
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -577,6 +577,11 @@ public class IncrementalFirJvmCompilerRunnerTestGenerated extends AbstractIncrem
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -577,6 +577,11 @@ public class IncrementalFirLightTreeJvmCompilerRunnerTestGenerated extends Abstr
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -576,6 +576,11 @@ public class IncrementalJsCompilerRunnerTestGenerated extends AbstractIncrementa
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -576,6 +576,11 @@ public class IncrementalJsCompilerRunnerWithMetadataOnlyTestGenerated extends Ab
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -576,6 +576,11 @@ public class IncrementalJsKlibCompilerRunnerTestGenerated extends AbstractIncrem
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -576,6 +576,11 @@ public class IncrementalJsKlibCompilerWithScopeExpansionRunnerTestGenerated exte
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -577,6 +577,11 @@ public class IncrementalJvmCompilerRunnerTestGenerated extends AbstractIncrement
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+5
@@ -577,6 +577,11 @@ public class IncrementalJvmOldBackendCompilerRunnerTestGenerated extends Abstrac
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+1
-1
@@ -113,7 +113,7 @@ abstract class AbstractIncrementalJpsTest(
|
||||
lateinit var kotlinCompileContext: KotlinCompileContext
|
||||
|
||||
protected open val buildLogFinder: BuildLogFinder
|
||||
get() = BuildLogFinder()
|
||||
get() = BuildLogFinder(isJpsBuild = true)
|
||||
|
||||
private fun enableDebugLogging() {
|
||||
com.intellij.openapi.diagnostic.Logger.setFactory(TestLoggerFactory::class.java)
|
||||
|
||||
Generated
+5
@@ -1246,6 +1246,11 @@ public class IncrementalJvmJpsTestGenerated extends AbstractIncrementalJvmJpsTes
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithClassesOnly")
|
||||
public void testRenameFileWithClassesOnly() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithClassesOnly/");
|
||||
}
|
||||
|
||||
@TestMetadata("renameFileWithFunctionOverload")
|
||||
public void testRenameFileWithFunctionOverload() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/renameFileWithFunctionOverload/");
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
out/production/module/foo/Foo0Kt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/foo1.kt
|
||||
End of files
|
||||
Exit code: OK
|
||||
------------------------------------------
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package foo
|
||||
|
||||
class A(val x: Int) {}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package foo
|
||||
|
||||
class A(val x: Int) {}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
package foo
|
||||
|
||||
class A(val x: Int) {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
out/production/module/foo/A.class
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/module/use/UseAKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/foo1.kt
|
||||
src/useA.kt
|
||||
End of files
|
||||
Exit code: OK
|
||||
------------------------------------------
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
================ Step #1 =================
|
||||
|
||||
Cleaning output files:
|
||||
out/production/module/META-INF/module.kotlin_module
|
||||
out/production/module/foo/A.class
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/module/use/UseAKt.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/foo1.kt
|
||||
src/useA.kt
|
||||
End of files
|
||||
Exit code: OK
|
||||
------------------------------------------
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package use
|
||||
|
||||
import foo.*
|
||||
|
||||
fun useA() {
|
||||
A(1)
|
||||
}
|
||||
Reference in New Issue
Block a user