Print lookup storage as is in tests
This way it is easier to debug when cache's content is different after rebuild
This commit is contained in:
@@ -174,11 +174,19 @@ open class LookupStorage(targetDataDir: File) : BasicMapsOwner(targetDataDir) {
|
|||||||
flush(false)
|
flush(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestOnly fun dump(lookupSymbols: Set<LookupSymbol>, basePath: File? = null): String {
|
@TestOnly
|
||||||
|
fun dump(lookupSymbols: Set<LookupSymbol>): String {
|
||||||
flush(false)
|
flush(false)
|
||||||
|
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
val p = Printer(sb)
|
val p = Printer(sb)
|
||||||
|
|
||||||
|
p.println("====== File to id map")
|
||||||
|
p.println(fileToId.dump())
|
||||||
|
|
||||||
|
p.println("====== Id to file map")
|
||||||
|
p.println(idToFile.dump())
|
||||||
|
|
||||||
val lookupsStrings = lookupSymbols.groupBy { LookupSymbolKey(it.name, it.scope) }
|
val lookupsStrings = lookupSymbols.groupBy { LookupSymbolKey(it.name, it.scope) }
|
||||||
|
|
||||||
for (lookup in lookupMap.keys.sorted()) {
|
for (lookup in lookupMap.keys.sorted()) {
|
||||||
@@ -186,12 +194,11 @@ open class LookupStorage(targetDataDir: File) : BasicMapsOwner(targetDataDir) {
|
|||||||
|
|
||||||
val key = if (lookup in lookupsStrings) {
|
val key = if (lookup in lookupsStrings) {
|
||||||
lookupsStrings[lookup]!!.map { "${it.scope}#${it.name}" }.sorted().joinToString(", ")
|
lookupsStrings[lookup]!!.map { "${it.scope}#${it.name}" }.sorted().joinToString(", ")
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lookup.toString()
|
lookup.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
val value = fileIds.map { idToFile[it]?.let { if (basePath == null) it.absolutePath else it.toRelativeString(basePath) } ?: it.toString() }.sorted().joinToString(", ")
|
val value = fileIds.map { it.toString() }.sorted().joinToString(", ")
|
||||||
p.println("$key -> $value")
|
p.println("$key -> $value")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user