[JS IC] Write cache info in per-file mode too
- make sure that file is existed and not crashes the compiler
This commit is contained in:
committed by
teamcityserver
parent
a55be02007
commit
f85a59b7f3
+23
-4
@@ -132,12 +132,12 @@ class PersistentCacheProviderImpl(private val cachePath: String) : PersistentCac
|
||||
override fun allInlineHashes(sigResolver: (String, Int) -> IdSignature): Map<IdSignature, TransHash> {
|
||||
val result = mutableMapOf<IdSignature, TransHash>()
|
||||
val cachePath = File(cachePath)
|
||||
cachePath.listFiles { file: File -> file.isDirectory }!!.forEach {
|
||||
val fileInfo = File(it, fileInfoFile)
|
||||
cachePath.listFiles { file: File -> file.isDirectory }!!.forEach { f ->
|
||||
val fileInfo = File(f, fileInfoFile)
|
||||
if (fileInfo.exists()) {
|
||||
val fileName = fileInfo.readLines()[0]
|
||||
parseHashList(it, inlineFunctionsFile) { id -> sigResolver(fileName, id) }.forEach {
|
||||
result[it.first] = it.second
|
||||
parseHashList(f, inlineFunctionsFile) { id -> sigResolver(fileName, id) }.forEach { (sig, hash) ->
|
||||
result[sig] = hash
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,6 +161,8 @@ interface PersistentCacheConsumer {
|
||||
fun commitBinaryAst(path: String, astData: ByteArray)
|
||||
fun invalidateForFile(path: String)
|
||||
|
||||
fun commitLibraryPath(libraryPath: String)
|
||||
|
||||
companion object {
|
||||
val EMPTY = object : PersistentCacheConsumer {
|
||||
override fun commitInlineFunctions(
|
||||
@@ -190,6 +192,10 @@ interface PersistentCacheConsumer {
|
||||
|
||||
}
|
||||
|
||||
override fun commitLibraryPath(libraryPath: String) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -265,4 +271,17 @@ class PersistentCacheConsumerImpl(private val cachePath: String) : PersistentCac
|
||||
astFile.createNewFile()
|
||||
astFile.writeBytes(astData)
|
||||
}
|
||||
|
||||
override fun commitLibraryPath(libraryPath: String) {
|
||||
val infoFile = File(File(cachePath), "info")
|
||||
if (infoFile.exists()) {
|
||||
infoFile.delete()
|
||||
}
|
||||
infoFile.createNewFile()
|
||||
|
||||
PrintWriter(infoFile).use {
|
||||
it.println(libraryPath)
|
||||
it.println("0")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user