Remove obsolete FallbackPaths
This commit is contained in:
+3
-9
@@ -132,24 +132,18 @@ public class BuiltInsSerializer(private val dependOnOldBuiltIns: Boolean) {
|
||||
val fragments = packageView.fragments
|
||||
val packageProto = DescriptorSerializer.createTopLevel(extension).packageProto(fragments).build()
|
||||
packageProto.writeTo(packageStream)
|
||||
write(destDir, BuiltInsSerializedResourcePaths.getPackageFilePath(fqName), packageStream,
|
||||
BuiltInsSerializedResourcePaths.fallbackPaths.getPackageFilePath(fqName))
|
||||
write(destDir, BuiltInsSerializedResourcePaths.getPackageFilePath(fqName), packageStream)
|
||||
|
||||
val nameStream = ByteArrayOutputStream()
|
||||
extension.stringTable.serializeTo(nameStream)
|
||||
write(destDir, BuiltInsSerializedResourcePaths.getStringTableFilePath(fqName), nameStream,
|
||||
BuiltInsSerializedResourcePaths.fallbackPaths.getStringTableFilePath(fqName))
|
||||
write(destDir, BuiltInsSerializedResourcePaths.getStringTableFilePath(fqName), nameStream)
|
||||
}
|
||||
|
||||
private fun write(destDir: File, fileName: String, stream: ByteArrayOutputStream, legacyFileName: String? = null) {
|
||||
private fun write(destDir: File, fileName: String, stream: ByteArrayOutputStream) {
|
||||
totalSize += stream.size()
|
||||
totalFiles++
|
||||
File(destDir, fileName).parentFile.mkdirs()
|
||||
File(destDir, fileName).writeBytes(stream.toByteArray())
|
||||
|
||||
legacyFileName?.let { fileName ->
|
||||
File(destDir, fileName).writeBytes(stream.toByteArray())
|
||||
}
|
||||
}
|
||||
|
||||
private fun serializeClass(
|
||||
|
||||
+5
-16
@@ -20,23 +20,12 @@ import com.google.protobuf.ExtensionRegistryLite
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
public abstract class SerializedResourcePaths {
|
||||
public abstract val extensionRegistry: ExtensionRegistryLite
|
||||
abstract class SerializedResourcePaths {
|
||||
abstract val extensionRegistry: ExtensionRegistryLite
|
||||
|
||||
public abstract fun getClassMetadataPath(classId: ClassId): String
|
||||
abstract fun getClassMetadataPath(classId: ClassId): String
|
||||
|
||||
public abstract fun getPackageFilePath(fqName: FqName): String
|
||||
abstract fun getPackageFilePath(fqName: FqName): String
|
||||
|
||||
public abstract fun getStringTableFilePath(fqName: FqName): String
|
||||
|
||||
// TODO: remove this after M12
|
||||
public object FallbackPaths {
|
||||
public fun getPackageFilePath(fqName: FqName): String =
|
||||
fqName.asString().replace('.', '/') + "/.kotlin_package"
|
||||
|
||||
public fun getStringTableFilePath(fqName: FqName): String =
|
||||
fqName.asString().replace('.', '/') + "/.kotlin_string_table"
|
||||
}
|
||||
|
||||
public val fallbackPaths: FallbackPaths = FallbackPaths
|
||||
abstract fun getStringTableFilePath(fqName: FqName): String
|
||||
}
|
||||
|
||||
+1
-4
@@ -37,10 +37,7 @@ public abstract class DeserializedPackageFragment(
|
||||
private val loadResource: (path: String) -> InputStream?
|
||||
) : PackageFragmentDescriptorImpl(module, fqName) {
|
||||
|
||||
val nameResolver = NameResolverImpl.read(
|
||||
loadResource(serializedResourcePaths.getStringTableFilePath(fqName))
|
||||
?: loadResourceSure(serializedResourcePaths.fallbackPaths.getStringTableFilePath(fqName))
|
||||
)
|
||||
val nameResolver = NameResolverImpl.read(loadResourceSure(serializedResourcePaths.getStringTableFilePath(fqName)))
|
||||
|
||||
protected var components: DeserializationComponents by Delegates.notNull()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user