[IR] Support specifying kdocs for properties in IR tree generator

This commit is contained in:
Sergej Jaskiewicz
2023-03-16 14:55:36 +01:00
committed by Space Team
parent b3e5612f79
commit 396451b5da
3 changed files with 8 additions and 0 deletions
@@ -91,6 +91,8 @@ sealed class FieldConfig(
var printProperty = true var printProperty = true
var strictCastInTransformChildren = false var strictCastInTransformChildren = false
var kdoc: String? = null
var generationCallback: (PropertySpec.Builder.() -> Unit)? = null var generationCallback: (PropertySpec.Builder.() -> Unit)? = null
override fun toString() = name override fun toString() = name
@@ -84,6 +84,8 @@ sealed class Field(
var needsDescriptorApiAnnotation = false var needsDescriptorApiAnnotation = false
abstract val transformable: Boolean abstract val transformable: Boolean
val kdoc = config?.kdoc
val printProperty = config?.printProperty ?: true val printProperty = config?.printProperty ?: true
val generationCallback = config?.generationCallback val generationCallback = config?.generationCallback
@@ -67,6 +67,10 @@ fun printElements(generationPath: File, model: Model) = sequence {
addAnnotation(descriptorApiAnnotation) addAnnotation(descriptorApiAnnotation)
} }
field.kdoc?.let {
addKdoc(it)
}
field.generationCallback?.invoke(this) field.generationCallback?.invoke(this)
}.build()) }.build())
} }