JS PIR: move PIR proto messages to a separate file
This commit is contained in:
committed by
TeamCityServer
parent
8fe8419ad4
commit
923303c2c1
+1
-1
@@ -20,7 +20,7 @@ fun main() {
|
||||
generateTypeParameter()
|
||||
generateValueParameter()
|
||||
|
||||
updateKotlinIrProto()
|
||||
generateKotlinPirCarriersProto()
|
||||
generateCarrierDeserializer()
|
||||
generateCarrierSerializer()
|
||||
}
|
||||
|
||||
+13
-13
@@ -661,27 +661,27 @@ internal object PersistentIrGenerator {
|
||||
File(prefix + path).writeText(content)
|
||||
}
|
||||
|
||||
fun updateKotlinIrProto() {
|
||||
val file = File("compiler/ir/serialization.common/src/KotlinIr.proto")
|
||||
fun generateKotlinPirCarriersProto() {
|
||||
val file = File("compiler/ir/serialization.common/src/KotlinPirCarriers.proto")
|
||||
|
||||
if (!file.exists()) throw IllegalStateException("KotlinIr.proto file not found!")
|
||||
val sb = StringBuilder("""
|
||||
syntax = "proto2";
|
||||
package org.jetbrains.kotlin.backend.common.serialization.proto;
|
||||
|
||||
val lines = file.readText().lines()
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "KotlinIr";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
val start = lines.indexOf("// PIR GENERATOR START")
|
||||
if (start < 0) throw IllegalStateException("Couldn't find the '// PIR GENERATOR START' line. Don't know where to write generated messages.")
|
||||
|
||||
val end = lines.indexOf("// PIR GENERATOR END")
|
||||
if (end < 0) throw IllegalStateException("Couldn't find the '// PIR GENERATOR END' line. Don't know where to write generated messages.")
|
||||
|
||||
val sb = StringBuilder(lines.subList(0, start + 1).joinToString(separator = "\n"))
|
||||
import "compiler/ir/serialization.common/src/KotlinIr.proto";
|
||||
|
||||
// Auto-generated by compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/persistentIrGenerator/Main.kt. DO NOT EDIT!
|
||||
|
||||
""".trimIndent())
|
||||
|
||||
for (m in protoMessages) {
|
||||
sb.append("\n").append(m)
|
||||
}
|
||||
|
||||
sb.append("\n").append(lines.subList(end, lines.size).joinToString(separator = "\n"))
|
||||
|
||||
file.writeText(sb.toString())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user