feat: add Android target and default TreeNodeRow to tree-structure-compose (#39) (#48)

Add the `android` target to the Compose Multiplatform library and a sensible
default renderer, so the largest Compose audience is a first-class consumer.

- Core `tree-structure` and `tree-structure-compose` now build and publish an
  `-android` variant (compileSdk 35, minSdk 21). The core needs it too: its
  inline `tree { }` DSL is built per target, and Android consumers (JVM 11/17)
  cannot inline a JVM-21 build.
- `TreeNodeRow`: a foundation-only default node row (clickable, indented, with a
  `▾`/`▸` marker, no Material dependency), plus a no-content `LazyTree(root,
  label = …)` overload that uses it. The existing lambda overload is unchanged.
- New `samples` Android app module demonstrating `LazyTree` + `@Preview`
  (not published; excluded from API validation).
- Toolchain: Gradle wrapper 8.5 -> 8.10.2, Android Gradle Plugin 8.7.2.
- binary-compatibility-validator now emits per-target dumps (api/jvm, api/android)
  for the two multi-JVM-target modules; CI assembles the Android outputs.
This commit is contained in:
2026-06-08 21:43:05 +02:00
committed by GitHub
parent 1fce412815
commit dc59476b10
19 changed files with 490 additions and 11 deletions

View File

@@ -7,6 +7,11 @@ plugins {
alias(libs.plugins.binaryCompatibilityValidator)
alias(libs.plugins.kover)
signing
alias(libs.plugins.androidLibrary)
// Loaded once here (with a known version) so the Android application/library variants can be
// applied across subprojects without the "already on the classpath with an unknown version" clash.
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.kotlinAndroid) apply false
}
val PUBLISH_GROUP_ID = "com.github.adriankuta"
@@ -57,11 +62,13 @@ mavenPublishing {
repositories {
mavenCentral()
google()
}
apiValidation {
// :samples is a dev-facing examples module, not a published artifact, so it has no .api dump.
// Neither sample module is a published artifact, so neither has a .api dump.
ignoredProjects.add("samples")
ignoredProjects.add("samples-android")
}
dependencies {
@@ -94,6 +101,15 @@ kotlin {
jvm()
androidTarget {
publishLibraryVariants("release")
// Build the Android variant at JVM 17 so Android consumers (JVM 11/17) can inline the
// library's inline DSL (`tree { }`) — they cannot inline the default JVM-21 bytecode.
compilerOptions {
jvmTarget.set(org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17)
}
}
js(IR) {
browser()
nodejs()
@@ -126,3 +142,15 @@ kotlin {
}
}
}
android {
namespace = "com.github.adriankuta.datastructure.tree"
compileSdk = libs.versions.androidCompileSdk.get().toInt()
defaultConfig {
minSdk = libs.versions.androidMinSdk.get().toInt()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}