@@ -49,6 +49,9 @@ fun generateKotlinGradleOptions(withPrinterToFile: (targetFile: File, Printer.()
49
49
commonOptions + additionalOptions)
50
50
}
51
51
52
+ println (" ### Attributes common for 'kotlin' and 'kotlin2js'\n " )
53
+ generateMarkdown(commonOptions + additionalOptions)
54
+
52
55
// generate jvm interface
53
56
val jvmInterfaceFqName = FqName (" org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptions" )
54
57
val jvmOptions = gradleOptions<K2JVMCompilerArguments >()
@@ -68,6 +71,9 @@ fun generateKotlinGradleOptions(withPrinterToFile: (targetFile: File, Printer.()
68
71
commonOptions + jvmOptions)
69
72
}
70
73
74
+ println (" \n ### Attributes specific for 'kotlin'\n " )
75
+ generateMarkdown(jvmOptions)
76
+
71
77
// generate js interface
72
78
val jsInterfaceFqName = FqName (" org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions" )
73
79
val jsOptions = gradleOptions<K2JSCompilerArguments >()
@@ -85,6 +91,9 @@ fun generateKotlinGradleOptions(withPrinterToFile: (targetFile: File, Printer.()
85
91
k2JsCompilerArgumentsFqName,
86
92
commonOptions + jsOptions)
87
93
}
94
+
95
+ println (" \n ### Attributes specific for 'kotlin2js'\n " )
96
+ generateMarkdown(jsOptions)
88
97
}
89
98
90
99
fun main (args : Array <String >) {
@@ -209,6 +218,23 @@ private inline fun Printer.withIndent(fn: Printer.()->Unit) {
209
218
popIndent()
210
219
}
211
220
221
+ private fun generateMarkdown (properties : List <KProperty1 <* , * >>) {
222
+ println (" | Name | Description | Possible values |Default value |" )
223
+ println (" |------|-------------|-----------------|--------------|" )
224
+ for (property in properties) {
225
+ val name = property.name
226
+ val description = property.findAnnotation<Argument >()!! .description
227
+ val possibleValues = property.gradleValues.possibleValues
228
+ val defaultValue = when (property.gradleDefaultValue) {
229
+ " null" -> " "
230
+ " emptyList()" -> " []"
231
+ else -> property.gradleDefaultValue
232
+ }
233
+
234
+ println (" | `$name ` | $description | ${possibleValues.orEmpty().joinToString()} | $defaultValue |" )
235
+ }
236
+ }
237
+
212
238
private val KProperty1 <* , * >.gradleValues: DefaultValues
213
239
get() = findAnnotation<GradleOption >()!! .value.objectInstance!!
214
240
0 commit comments