Fixed sticking of incremental cache data when case of file path is changed.

Original commit: 959364aa77
This commit is contained in:
Evgeny Gerashchenko
2015-06-08 17:47:52 +03:00
parent d422bb9827
commit e352af9bb8
6 changed files with 69 additions and 3 deletions
@@ -46,6 +46,7 @@ import org.jetbrains.jps.builders.storage.BuildDataPaths
import com.intellij.util.io.BooleanDataDescriptor
import java.util.ArrayList
import org.jetbrains.annotations.TestOnly
import org.jetbrains.jps.incremental.storage.PathStringDescriptor
import org.jetbrains.kotlin.utils.Printer
import java.io.DataInputStream
@@ -546,7 +547,7 @@ public class IncrementalCacheImpl(targetDataRoot: File) : StorageOwner, Incremen
private inner class SourceToClassesMap : BasicMap<List<String>>() {
override fun createMap(): PersistentHashMap<String, List<String>> = PersistentHashMap(
File(baseDir, SOURCE_TO_CLASSES),
EnumeratorStringDescriptor(),
PathStringDescriptor.INSTANCE,
StringListExternalizer
)
@@ -79,6 +79,9 @@ public abstract class AbstractIncrementalJpsTest : JpsBuildTestCase() {
protected open val mockConstantSearch: Callbacks.ConstantAffectionResolver?
get() = null
protected open val checkDumpsCaseInsensitively: Boolean
get() = false
fun build(scope: CompileScopeTestBuilder = CompileScopeTestBuilder.make().all()): MakeResult {
val workDirPath = FileUtil.toSystemIndependentName(workDir.getAbsolutePath())
val logger = MyLogger(workDirPath)
@@ -190,7 +193,12 @@ public abstract class AbstractIncrementalJpsTest : JpsBuildTestCase() {
assertEqualDirectories(outDir, outAfterMake, makeOverallResult.makeFailed)
if (!makeOverallResult.makeFailed) {
TestCase.assertEquals(rebuildResult.mappingsDump, makeOverallResult.mappingsDump)
if (checkDumpsCaseInsensitively && rebuildResult.mappingsDump?.toLowerCase() == makeOverallResult.mappingsDump?.toLowerCase()) {
// do nothing
}
else {
TestCase.assertEquals(rebuildResult.mappingsDump, makeOverallResult.mappingsDump)
}
}
FileUtil.delete(outAfterMake)
@@ -219,7 +227,7 @@ public abstract class AbstractIncrementalJpsTest : JpsBuildTestCase() {
return result
}
protected fun doTest(testDataPath: String) {
protected open fun doTest(testDataPath: String) {
testDataDir = File(testDataPath)
workDir = FileUtilRt.createTempDirectory(TEMP_DIRECTORY_TO_USE, "jps-build", null)
@@ -0,0 +1,46 @@
/*
* Copyright 2010-2015 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
import com.intellij.openapi.util.SystemInfoRt
import org.jetbrains.jps.model.java.JavaSourceRootType
public class IncrementalProjectPathCaseChangedTest : AbstractIncrementalJpsTest() {
fun testProjectPathCaseChanged() {
doTest("jps-plugin/testData/incremental/custom/projectPathCaseChanged/")
}
override fun doTest(testDataPath: String) {
if (SystemInfoRt.isFileSystemCaseSensitive) {
return
}
super.doTest(testDataPath)
}
override val checkDumpsCaseInsensitively: Boolean
get() = true
override fun performAdditionalModifications() {
val module = myProject.getModules()[0]
val sourceRoot = module.getSourceRoots()[0].getUrl()
assert(sourceRoot.endsWith("/src"))
val newSourceRoot = sourceRoot.replace("/src", "/SRC")
module.removeSourceRoot(sourceRoot, JavaSourceRootType.SOURCE)
module.addSourceRoot(newSourceRoot, JavaSourceRootType.SOURCE)
}
}
@@ -0,0 +1,7 @@
Cleaning output files:
out/production/module/_DefaultPackage$foo$*.class
out/production/module/_DefaultPackage.class
End of files
Compiling files:
src/foo.kt
End of files
@@ -0,0 +1,2 @@
fun f() {
}
@@ -0,0 +1,2 @@
fun f() {
}