[JS IR] Fix cache format, module name one the second line
This commit is contained in:
@@ -25,7 +25,7 @@ data class CacheInfo(val path: String, val libPath: String, var flatHash: ULong,
|
||||
|
||||
if (!info.exists()) return null
|
||||
|
||||
val (libPath, flatHash, transHash, configHash) = info.readLines()
|
||||
val (libPath, _, flatHash, transHash, configHash) = info.readLines()
|
||||
|
||||
// safe cast for the backward compatibility with the cache from the previous compiler versions
|
||||
val configHashULong = configHash.toULongOrNull(16) ?: 0UL
|
||||
|
||||
@@ -218,10 +218,10 @@ private fun buildCacheForModule(
|
||||
|
||||
cacheConsumer.commitLibraryInfo(
|
||||
libraryInfo.libPath.toCanonicalPath(),
|
||||
irModule.name.asString(),
|
||||
libraryInfo.flatHash,
|
||||
libraryInfo.transHash,
|
||||
libraryInfo.configHash,
|
||||
irModule.name.asString()
|
||||
libraryInfo.configHash
|
||||
)
|
||||
}
|
||||
|
||||
@@ -616,7 +616,7 @@ fun rebuildCacheForDirtyFiles(
|
||||
|
||||
val currentIrModule = irModules.find { it.second == library }?.first!!
|
||||
|
||||
cacheConsumer.commitLibraryInfo(library.libraryFile.path.toCanonicalPath(), 0UL, 0UL, 0UL, currentIrModule.name.asString())
|
||||
cacheConsumer.commitLibraryInfo(library.libraryFile.path.toCanonicalPath(), currentIrModule.name.asString(), 0UL, 0UL, 0UL)
|
||||
|
||||
buildCacheForModuleFiles(
|
||||
currentIrModule,
|
||||
|
||||
+5
-5
@@ -190,7 +190,7 @@ class PersistentCacheProviderImpl(private val cachePath: String) : PersistentCac
|
||||
|
||||
override fun moduleName(): String {
|
||||
val infoFile = File(File(cachePath), "info")
|
||||
return infoFile.readLines()[3]
|
||||
return infoFile.readLines()[1]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ interface PersistentCacheConsumer {
|
||||
fun commitSourceMap(path: String, mapData: ByteArray)
|
||||
fun invalidateForFile(path: String)
|
||||
|
||||
fun commitLibraryInfo(libraryPath: String, flatHash: ULong, transHash: ULong, configHash: ULong, moduleName: String)
|
||||
fun commitLibraryInfo(libraryPath: String, moduleName: String, flatHash: ULong, transHash: ULong, configHash: ULong)
|
||||
|
||||
companion object {
|
||||
val EMPTY = object : PersistentCacheConsumer {
|
||||
@@ -231,7 +231,7 @@ interface PersistentCacheConsumer {
|
||||
|
||||
}
|
||||
|
||||
override fun commitLibraryInfo(libraryPath: String, flatHash: ULong, transHash: ULong, configHash: ULong, moduleName: String) {
|
||||
override fun commitLibraryInfo(libraryPath: String, moduleName: String, flatHash: ULong, transHash: ULong, configHash: ULong) {
|
||||
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ class PersistentCacheConsumerImpl(private val cachePath: String) : PersistentCac
|
||||
commitByteArrayToCacheFile(path, fileSourceMap, mapData)
|
||||
}
|
||||
|
||||
override fun commitLibraryInfo(libraryPath: String, flatHash: ULong, transHash: ULong, configHash: ULong, moduleName: String) {
|
||||
override fun commitLibraryInfo(libraryPath: String, moduleName: String, flatHash: ULong, transHash: ULong, configHash: ULong) {
|
||||
val infoFile = File(File(cachePath), "info")
|
||||
if (infoFile.exists()) {
|
||||
infoFile.delete()
|
||||
@@ -333,10 +333,10 @@ class PersistentCacheConsumerImpl(private val cachePath: String) : PersistentCac
|
||||
|
||||
PrintWriter(infoFile).use {
|
||||
it.println(libraryPath)
|
||||
it.println(moduleName)
|
||||
it.println(flatHash.toString(16))
|
||||
it.println(transHash.toString(16))
|
||||
it.println(configHash.toString(16))
|
||||
it.println(moduleName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class TestModuleCache(val files: MutableMap<String, FileCache>) {
|
||||
files.remove(path)
|
||||
}
|
||||
|
||||
override fun commitLibraryInfo(libraryPath: String, flatHash: ULong, transHash: ULong, configHash: ULong, moduleName: String) {
|
||||
override fun commitLibraryInfo(libraryPath: String, moduleName: String, flatHash: ULong, transHash: ULong, configHash: ULong) {
|
||||
storedModuleName = moduleName
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user