mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[workspace model tests] allow inspecting cache files in StoreSnapshotsAnalyzer
GitOrigin-RevId: 4fbf917e0d24b1bae2860cfa74556c23738f33c8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
52423b4e4a
commit
f712a5bea6
@@ -1,9 +1,8 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.workspaceModel.ide
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.testFramework.TestLoggerFactory
|
||||
import com.intellij.workspaceModel.storage.EntitySource
|
||||
import com.intellij.workspaceModel.storage.bridgeEntities.ModuleEntity
|
||||
import com.intellij.workspaceModel.storage.impl.EntityStorageSerializerImpl
|
||||
import com.intellij.workspaceModel.storage.impl.SimpleEntityTypesResolver
|
||||
import com.intellij.workspaceModel.storage.toBuilder
|
||||
@@ -16,18 +15,31 @@ import kotlin.system.exitProcess
|
||||
*/
|
||||
fun main(args: Array<String>) {
|
||||
if (args.size !in 1..2) {
|
||||
println("Usage: com.intellij.workspaceModel.ide.StoreSnapshotsAnalyzerKt <path to directory with storage files> [<entity source filter>]")
|
||||
println("Usage: com.intellij.workspaceModel.ide.StoreSnapshotsAnalyzerKt <path to directory with storage files> [<entity source filter>]\n" +
|
||||
"or com.intellij.workspaceModel.ide.StoreSnapshotsAnalyzerKt <path to cache.data file>")
|
||||
exitProcess(1)
|
||||
}
|
||||
val dir = File(args[0])
|
||||
if (!dir.exists()) {
|
||||
throw IllegalArgumentException("$dir doesn't exist")
|
||||
val file = File(args[0])
|
||||
if (!file.exists()) {
|
||||
throw IllegalArgumentException("$file doesn't exist")
|
||||
}
|
||||
val leftFile = dir.resolve("Left_Store")
|
||||
val rightFile = dir.resolve("Right_Store")
|
||||
val rightDiffLogFile = dir.resolve("Right_Diff_Log")
|
||||
val converterFile = dir.resolve("ClassToIntConverter")
|
||||
val resFile = dir.resolve("Res_Store")
|
||||
|
||||
if (file.isFile) {
|
||||
val serializer = EntityStorageSerializerImpl(SimpleEntityTypesResolver, VirtualFileUrlManagerImpl())
|
||||
val storage = file.inputStream().use {
|
||||
serializer.deserializeCache(it)
|
||||
}
|
||||
|
||||
// Set a breakpoint and check
|
||||
println("Cache loaded: ${storage!!.entities(ModuleEntity::class.java).toList().size} modules")
|
||||
return
|
||||
}
|
||||
|
||||
val leftFile = file.resolve("Left_Store")
|
||||
val rightFile = file.resolve("Right_Store")
|
||||
val rightDiffLogFile = file.resolve("Right_Diff_Log")
|
||||
val converterFile = file.resolve("ClassToIntConverter")
|
||||
val resFile = file.resolve("Res_Store")
|
||||
|
||||
val serializer = EntityStorageSerializerImpl(SimpleEntityTypesResolver, VirtualFileUrlManagerImpl())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user