Move core protobuf schemas to 'metadata' and 'metadata.jvm'

This commit is contained in:
Alexander Udalov
2018-03-01 12:07:29 +01:00
parent 368af867b8
commit 575a388b11
22 changed files with 416 additions and 417 deletions
+131
View File
@@ -0,0 +1,131 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.serialization.jvm;
import "core/metadata/src/ext_options.proto";
import "core/metadata/src/metadata.proto";
option java_outer_classname = "JvmProtoBuf";
option optimize_for = LITE_RUNTIME;
message StringTableTypes {
message Record {
// The number of times this record should be repeated; this is used to collapse identical subsequent records in the list
optional int32 range = 1 [default = 1];
// Index of the predefined constant. If this field is present, the associated string is ignored
optional int32 predefined_index = 2;
// A string which should be used. If this field is present, both the associated string and the predefined string index are ignored
optional string string = 6;
enum Operation {
NONE = 0;
// replaceAll('$', '.')
// java/util/Map$Entry -> java/util/Map.Entry;
INTERNAL_TO_CLASS_ID = 1;
// substring(1, length - 1) and then replaceAll('$', '.')
// Ljava/util/Map$Entry; -> java/util/Map.Entry
DESC_TO_CLASS_ID = 2;
}
// Perform a described operation on the string
optional Operation operation = 3 [default = NONE];
// If this field is present, the "substring" operation must be performed with the first element of this list as the start index,
// and the second element as the end index.
// If an operation is not NONE, it's applied _after_ this substring operation
repeated int32 substring_index = 4 [packed = true];
// If this field is present, the "replaceAll" operation must be performed with the first element of this list as the code point
// of the character to replace, and the second element as the code point of the replacement character
repeated int32 replace_char = 5 [packed = true];
}
repeated Record record = 1;
// Indices of strings which are names of local classes or anonymous objects
repeated int32 local_name = 5 [packed = true];
}
message JvmMethodSignature {
optional int32 name = 1 [(string_id_in_table) = true];
// JVM descriptor of the method, e.g. '(Ljava/util/List;)[Ljava/lang/Object;'
optional int32 desc = 2 [(string_id_in_table) = true];
}
message JvmFieldSignature {
optional int32 name = 1 [(string_id_in_table) = true];
// JVM descriptor of the field type, e.g. 'Ljava/lang/String;'
optional int32 desc = 2 [(string_id_in_table) = true];
}
message JvmPropertySignature {
optional JvmFieldSignature field = 1;
// Annotations on properties are written on a synthetic method with this signature
optional JvmMethodSignature synthetic_method = 2;
optional JvmMethodSignature getter = 3;
optional JvmMethodSignature setter = 4;
}
extend Constructor {
optional JvmMethodSignature constructor_signature = 100;
}
extend Function {
optional JvmMethodSignature method_signature = 100;
// For lambdas from bodies of inline functions copied to the use site, the JVM internal name of the original
// lambda class this class is copied from
optional int32 lambda_class_origin_name = 101 [(string_id_in_table) = true];
}
extend Property {
optional JvmPropertySignature property_signature = 100;
}
extend Type {
repeated Annotation type_annotation = 100;
optional bool is_raw = 101;
}
extend TypeParameter {
repeated Annotation type_parameter_annotation = 100;
}
extend Class {
// If absent, assumed to be JvmAbi.DEFAULT_MODULE_NAME
optional int32 class_module_name = 101 [(string_id_in_table) = true];
repeated Property class_local_variable = 102;
// For anonymous objects from bodies of inline functions copied to the use site, the JVM internal name of the original
// anonymous object this class is copied from
optional int32 anonymous_object_origin_name = 103 [(string_id_in_table) = true];
}
extend Package {
optional int32 package_module_name = 101 [(string_id_in_table) = true];
repeated Property package_local_variable = 102;
}
+70
View File
@@ -0,0 +1,70 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.serialization.jvm;
import "core/metadata/src/metadata.proto";
option java_outer_classname = "JvmModuleProtoBuf";
option optimize_for = LITE_RUNTIME;
message Module {
// Names of .class files for each package
repeated PackageParts package_parts = 1;
// Names of .kotlin_metadata files for each package
repeated PackageParts metadata_parts = 2;
// Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
// The names here are dot-separated, e.g. "org.foo.bar"
repeated string jvm_package_name = 3;
optional StringTable string_table = 4;
optional QualifiedNameTable qualified_name_table = 5;
// Annotations on the whole module
repeated Annotation annotation = 6;
}
message PackageParts {
required string package_fq_name = 1;
// Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
// (multi-file facades are not present in this list, they are defined below). Only files whose JVM package name is equal to the
// Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
repeated string short_class_name = 2;
// For each name in short_class_name, index of the name of the corresponding multi-file facade class in multifile_facade_short_name + 1,
// or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
// (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
repeated int32 multifile_facade_short_name_id = 3 [packed = true];
// Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
repeated string multifile_facade_short_name = 4;
// Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
// The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
repeated string class_with_jvm_package_name_short_name = 5;
// For each name in class_with_jvm_package_name_short_name, the index (into PackageTable#jvm_package_name) of the JVM package name.
// This list should have at least one element, otherwise classes with JVM package names are going to be ignored completely.
//
// If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
// of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
// when a bunch of files from the same Kotlin package have the same JVM package name.
repeated int32 class_with_jvm_package_name_package_id = 6 [packed = true];
}
File diff suppressed because it is too large Load Diff