Drop serialization of old binary built-in files (.kotlin_class, .kotlin_package)
This commit is contained in:
+6
-19
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
|
|||||||
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
|
||||||
import org.jetbrains.kotlin.name.Name
|
import org.jetbrains.kotlin.name.Name
|
||||||
import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
import org.jetbrains.kotlin.resolve.CompilerEnvironment
|
||||||
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
|
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade
|
import org.jetbrains.kotlin.resolve.jvm.JvmAnalyzerFacade
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
import org.jetbrains.kotlin.resolve.jvm.JvmPlatformParameters
|
||||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||||
@@ -120,7 +119,7 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
|||||||
) {
|
) {
|
||||||
private val fqName = packageView.fqName
|
private val fqName = packageView.fqName
|
||||||
private val fragments = packageView.fragments
|
private val fragments = packageView.fragments
|
||||||
private val builtinsMessage = BuiltInsProtoBuf.BuiltIns.newBuilder()
|
private val proto = BuiltInsProtoBuf.BuiltIns.newBuilder()
|
||||||
private val extension = BuiltInsSerializerExtension(fragments)
|
private val extension = BuiltInsSerializerExtension(fragments)
|
||||||
|
|
||||||
fun run() {
|
fun run() {
|
||||||
@@ -132,11 +131,7 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
|||||||
|
|
||||||
private fun serializeClass(classDescriptor: ClassDescriptor) {
|
private fun serializeClass(classDescriptor: ClassDescriptor) {
|
||||||
val classProto = DescriptorSerializer.createTopLevel(extension).classProto(classDescriptor).build()
|
val classProto = DescriptorSerializer.createTopLevel(extension).classProto(classDescriptor).build()
|
||||||
|
proto.addClass(classProto)
|
||||||
val stream = ByteArrayOutputStream()
|
|
||||||
classProto.writeTo(stream)
|
|
||||||
write(BuiltInsSerializedResourcePaths.getClassMetadataPath(classDescriptor.classId), stream)
|
|
||||||
builtinsMessage.addClass(classProto)
|
|
||||||
|
|
||||||
serializeClasses(classDescriptor.unsubstitutedInnerClassesScope)
|
serializeClasses(classDescriptor.unsubstitutedInnerClassesScope)
|
||||||
}
|
}
|
||||||
@@ -150,21 +145,13 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun serializePackageFragments(fragments: List<PackageFragmentDescriptor>) {
|
private fun serializePackageFragments(fragments: List<PackageFragmentDescriptor>) {
|
||||||
val stream = ByteArrayOutputStream()
|
proto.`package` = DescriptorSerializer.createTopLevel(extension).packageProto(fragments).build()
|
||||||
val packageProto = DescriptorSerializer.createTopLevel(extension).packageProto(fragments).build()
|
|
||||||
packageProto.writeTo(stream)
|
|
||||||
write(BuiltInsSerializedResourcePaths.getPackageFilePath(fqName), stream)
|
|
||||||
builtinsMessage.setPackage(packageProto)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun serializeStringTable() {
|
private fun serializeStringTable() {
|
||||||
val stream = ByteArrayOutputStream()
|
|
||||||
val (strings, qualifiedNames) = extension.stringTable.buildProto()
|
val (strings, qualifiedNames) = extension.stringTable.buildProto()
|
||||||
strings.writeDelimitedTo(stream)
|
proto.strings = strings
|
||||||
qualifiedNames.writeDelimitedTo(stream)
|
proto.qualifiedNames = qualifiedNames
|
||||||
write(BuiltInsSerializedResourcePaths.getStringTableFilePath(fqName), stream)
|
|
||||||
builtinsMessage.setStrings(strings)
|
|
||||||
builtinsMessage.setQualifiedNames(qualifiedNames)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun serializeBuiltInsFile() {
|
private fun serializeBuiltInsFile() {
|
||||||
@@ -174,7 +161,7 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
|||||||
writeInt(version.size)
|
writeInt(version.size)
|
||||||
version.forEach { writeInt(it) }
|
version.forEach { writeInt(it) }
|
||||||
}
|
}
|
||||||
builtinsMessage.build().writeTo(stream)
|
proto.build().writeTo(stream)
|
||||||
write(BuiltInsSerializedResourcePaths.getBuiltInsFilePath(fqName), stream)
|
write(BuiltInsSerializedResourcePaths.getBuiltInsFilePath(fqName), stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ fun main(args: Array<String>) {
|
|||||||
Usage: ... <destination dir> (<source dir>)+
|
Usage: ... <destination dir> (<source dir>)+
|
||||||
|
|
||||||
Analyzes Kotlin sources found in the given source directories and serializes
|
Analyzes Kotlin sources found in the given source directories and serializes
|
||||||
found top-level declarations to <destination dir> (files such as *.kotlin_builtins,
|
found top-level declarations to <destination dir> (*.kotlin_builtins files)"""
|
||||||
as well as old files *.kotlin_string_table, *.kotlin_package, *.kotlin_class)"""
|
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<resource>
|
<resource>
|
||||||
<directory>${basedir}/../../../dist/builtins</directory>
|
<directory>${basedir}/../../../dist/builtins</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*.kotlin_*</include>
|
<include>**/*.kotlin_builtins</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user