Compare commits

...
7 Commits
Author SHA1 Message Date
Adrian Kuta 6de95f7976 Release 3.1.5: remove debug println, drop worksheet leftover, modernize CI
- Remove stray println(child.value) from TreeNode.removeChild()
- Add regression test for removeChild() return value
- Delete leftover ExampleUnitTest.kt template test
- Remove Example.ws.kts worksheet and kotlin("script-runtime") from jvmMain
- Bump actions/checkout v2 -> v4 in CI workflows
- Update README install snippets to 3.1.5
- Bump version to 3.1.5
2026-06-06 13:03:00 +02:00
Adrian Kuta ea0b4fa95c Bump version to 3.1.4 2025-12-25 22:53:43 +01:00
Adrian Kuta 9d52b152bd Merge pull request #31 from AdrianKuta/develop
Develop
2025-12-25 22:46:09 +01:00
Adrian Kuta 0fc7b16664 feat: Update Kotlin and JS dependencies and add Wasm target (#30)
- Upgraded Kotlin from `1.9.20` to `1.9.24`.
- Added a new Kotlin/Wasm target (`wasmJs`) for both browser and Node.js environments.
- Updated numerous JavaScript dependencies in `yarn.lock`, including major upgrades for `webpack`, `terser`, and various `@webpack-cli`, `@jridgewell`, and `@webassemblyjs` packages.
- Configured the Node.js version to `22.0.0` for JS and Wasm targets.
2025-12-25 22:43:29 +01:00
Adrian Kuta d3086a5ced chore: Remove Dependabot configuration
Removes the `.github/dependabot.yml` file, disabling the Dependabot version update checks for the project.
2025-12-25 22:43:17 +01:00
Adrian Kuta 2071084964 Bump version to 3.1.3 2025-12-25 22:41:48 +01:00
Adrian Kuta f51964831a feat: Ignore .idea directory
- Adds the entire `.idea/` directory to `.gitignore` to prevent IDE-specific files from being committed.
2025-12-25 22:29:06 +01:00
21 changed files with 373 additions and 532 deletions
-11
View File
@@ -1,11 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Set up JDK 21 - name: Set up JDK 21
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out code - name: Check out code
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Set up JDK 21 - name: Set up JDK 21
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
+1
View File
@@ -16,3 +16,4 @@
/.idea/compiler.xml /.idea/compiler.xml
/.idea/jarRepositories.xml /.idea/jarRepositories.xml
/.idea/deploymentTargetDropDown.xml /.idea/deploymentTargetDropDown.xml
/.idea/
-4
View File
@@ -1,4 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
artifacts
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>
-45
View File
@@ -1,45 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="false" module="true" />
<package name="android" withSubpackages="true" static="true" />
<package name="androidx" withSubpackages="true" static="true" />
<package name="com" withSubpackages="true" static="true" />
<package name="junit" withSubpackages="true" static="true" />
<package name="net" withSubpackages="true" static="true" />
<package name="org" withSubpackages="true" static="true" />
<package name="java" withSubpackages="true" static="true" />
<package name="javax" withSubpackages="true" static="true" />
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="android" withSubpackages="true" static="false" />
<emptyLine />
<package name="androidx" withSubpackages="true" static="false" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="junit" withSubpackages="true" static="false" />
<emptyLine />
<package name="net" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
<emptyLine />
</value>
</option>
</JavaCodeStyleSettings>
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>
-5
View File
@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
-18
View File
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="ReplaceUntilWithRangeUntil" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
</profile>
</component>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="StudioBotProjectSettings">
<option name="shareContext" value="OptedIn" />
</component>
</project>
Generated
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+3 -3
View File
@@ -16,14 +16,14 @@ Gradle (Kotlin DSL):
```kotlin ```kotlin
// commonMain for KMP projects, or any sourceSet/module where you need it // commonMain for KMP projects, or any sourceSet/module where you need it
dependencies { dependencies {
implementation("com.github.adriankuta:tree-structure:3.1.1") // see badge above for the latest version implementation("com.github.adriankuta:tree-structure:3.1.5") // see badge above for the latest version
} }
``` ```
Gradle (Groovy): Gradle (Groovy):
```groovy ```groovy
dependencies { dependencies {
implementation "com.github.adriankuta:tree-structure:3.1.1" // see badge above for the latest implementation "com.github.adriankuta:tree-structure:3.1.5" // see badge above for the latest
} }
``` ```
@@ -32,7 +32,7 @@ Maven:
<dependency> <dependency>
<groupId>com.github.adriankuta</groupId> <groupId>com.github.adriankuta</groupId>
<artifactId>tree-structure</artifactId> <artifactId>tree-structure</artifactId>
<version>3.1.1</version> <version>3.1.5</version>
</dependency> </dependency>
``` ```
+30 -4
View File
@@ -1,7 +1,11 @@
import org.jetbrains.kotlin.konan.properties.Properties 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
plugins { plugins {
kotlin("multiplatform") version "1.9.20" kotlin("multiplatform") version "1.9.24"
id("org.jetbrains.dokka") version "1.9.20" id("org.jetbrains.dokka") version "1.9.20"
id("com.vanniktech.maven.publish") version "0.34.0" id("com.vanniktech.maven.publish") version "0.34.0"
signing signing
@@ -9,7 +13,7 @@ plugins {
val PUBLISH_GROUP_ID = "com.github.adriankuta" val PUBLISH_GROUP_ID = "com.github.adriankuta"
val PUBLISH_ARTIFACT_ID = "tree-structure" // base artifact; KMP will add -jvm, -ios*, etc. val PUBLISH_ARTIFACT_ID = "tree-structure" // base artifact; KMP will add -jvm, -ios*, etc.
val PUBLISH_VERSION = "3.1.2" val PUBLISH_VERSION = "3.1.5"
val snapshot: String? by project val snapshot: String? by project
@@ -77,6 +81,26 @@ kotlin {
nodejs() nodejs()
} }
@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
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 // iOS targets
iosX64() iosX64()
iosArm64() iosArm64()
@@ -95,10 +119,12 @@ kotlin {
sourceSets { sourceSets {
val commonMain by getting val commonMain by getting
val commonTest by getting { dependencies { implementation(kotlin("test")) } } val commonTest by getting { dependencies { implementation(kotlin("test")) } }
val jvmMain by getting { dependencies { implementation(kotlin("script-runtime")) } } val jvmMain by getting
val jvmTest by getting val jvmTest by getting
val jsMain by getting val jsMain by getting
val jsTest by getting val jsTest by getting
val wasmJsMain by getting
val wasmJsTest by getting
val nativeMain by getting val nativeMain by getting
val nativeTest by getting val nativeTest by getting
+323 -361
View File
File diff suppressed because it is too large Load Diff
@@ -62,7 +62,6 @@ open class TreeNode<T>(val value: T, var treeIterator: TreeNodeIterators = PreOr
* @return `true` if the node has been successfully removed; `false` if it was not present in the tree. * @return `true` if the node has been successfully removed; `false` if it was not present in the tree.
*/ */
fun removeChild(child: TreeNode<T>): Boolean { fun removeChild(child: TreeNode<T>): Boolean {
println(child.value)
val removed = child._parent?._children?.remove(child) val removed = child._parent?._children?.remove(child)
child._parent = null child._parent = null
return removed ?: false return removed ?: false
@@ -1,16 +0,0 @@
package com.github.adriankuta.datastructure.tree
import kotlin.test.Test
import kotlin.test.assertEquals
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
@@ -4,7 +4,9 @@ import com.github.adriankuta.datastructure.tree.iterators.TreeNodeIterators
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertContentEquals import kotlin.test.assertContentEquals
import kotlin.test.assertEquals import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNull import kotlin.test.assertNull
import kotlin.test.assertTrue
class TreeNodeTest { class TreeNodeTest {
@@ -62,6 +64,18 @@ class TreeNodeTest {
) )
} }
@Test
fun removeChildReturnsTrueWhenPresentFalseOtherwise() {
val root = TreeNode("Root")
val child = TreeNode("Child")
root.addChild(child)
assertTrue(root.removeChild(child), "Removing a present child returns true")
assertFalse(root.removeChild(child), "Removing an already-removed child returns false")
assertNull(child.parent, "Removed child is detached from its parent")
assertEquals(emptyList(), root.children)
}
@Test @Test
fun clearTest() { fun clearTest() {
val root = TreeNode("Root") val root = TreeNode("Root")
-14
View File
@@ -1,14 +0,0 @@
import com.github.adriankuta.datastructure.tree.tree
val root =
tree("World") {
child("North America") {
child("USA")
}
child("Europe") {
child("Poland")
child("Germany")
}
}
print(root.prettyString())