[Generator] Reference generator class in generated code files
This commit is contained in:
committed by
Space Team
parent
74ac48851a
commit
68a9b9c312
@@ -6,13 +6,14 @@
|
||||
package org.jetbrains.kotlin.generators.builtins.numbers.primitives
|
||||
|
||||
import java.io.File
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
private fun String.shift(): String {
|
||||
return this.split(END_LINE).joinToString(separator = END_LINE) { if (it.isEmpty()) it else " $it" }
|
||||
}
|
||||
|
||||
internal fun file(init: FileBuilder.() -> Unit): FileBuilder {
|
||||
val file = FileBuilder()
|
||||
internal fun file(builtBy: KClass<*>, init: FileBuilder.() -> Unit): FileBuilder {
|
||||
val file = FileBuilder(builtBy.qualifiedName!!)
|
||||
file.init()
|
||||
return file
|
||||
}
|
||||
@@ -76,7 +77,7 @@ internal abstract class AnnotatedAndDocumented {
|
||||
}
|
||||
}
|
||||
|
||||
internal class FileBuilder : PrimitiveBuilder {
|
||||
internal class FileBuilder(private val builtBy: String) : PrimitiveBuilder {
|
||||
private val suppresses: MutableList<String> = mutableListOf()
|
||||
private val imports: MutableList<String> = mutableListOf()
|
||||
private val fileComments: MutableList<String> = mutableListOf()
|
||||
@@ -105,6 +106,7 @@ internal class FileBuilder : PrimitiveBuilder {
|
||||
appendLine(File("license/COPYRIGHT_HEADER.txt").readText())
|
||||
appendLine()
|
||||
appendLine("// Auto-generated file. DO NOT EDIT!")
|
||||
appendLine("// Generated by $builtBy")
|
||||
appendLine()
|
||||
|
||||
if (suppresses.isNotEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user