Add docs for different metadata versions and proto files

Review: https://jetbrains.team/p/kt/reviews/8401
In scope of KT-55082
This commit is contained in:
Nikita Bobko
2023-01-09 10:04:32 +01:00
parent 62b27b4613
commit 44b1cf6c46
14 changed files with 124 additions and 7 deletions
@@ -10,7 +10,10 @@ import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
/**
* The version of the metadata serialized by the compiler and deserialized by the compiler and reflection.
* This version includes the version of the core protobuf messages (metadata.proto) as well as JVM extensions (jvm_metadata.proto).
*/
*
* Please note that [JvmMetadataVersion] is different compared to other [BinaryVersion]s. The version bump **DOESN'T** obey [BinaryVersion]
* rules. Starting from Kotlin 1.4, [JvmMetadataVersion] major and minor tokens always match the compilers corresponding version tokens.
**/
class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean) : BinaryVersion(*versionArray) {
constructor(vararg numbers: Int) : this(numbers, isStrictSemantics = false)
+2
View File
@@ -18,6 +18,8 @@ package org.jetbrains.kotlin.metadata.builtins;
import "core/metadata/src/metadata.proto";
// Changes to this proto are tracked by BuiltInsBinaryVersion version. See BuiltInsBinaryVersion KDoc.
option java_outer_classname = "BuiltInsProtoBuf";
option optimize_for = LITE_RUNTIME;
+4
View File
@@ -18,6 +18,10 @@ package org.jetbrains.kotlin.metadata;
import "core/metadata/src/ext_options.proto";
// Changes to this proto are tracked by versions of proto files that include `import metadata.proto`.
// Namely BuiltInsBinaryVersion, JvmMetadataVersion, JsMetadataVersion, KlibMetadataVersion, and probably something else.
// See their KDocs.
option java_outer_classname = "ProtoBuf";
option optimize_for = LITE_RUNTIME;
@@ -10,8 +10,15 @@ import java.io.DataInputStream
import java.io.InputStream
/**
* The version of the format in which the .kotlin_builtins file is stored. This version also includes the version
* of the core protobuf messages (metadata.proto).
* The version of the format in which the `.kotlin_builtins` (`builtins.proto`) file is stored. This version also includes the version
* of the core protobuf messages (`metadata.proto`).
*
* This version must be bumped when:
* - Incompatible changes are made in `builtins.proto`
* - Incompatible changes are made in `metadata.proto`
* - Incompatible changes are made in builtins serialization/deserialization logic
*
* The version bump must obey [org.jetbrains.kotlin.metadata.deserialization.BinaryVersion] rules (See `BinaryVersion` KDoc).
*/
class BuiltInsBinaryVersion(vararg numbers: Int) : BinaryVersion(*numbers) {
override fun isCompatibleWithCurrentCompilerVersion(): Boolean =