[stubs] Move KlibMetaFileType.STUB_VERSION to KotlinStubVersions

Track changes in K/N stubs directly instead of using the hack with
KlibMetaFileType.STUB_VERSION + KotlinStubVersions.BUILTIN_STUB_VERSION.
Changes in built-in stubs might or might not affect .knm stubs and
should be tracked independently.

The used offset constant for migration is the sum of the offsets from
KlibMetaFileType and KotlinStubVersions.BUILTIN_STUB_VERSION.

KTIJ-26761
KTIJ-26961
This commit is contained in:
Pavel Kirpichenkov
2023-10-23 19:15:34 +03:00
committed by Space Team
parent e6b2230d51
commit 237f90d289
4 changed files with 6 additions and 3 deletions
@@ -16,5 +16,5 @@ class K2KotlinNativeMetadataDecompiler : K2KlibMetadataDecompiler<KlibMetadataVe
DynamicTypeDeserializer,
{ KlibMetadataVersion.INSTANCE },
{ KlibMetadataVersion.INVALID_VERSION },
KlibMetaFileType.STUB_VERSION + KotlinStubVersions.BUILTIN_STUB_VERSION
KotlinStubVersions.KOTLIN_NATIVE_STUB_VERSION,
)
@@ -23,6 +23,5 @@ object KlibMetaFileType : FileType {
override fun isReadOnly() = true
override fun getCharset(file: VirtualFile, content: ByteArray): Nothing? = null
const val STUB_VERSION = 2
private const val DEFAULT_DESCRIPTION = "Klib Metadata"
}
@@ -16,7 +16,7 @@ class KotlinNativeMetadataDecompiler : Fe10KlibMetadataDecompiler<KlibMetadataVe
DynamicTypeDeserializer,
{ KlibMetadataVersion.INSTANCE },
{ KlibMetadataVersion.INVALID_VERSION },
KlibMetaFileType.STUB_VERSION + KotlinStubVersions.BUILTIN_STUB_VERSION
KotlinStubVersions.KOTLIN_NATIVE_STUB_VERSION,
) {
override fun doReadFile(file: VirtualFile): FileWithMetadata? {
return FileWithMetadata.forPackageFragment(file)
@@ -30,4 +30,8 @@ object KotlinStubVersions {
// JS stub version should be increased if changes are made to js stub building subsystem (org.jetbrains.kotlin.idea.decompiler.js)
// Increasing this version will lead to reindexing of js binary files (see KotlinJavaScriptMetaFileType).
const val JS_STUB_VERSION = BINARY_STUB_VERSION + 4
// K/N stub version should be increased if changes are made to K/N stub building subsystem.
// Increasing this version will lead to reindexing of K/N binary files (see KlibMetaFileType).
const val KOTLIN_NATIVE_STUB_VERSION = BINARY_STUB_VERSION + 7
}