This commit is contained in:
Alexander Nozik 2023-08-21 18:26:17 +03:00
parent 8a864f97a3
commit c249dc5ae4
3 changed files with 33 additions and 25 deletions

View File

@ -1,25 +1,25 @@
[versions]
tools = "0.14.9-kotlin-1.9.0"
tools = "0.14.10-kotlin-1.9.0"
kotlin = "1.9.0"
atomicfu = "0.20.2"
binary-compatibility-validator = "0.13.1"
changelog = "2.0.0"
dokka = "1.8.10"
kotlin-jupyter = "0.11.0-360"
kotlinx-benchmark = "0.4.7"
atomicfu = "0.22.0"
binary-compatibility-validator = "0.13.2"
changelog = "2.1.2"
dokka = "1.8.20"
kotlin-jupyter = "0.12.0-43"
kotlinx-benchmark = "0.4.9"
kotlinx-cli = "0.3.5"
kotlinx-coroutines = "1.7.2"
kotlinx-coroutines = "1.7.3"
kotlinx-datetime = "0.4.0"
kotlinx-html = "0.8.0"
kotlinx-html = "0.9.1"
kotlinx-knit = "0.4.0"
kotlinx-nodejs = "0.0.7"
kotlinx-serialization = "1.5.1"
ktor = "2.3.0"
xmlutil = "0.86.0"
ktor = "2.3.3"
xmlutil = "0.86.1"
yamlkt = "0.13.0"
jsBom = "1.0.0-pre.546"
jsBom = "1.0.0-pre.618"
junit = "5.9.3"
compose = "1.4.0"
compose = "1.5.0-rc01"
logback = "1.4.7"
[libraries]

View File

@ -205,17 +205,18 @@ public open class KScienceProjectPlugin : Plugin<Project> {
val modulesString = buildString {
subprojects.forEach { subproject ->
// val name = subproject.name
subproject.extensions.findByType<KScienceReadmeExtension>()?.let { ext ->
val path = subproject.path.replaceFirst(":", "").replace(":", "/")
appendLine("\n### [$path]($path)")
appendLine("> ${ext.description}")
appendLine(">\n> **Maturity**: ${ext.maturity}")
val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/")
if (featureString.isNotBlank()) {
appendLine(">\n> **Features:**")
appendLine(featureString)
subproject.extensions.findByType<KScienceReadmeExtension>()
?.let { ext: KScienceReadmeExtension ->
val path = subproject.path.replaceFirst(":", "").replace(":", "/")
appendLine("\n### [$path]($path)")
ext.description?.let { appendLine("> ${ext.description}") }
appendLine(">\n> **Maturity**: ${ext.maturity}")
val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/")
if (featureString.isNotBlank()) {
appendLine(">\n> **Features:**")
appendLine(featureString)
}
}
}
}
}

View File

@ -10,6 +10,7 @@ import kotlinx.html.stream.createHTML
import kotlinx.validation.ApiValidationExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.findByType
import org.intellij.lang.annotations.Language
import java.io.File
import java.io.StringWriter
import kotlin.collections.component1
@ -32,7 +33,8 @@ private fun Template.processToString(args: Map<String, Any?>): String {
public class KScienceReadmeExtension(public val project: Project) {
public var description: String = project.description ?: ""
public var description: String? = null
get() = field ?: project.description
public var maturity: Maturity = Maturity.EXPERIMENTAL
set(value) {
@ -93,7 +95,12 @@ public class KScienceReadmeExtension(public val project: Project) {
/**
* A plain readme feature with description
*/
public fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
public fun feature(
id: String,
@Language("File") ref: String? = null,
name: String = id,
description: () -> String,
) {
features += Feature(id, description(), ref, name)
}