Drop serialization of old binary built-in files (.kotlin_class, .kotlin_package)

This commit is contained in:
Alexander Udalov
2016-01-12 21:25:42 +03:00
parent c39cec4869
commit c81d76414f
3 changed files with 8 additions and 22 deletions
@@ -38,7 +38,6 @@ import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor
import org.jetbrains.kotlin.descriptors.PackageViewDescriptor
import org.jetbrains.kotlin.name.Name
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.JvmPlatformParameters
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
@@ -120,7 +119,7 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
) {
private val fqName = packageView.fqName
private val fragments = packageView.fragments
private val builtinsMessage = BuiltInsProtoBuf.BuiltIns.newBuilder()
private val proto = BuiltInsProtoBuf.BuiltIns.newBuilder()
private val extension = BuiltInsSerializerExtension(fragments)
fun run() {
@@ -132,11 +131,7 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
private fun serializeClass(classDescriptor: ClassDescriptor) {
val classProto = DescriptorSerializer.createTopLevel(extension).classProto(classDescriptor).build()
val stream = ByteArrayOutputStream()
classProto.writeTo(stream)
write(BuiltInsSerializedResourcePaths.getClassMetadataPath(classDescriptor.classId), stream)
builtinsMessage.addClass(classProto)
proto.addClass(classProto)
serializeClasses(classDescriptor.unsubstitutedInnerClassesScope)
}
@@ -150,21 +145,13 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
}
private fun serializePackageFragments(fragments: List<PackageFragmentDescriptor>) {
val stream = ByteArrayOutputStream()
val packageProto = DescriptorSerializer.createTopLevel(extension).packageProto(fragments).build()
packageProto.writeTo(stream)
write(BuiltInsSerializedResourcePaths.getPackageFilePath(fqName), stream)
builtinsMessage.setPackage(packageProto)
proto.`package` = DescriptorSerializer.createTopLevel(extension).packageProto(fragments).build()
}
private fun serializeStringTable() {
val stream = ByteArrayOutputStream()
val (strings, qualifiedNames) = extension.stringTable.buildProto()
strings.writeDelimitedTo(stream)
qualifiedNames.writeDelimitedTo(stream)
write(BuiltInsSerializedResourcePaths.getStringTableFilePath(fqName), stream)
builtinsMessage.setStrings(strings)
builtinsMessage.setQualifiedNames(qualifiedNames)
proto.strings = strings
proto.qualifiedNames = qualifiedNames
}
private fun serializeBuiltInsFile() {
@@ -174,7 +161,7 @@ class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
writeInt(version.size)
version.forEach { writeInt(it) }
}
builtinsMessage.build().writeTo(stream)
proto.build().writeTo(stream)
write(BuiltInsSerializedResourcePaths.getBuiltInsFilePath(fqName), stream)
}
@@ -28,8 +28,7 @@ fun main(args: Array<String>) {
Usage: ... <destination dir> (<source dir>)+
Analyzes Kotlin sources found in the given source directories and serializes
found top-level declarations to <destination dir> (files such as *.kotlin_builtins,
as well as old files *.kotlin_string_table, *.kotlin_package, *.kotlin_class)"""
found top-level declarations to <destination dir> (*.kotlin_builtins files)"""
)
return
}
+1 -1
View File
@@ -22,7 +22,7 @@
<resource>
<directory>${basedir}/../../../dist/builtins</directory>
<includes>
<include>**/*.kotlin_*</include>
<include>**/*.kotlin_builtins</include>
</includes>
</resource>
</resources>