0.10.6 with kotlin 1.6-RC2

This commit is contained in:
Alexander Nozik 2021-11-04 12:59:13 +03:00
parent e007ac9c7a
commit 5b88c2c5ad
5 changed files with 35 additions and 11 deletions

View File

@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added ### Added
- html builders for readme
### Changed ### Changed

View File

@ -33,6 +33,8 @@ dependencies {
implementation(libs.dokka.gradle) implementation(libs.dokka.gradle)
implementation(libs.kotlin.jupyter.gradle) implementation(libs.kotlin.jupyter.gradle)
implementation(libs.kotlin.serialization) implementation(libs.kotlin.serialization)
@Suppress("UnstableApiUsage")
implementation(libs.kotlinx.html)
implementation("org.tomlj:tomlj:1.0.0") implementation("org.tomlj:tomlj:1.0.0")
// // nexus publishing plugin // // nexus publishing plugin
// implementation("io.github.gradle-nexus:publish-plugin:1.1.0") // implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
@ -210,6 +212,6 @@ afterEvaluate {
} }
tasks.processResources.configure { tasks.processResources.configure {
duplicatesStrategy = org.gradle.api.file.DuplicatesStrategy.INCLUDE duplicatesStrategy = DuplicatesStrategy.INCLUDE
from("gradle/libs.versions.toml") from("gradle/libs.versions.toml")
} }

View File

@ -1,16 +1,16 @@
[versions] [versions]
tools = "0.10.5" tools = "0.10.6"
kotlin = "1.6.0-M1" kotlin = "1.6.0-RC2"
atomicfu = "0.16.2" atomicfu = "0.16.2"
binary-compatibility-validator = "0.7.1" binary-compatibility-validator = "0.7.1"
changelog = "1.3.0" changelog = "1.3.0"
dokka = "1.5.0" dokka = "1.5.0"
kotlin-jupyter = "0.10.0-227" kotlin-jupyter = "0.10.3-31"
kotlinx-benchmark = "0.3.1" kotlinx-benchmark = "0.3.1"
kotlinx-cli = "0.3.2" kotlinx-cli = "0.3.3"
kotlinx-collections-immutable = "0.3.4" kotlinx-collections-immutable = "0.3.4"
kotlinx-coroutines = "1.5.2" kotlinx-coroutines = "1.5.2"
kotlinx-datetime = "0.2.1" kotlinx-datetime = "0.3.1"
kotlinx-html = "0.7.3" kotlinx-html = "0.7.3"
kotlinx-knit = "0.2.3" kotlinx-knit = "0.2.3"
kotlinx-nodejs = "0.0.7" kotlinx-nodejs = "0.0.7"
@ -18,7 +18,7 @@ kotlinx-serialization = "1.3.0"
ktor = "1.6.3" ktor = "1.6.3"
xmlutil = "0.83.0" xmlutil = "0.83.0"
yamlkt = "0.10.2" yamlkt = "0.10.2"
jsBom = "0.0.1-pre.248-kotlin-1.5.31" jsBom = "0.0.1-pre.263-kotlin-1.5.31"
[libraries] [libraries]
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" } atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }

View File

@ -240,7 +240,7 @@ public open class KScienceProjectPlugin : Plugin<Project> {
//val patchChangelog by tasks.getting //val patchChangelog by tasks.getting
val release by tasks.creating { @Suppress("UNUSED_VARIABLE") val release by tasks.creating {
group = RELEASE_GROUP group = RELEASE_GROUP
description = "Publish development or production release based on version suffix" description = "Publish development or production release based on version suffix"
dependsOn(generateReadme) dependsOn(generateReadme)

View File

@ -1,16 +1,23 @@
package ru.mipt.npm.gradle package ru.mipt.npm.gradle
import groovy.text.SimpleTemplateEngine import groovy.text.SimpleTemplateEngine
import kotlinx.html.TagConsumer
import kotlinx.html.div
import kotlinx.html.stream.createHTML
import kotlinx.validation.ApiValidationExtension import kotlinx.validation.ApiValidationExtension
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.* import org.gradle.kotlin.dsl.findByType
import java.io.File import java.io.File
import kotlin.collections.component1
import kotlin.collections.component2
import kotlin.collections.set
public enum class Maturity { public enum class Maturity {
PROTOTYPE, PROTOTYPE,
EXPERIMENTAL, EXPERIMENTAL,
DEVELOPMENT, DEVELOPMENT,
STABLE STABLE,
DEPRECATED
} }
@ -48,6 +55,20 @@ public class KScienceReadmeExtension(public val project: Project) {
features += Feature(id, description(), ref, name) features += Feature(id, description(), ref, name)
} }
public fun featureWithHtml(
id: String,
ref: String? = null,
name: String = id,
htmlBuilder: TagConsumer<String>.() -> Unit,
) {
val text = createHTML().apply {
div("readme-feature") {
htmlBuilder()
}
}.finalize()
features += Feature(id, text, ref, name)
}
private val properties: MutableMap<String, () -> Any?> = mutableMapOf( private val properties: MutableMap<String, () -> Any?> = mutableMapOf(
"name" to { project.name }, "name" to { project.name },
"group" to { project.group }, "group" to { project.group },
@ -82,7 +103,7 @@ public class KScienceReadmeExtension(public val project: Project) {
/** /**
* Generate a markdown string listing features * Generate a markdown string listing features
*/ */
public fun featuresString(itemPrefix: String = " - ", pathPrefix: String = ""): String = buildString { internal fun featuresString(itemPrefix: String = " - ", pathPrefix: String = ""): String = buildString {
features.forEach { features.forEach {
appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}") appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}")
} }