mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2026-06-19 19:00:14 +02:00
feat: Kotlin 2.x/K2, version catalog, serialization & coroutines modules, docs
v3.4 modernization (continued): - Migrate to Kotlin 2.x (K2); introduce gradle/libs.versions.toml version catalog; simplify the JS/Wasm/Node and iOS source-set wiring for the K2 hierarchy template. - Apply binary-compatibility-validator and Kover plugins. - New published module tree-structure-serialization: @Serializable TreeNodeDto with toDto()/toTreeNode() round-trip (kotlinx.serialization). - New published module tree-structure-coroutines: asFlow()/pre/post/levelOrderFlow() (kotlinx.coroutines Flow traversal). - Docs: README examples for Sequence/navigation/functional APIs, class-level KDoc (thread-safety/complexity), and a CHANGELOG.md. - Ignore subproject build/ directories. - Bump version to 3.4.0. All JVM tests green (core + both modules).
This commit is contained in:
@@ -1,19 +1,17 @@
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
|
||||
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmTargetDsl
|
||||
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
|
||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
|
||||
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform") version "1.9.24"
|
||||
id("org.jetbrains.dokka") version "1.9.20"
|
||||
id("com.vanniktech.maven.publish") version "0.34.0"
|
||||
alias(libs.plugins.kotlinMultiplatform)
|
||||
alias(libs.plugins.dokka)
|
||||
alias(libs.plugins.mavenPublish)
|
||||
alias(libs.plugins.binaryCompatibilityValidator)
|
||||
alias(libs.plugins.kover)
|
||||
signing
|
||||
}
|
||||
|
||||
val PUBLISH_GROUP_ID = "com.github.adriankuta"
|
||||
val PUBLISH_ARTIFACT_ID = "tree-structure" // base artifact; KMP will add -jvm, -ios*, etc.
|
||||
val PUBLISH_VERSION = "3.1.5"
|
||||
val PUBLISH_VERSION = "3.4.0"
|
||||
|
||||
val snapshot: String? by project
|
||||
|
||||
@@ -29,7 +27,10 @@ mavenPublishing {
|
||||
|
||||
pom {
|
||||
name.set("Tree Data Structure")
|
||||
description.set("Simple implementation to store object in tree structure.")
|
||||
description.set(
|
||||
"Lightweight n-ary tree data structure for Kotlin Multiplatform (JVM, JS, Wasm, iOS, " +
|
||||
"Native). DSL, pre/post/level-order traversal, lazy Sequence traversal, and pretty-print.",
|
||||
)
|
||||
url.set("https://github.com/AdrianKuta/Tree-Data-Structure")
|
||||
|
||||
licenses {
|
||||
@@ -54,28 +55,15 @@ mavenPublishing {
|
||||
}
|
||||
}
|
||||
|
||||
// No legacy publishing {} block or s01 repos — Central Portal handles it.
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(21))
|
||||
}
|
||||
}
|
||||
kotlin {
|
||||
jvmToolchain(21);
|
||||
jvm {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
jvmTarget = "21" // <- was "1.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
jvmToolchain(21)
|
||||
|
||||
jvm()
|
||||
|
||||
// JS targets (IR) for publishing
|
||||
js(IR) {
|
||||
browser()
|
||||
nodejs()
|
||||
@@ -87,21 +75,7 @@ kotlin {
|
||||
nodejs()
|
||||
}
|
||||
|
||||
rootProject.plugins.withType<NodeJsRootPlugin> {
|
||||
rootProject.extensions.getByType<NodeJsRootExtension>().nodeVersion = "22.0.0"
|
||||
}
|
||||
|
||||
kotlin.targets.withType<KotlinJsIrTarget> {
|
||||
if (name == "wasmJs") {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
(this as KotlinWasmTargetDsl).apply {
|
||||
nodejs {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// iOS targets
|
||||
// Apple targets
|
||||
iosX64()
|
||||
iosArm64()
|
||||
iosSimulatorArm64()
|
||||
@@ -109,7 +83,7 @@ kotlin {
|
||||
// Native host target
|
||||
val hostOs = System.getProperty("os.name")
|
||||
val isMingwX64 = hostOs.startsWith("Windows")
|
||||
val nativeTarget = when {
|
||||
when {
|
||||
hostOs == "Mac OS X" -> macosX64("native")
|
||||
hostOs == "Linux" -> linuxX64("native")
|
||||
isMingwX64 -> mingwX64("native")
|
||||
@@ -117,25 +91,8 @@ kotlin {
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting
|
||||
val commonTest by getting { dependencies { implementation(kotlin("test")) } }
|
||||
val jvmMain by getting
|
||||
val jvmTest by getting
|
||||
val jsMain by getting
|
||||
val jsTest by getting
|
||||
val wasmJsMain by getting
|
||||
val wasmJsTest by getting
|
||||
val nativeMain by getting
|
||||
val nativeTest by getting
|
||||
|
||||
// Shared iOS source sets
|
||||
val iosMain by creating { dependsOn(commonMain) }
|
||||
val iosTest by creating { dependsOn(commonTest) }
|
||||
val iosX64Main by getting { dependsOn(iosMain) }
|
||||
val iosArm64Main by getting { dependsOn(iosMain) }
|
||||
val iosSimulatorArm64Main by getting { dependsOn(iosMain) }
|
||||
val iosX64Test by getting { dependsOn(iosTest) }
|
||||
val iosArm64Test by getting { dependsOn(iosTest) }
|
||||
val iosSimulatorArm64Test by getting { dependsOn(iosTest) }
|
||||
commonTest.dependencies {
|
||||
implementation(kotlin("test"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user