diff --git a/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt b/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt index 273024b2ec7..e1ee0e48f58 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/protoDifferenceUtils.kt @@ -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") diff --git a/jps-plugin/test/org/jetbrains/kotlin/jps/build/incrementalCustomTests.kt b/jps-plugin/test/org/jetbrains/kotlin/jps/build/incrementalCustomTests.kt new file mode 100644 index 00000000000..d5c0af29a9e --- /dev/null +++ b/jps-plugin/test/org/jetbrains/kotlin/jps/build/incrementalCustomTests.kt @@ -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) { + projectDescriptor.project.modules.forEach { it.name += "Renamed" } + } +} + +class ExperimentalIncrementalRenameModuleTest : IncrementalRenameModuleTest() { + override val enableExperimentalIncrementalCompilation = true +} diff --git a/jps-plugin/testData/incremental/custom/renameModule/build.log b/jps-plugin/testData/incremental/custom/renameModule/build.log new file mode 100644 index 00000000000..5b9b113b83b --- /dev/null +++ b/jps-plugin/testData/incremental/custom/renameModule/build.log @@ -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 +------------------------------------------ diff --git a/jps-plugin/testData/incremental/custom/renameModule/test.kt b/jps-plugin/testData/incremental/custom/renameModule/test.kt new file mode 100644 index 00000000000..e10864dc984 --- /dev/null +++ b/jps-plugin/testData/incremental/custom/renameModule/test.kt @@ -0,0 +1,5 @@ +package test + +class Foo + +fun bar() {} diff --git a/jps-plugin/testData/incremental/custom/renameModule/test.kt.touch b/jps-plugin/testData/incremental/custom/renameModule/test.kt.touch new file mode 100644 index 00000000000..e69de29bb2d diff --git a/jps-plugin/testData/incremental/custom/renameModule/unrelated.kt b/jps-plugin/testData/incremental/custom/renameModule/unrelated.kt new file mode 100644 index 00000000000..8a9fa61e315 --- /dev/null +++ b/jps-plugin/testData/incremental/custom/renameModule/unrelated.kt @@ -0,0 +1,4 @@ +package unrelated + +fun doSomething() { +} diff --git a/jps-plugin/testData/incremental/custom/renameModule/usage.kt b/jps-plugin/testData/incremental/custom/renameModule/usage.kt new file mode 100644 index 00000000000..7805cf82546 --- /dev/null +++ b/jps-plugin/testData/incremental/custom/renameModule/usage.kt @@ -0,0 +1,6 @@ +package test + +fun usage() { + Foo() + bar() +}