Simplify lazy caches tests
This commit is contained in:
@@ -54,6 +54,10 @@ import java.util.*
|
|||||||
|
|
||||||
internal val CACHE_DIRECTORY_NAME = "kotlin"
|
internal val CACHE_DIRECTORY_NAME = "kotlin"
|
||||||
|
|
||||||
|
@TestOnly
|
||||||
|
public fun getCacheDirectoryName(): String =
|
||||||
|
CACHE_DIRECTORY_NAME
|
||||||
|
|
||||||
public class IncrementalCacheImpl(
|
public class IncrementalCacheImpl(
|
||||||
private val target: ModuleBuildTarget,
|
private val target: ModuleBuildTarget,
|
||||||
paths: BuildDataPaths
|
paths: BuildDataPaths
|
||||||
|
|||||||
+18
-12
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.config.IncrementalCompilation
|
|||||||
import org.jetbrains.kotlin.jps.incremental.CacheVersion
|
import org.jetbrains.kotlin.jps.incremental.CacheVersion
|
||||||
import org.jetbrains.kotlin.jps.incremental.CacheVersionProvider
|
import org.jetbrains.kotlin.jps.incremental.CacheVersionProvider
|
||||||
import org.jetbrains.kotlin.jps.incremental.KotlinDataContainerTarget
|
import org.jetbrains.kotlin.jps.incremental.KotlinDataContainerTarget
|
||||||
|
import org.jetbrains.kotlin.jps.incremental.getCacheDirectoryName
|
||||||
import org.jetbrains.kotlin.jps.incremental.storage.BasicMapsOwner
|
import org.jetbrains.kotlin.jps.incremental.storage.BasicMapsOwner
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -86,41 +87,46 @@ public abstract class AbstractIncrementalLazyCachesTest : AbstractIncrementalJps
|
|||||||
val p = Printer(sb)
|
val p = Printer(sb)
|
||||||
val targets = projectDescriptor.allModuleTargets
|
val targets = projectDescriptor.allModuleTargets
|
||||||
val paths = projectDescriptor.dataManager.dataPaths
|
val paths = projectDescriptor.dataManager.dataPaths
|
||||||
val versionProvider = CacheVersionProvider(paths)
|
val versions = CacheVersionProvider(paths)
|
||||||
|
|
||||||
dumpCachesForTarget(p, paths, KotlinDataContainerTarget, versionProvider.dataContainerVersion())
|
dumpCachesForTarget(p, paths, KotlinDataContainerTarget, versions.dataContainerVersion())
|
||||||
|
|
||||||
for (target in targets.sortedBy { it.presentableName }) {
|
for (target in targets.sortedBy { it.presentableName }) {
|
||||||
dumpCachesForTarget(p, paths, target, versionProvider.normalVersion(target), versionProvider.experimentalVersion(target))
|
dumpCachesForTarget(p, paths, target, versions.normalVersion(target), versions.experimentalVersion(target),
|
||||||
|
subdirectory = getCacheDirectoryName())
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun dumpCachesForTarget(p: Printer, paths: BuildDataPaths, target: BuildTarget<*>, vararg cacheVersions: CacheVersion) {
|
private fun dumpCachesForTarget(
|
||||||
|
p: Printer,
|
||||||
|
paths: BuildDataPaths,
|
||||||
|
target: BuildTarget<*>,
|
||||||
|
vararg cacheVersions: CacheVersion,
|
||||||
|
subdirectory: String? = null
|
||||||
|
) {
|
||||||
p.println(target)
|
p.println(target)
|
||||||
p.pushIndent()
|
p.pushIndent()
|
||||||
|
|
||||||
val dataRoot = paths.getTargetDataRoot(target)
|
val dataRoot = paths.getTargetDataRoot(target).let { if (subdirectory != null) File(it, subdirectory) else it }
|
||||||
|
|
||||||
cacheVersions
|
cacheVersions
|
||||||
.map { it.formatVersionFile }
|
.map { it.formatVersionFile }
|
||||||
.filter { it.exists() }
|
.filter { it.exists() }
|
||||||
.sortedBy { it.name }
|
.sortedBy { it.name }
|
||||||
.forEach { p.println(it.relativeTo(dataRoot)) }
|
.forEach { p.println(it.name) }
|
||||||
|
|
||||||
val cacheNames = kotlinCacheNames(dataRoot)
|
kotlinCacheNames(dataRoot).sorted().forEach { p.println(it) }
|
||||||
cacheNames.sorted().forEach { p.println(it) }
|
|
||||||
|
|
||||||
p.popIndent()
|
p.popIndent()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun kotlinCacheNames(dataRoot: File): List<String> {
|
private fun kotlinCacheNames(dir: File): List<String> {
|
||||||
val result = arrayListOf<String>()
|
val result = arrayListOf<String>()
|
||||||
|
|
||||||
for (file in dataRoot.walk()) {
|
for (file in dir.walk()) {
|
||||||
if (file.isFile && file.extension == BasicMapsOwner.CACHE_EXTENSION) {
|
if (file.isFile && file.extension == BasicMapsOwner.CACHE_EXTENSION) {
|
||||||
result.add(file.relativeTo(dataRoot))
|
result.add(file.name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+3
-3
@@ -7,7 +7,7 @@ kotlin-data-container
|
|||||||
Module 'module' production
|
Module 'module' production
|
||||||
experimental-format-version.txt
|
experimental-format-version.txt
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
jps-plugin/testData/incremental/changeIncrementalOption/experimentalOnOff/expected-kotlin-caches.txt
Vendored
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
Vendored
+5
-5
@@ -1,9 +1,9 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/inline-functions.tab
|
inline-functions.tab
|
||||||
kotlin/inlined-to.tab
|
inlined-to.tab
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
Vendored
+2
-2
@@ -7,6 +7,6 @@ kotlin-data-container
|
|||||||
Module 'module' production
|
Module 'module' production
|
||||||
experimental-format-version.txt
|
experimental-format-version.txt
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/constants.tab
|
constants.tab
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
Vendored
+4
-4
@@ -7,8 +7,8 @@ kotlin-data-container
|
|||||||
Module 'module' production
|
Module 'module' production
|
||||||
experimental-format-version.txt
|
experimental-format-version.txt
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/constants.tab
|
constants.tab
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
Vendored
+3
-3
@@ -7,7 +7,7 @@ kotlin-data-container
|
|||||||
Module 'module' production
|
Module 'module' production
|
||||||
experimental-format-version.txt
|
experimental-format-version.txt
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
Vendored
+5
-5
@@ -1,9 +1,9 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/inline-functions.tab
|
inline-functions.tab
|
||||||
kotlin/inlined-to.tab
|
inlined-to.tab
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
+5
-5
@@ -7,9 +7,9 @@ kotlin-data-container
|
|||||||
Module 'module' production
|
Module 'module' production
|
||||||
experimental-format-version.txt
|
experimental-format-version.txt
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/inline-functions.tab
|
inline-functions.tab
|
||||||
kotlin/inlined-to.tab
|
inlined-to.tab
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/inline-functions.tab
|
inline-functions.tab
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
+4
-4
@@ -7,8 +7,8 @@ kotlin-data-container
|
|||||||
Module 'module' production
|
Module 'module' production
|
||||||
experimental-format-version.txt
|
experimental-format-version.txt
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/inline-functions.tab
|
inline-functions.tab
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
Vendored
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
kotlin-data-container
|
kotlin-data-container
|
||||||
Module 'module' production
|
Module 'module' production
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
+3
-3
@@ -7,7 +7,7 @@ kotlin-data-container
|
|||||||
Module 'module' production
|
Module 'module' production
|
||||||
experimental-format-version.txt
|
experimental-format-version.txt
|
||||||
format-version.txt
|
format-version.txt
|
||||||
kotlin/package-parts.tab
|
package-parts.tab
|
||||||
kotlin/proto.tab
|
proto.tab
|
||||||
kotlin/source-to-classes.tab
|
source-to-classes.tab
|
||||||
Module 'module' tests
|
Module 'module' tests
|
||||||
|
|||||||
Reference in New Issue
Block a user