Serialize .kotlin_metadata binary files per source file
Do not serialize everything in the same package to the same file (as is done for built-ins) because this approach is unfriendly to incremental compilation, which is going to be supported in the future. Instead, similarly to JVM serialize each class to its own file, and each source file with top-level callables/typealiases to its own file. E.g. if a file named test.kt contains a class Foo and some functions/properties, the output will contain two files: TestKt.kotlin_metadata and Foo.kotlin_metadata. Each one of this files contains the serialized BuiltIns message (see builtins.proto)
This commit is contained in:
@@ -495,17 +495,6 @@ class DescriptorSerializer private constructor(
|
||||
return builder
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun packageProto(
|
||||
fragments: Collection<PackageFragmentDescriptor>,
|
||||
skip: (DeclarationDescriptor) -> Boolean = { false }
|
||||
): ProtoBuf.Package.Builder {
|
||||
val members = fragments
|
||||
.flatMap { fragment -> DescriptorUtils.getAllDescriptors(fragment.getMemberScope()) }
|
||||
.filter { !skip(it) }
|
||||
return packagePartProto(members)
|
||||
}
|
||||
|
||||
fun packagePartProto(members: Collection<DeclarationDescriptor>): ProtoBuf.Package.Builder {
|
||||
val builder = ProtoBuf.Package.newBuilder()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user