[JS IR] tie together IC code in tests and K2JsIrCompiler

This commit is contained in:
Anton Bannykh
2021-11-12 13:59:41 +03:00
committed by TeamCityServer
parent ff02ea5840
commit 75368a2c06
7 changed files with 121 additions and 23 deletions
@@ -50,6 +50,8 @@ interface PersistentCacheProvider {
fun sourceMap(path: String): ByteArray?
fun filePaths(): Iterable<String>
companion object {
val EMPTY = object : PersistentCacheProvider {
override fun fileFingerPrint(path: String): Hash {
@@ -83,6 +85,8 @@ interface PersistentCacheProvider {
override fun sourceMap(path: String): ByteArray? {
return null
}
override fun filePaths(): Iterable<String> = emptyList()
}
}
}
@@ -178,6 +182,15 @@ class PersistentCacheProviderImpl(private val cachePath: String) : PersistentCac
override fun sourceMap(path: String): ByteArray? {
return readBytesFromCacheFile(path, fileSourceMap)
}
override fun filePaths(): Iterable<String> {
return File(cachePath).listFiles()!!.filter { it.isDirectory }.mapNotNull { f ->
val fileInfo = File(f, fileInfoFile)
if (fileInfo.exists()) {
fileInfo.readLines()[0]
} else null
}
}
}
interface PersistentCacheConsumer {