New IC: don't fail on unsupported difference kinds and process SUPERTYPE_ID_LIST correctly

This commit is contained in:
Zalim Bashorov
2016-02-11 23:07:41 +03:00
parent 90be4f8ea5
commit 05eff9028f
7 changed files with 75 additions and 13 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
* Copyright 2010-2016 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.
@@ -156,15 +156,6 @@ private abstract class DifferenceCalculator() {
}
private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: ProtoMapValue) : DifferenceCalculator() {
companion object {
private val CLASS_SIGNATURE_ENUMS = EnumSet.of(
ProtoBufClassKind.FLAGS,
ProtoBufClassKind.FQ_NAME,
ProtoBufClassKind.TYPE_PARAMETER_LIST,
ProtoBufClassKind.SUPERTYPE_LIST
)
}
val oldClassData = JvmProtoBufUtil.readClassDataFrom(oldData.bytes, oldData.strings)
val newClassData = JvmProtoBufUtil.readClassDataFrom(newData.bytes, newData.strings)
@@ -223,11 +214,17 @@ private class DifferenceCalculatorForClass(oldData: ProtoMapValue, newData: Prot
ProtoBufClassKind.TYPE_TABLE -> {
// TODO
}
in CLASS_SIGNATURE_ENUMS -> {
ProtoBufClassKind.FLAGS,
ProtoBufClassKind.FQ_NAME,
ProtoBufClassKind.TYPE_PARAMETER_LIST,
ProtoBufClassKind.SUPERTYPE_LIST,
ProtoBufClassKind.SUPERTYPE_ID_LIST-> {
isClassAffected = true
areSubclassesAffected = true
}
else -> throw IllegalArgumentException("Unsupported kind: $kind")
ProtoBufClassKind.CLASS_MODULE_NAME -> {
// TODO
}
}
}
@@ -262,7 +259,8 @@ private class DifferenceCalculatorForPackageFacade(oldData: ProtoMapValue, newDa
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getFunctionList))
ProtoBufPackageKind.PROPERTY_LIST ->
names.addAll(calcDifferenceForNonPrivateMembers(ProtoBuf.Package::getPropertyList))
ProtoBufPackageKind.TYPE_TABLE -> {
ProtoBufPackageKind.TYPE_TABLE,
ProtoBufPackageKind.PACKAGE_MODULE_NAME -> {
// TODO
}
else -> throw IllegalArgumentException("Unsupported kind: $kind")
@@ -0,0 +1,31 @@
/*
* Copyright 2010-2016 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.jps.build
open class IncrementalRenameModuleTest : AbstractIncrementalJpsTest() {
fun testRenameModule() {
doTest("jps-plugin/testData/incremental/custom/renameModule/")
}
override fun performAdditionalModifications(modifications: List<Modification>) {
projectDescriptor.project.modules.forEach { it.name += "Renamed" }
}
}
class ExperimentalIncrementalRenameModuleTest : IncrementalRenameModuleTest() {
override val enableExperimentalIncrementalCompilation = true
}
@@ -0,0 +1,18 @@
================ Step #1 =================
Compiling files:
src/test.kt
src/unrelated.kt
src/usage.kt
End of files
Exit code: ADDITIONAL_PASS_REQUIRED
------------------------------------------
Cleaning output files:
out/production/moduleRenamed/META-INF/moduleRenamed.kotlin_module
out/production/moduleRenamed/test/UsageKt.class
End of files
Compiling files:
src/usage.kt
End of files
Exit code: OK
------------------------------------------
@@ -0,0 +1,5 @@
package test
class Foo
fun bar() {}
@@ -0,0 +1,4 @@
package unrelated
fun doSomething() {
}
@@ -0,0 +1,6 @@
package test
fun usage() {
Foo()
bar()
}