From cf4672ea468fc95f4f71513512f53297f2d726c3 Mon Sep 17 00:00:00 2001 From: vooft <52610+vooft@users.noreply.github.com> Date: Sun, 1 Dec 2024 14:48:04 +0500 Subject: [PATCH] Improve build (#2) --- .github/workflows/build.yml | 11 ++- README.md | 78 ++++++++++++++++++- ...pose-treeview-multiplatform-lib.gradle.kts | 12 +-- .../treeview/core/{Bonsai.kt => TreeView.kt} | 0 gradle.properties | 4 +- sample/build.gradle.kts | 10 +-- 6 files changed, 90 insertions(+), 25 deletions(-) rename compose-treeview-core/src/commonMain/kotlin/io/github/vooft/compose/treeview/core/{Bonsai.kt => TreeView.kt} (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 19d31cc..79ff214 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,6 +12,10 @@ permissions: contents: write issues: read +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: build: @@ -32,8 +36,11 @@ jobs: with: dependency-graph: generate-and-submit - - name: Build - run: ./gradlew build --parallel --no-daemon + - name: Assemble + run: ./gradlew assemble + + - name: Check + run: ./gradlew check - name: Publish Test Report uses: mikepenz/action-junit-report@v5 diff --git a/README.md b/README.md index 5b6d591..4e813bc 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,77 @@ -This is a fork of the [bonsai](https://github.com/adrielcafe/bonsai) project by Adriel Cafe. +![Build and test](https://github.com/vooft/compose-treeview/actions/workflows/build.yml/badge.svg?branch=main) +![Releases](https://img.shields.io/github/v/release/vooft/compose-treeview) +![Maven Central](https://img.shields.io/maven-central/v/io.github.vooft/compose-treeview-core) +![License](https://img.shields.io/github/license/vooft/compose-treeview) -Still WIP, but [sample](./sample) works on Android, iOS, Desktop and Web (wasm). +![badge-platform-jvm] +![badge-platform-wasm] +![badge-platform-android] +![badge-platform-ios] + +![badge-demo] https://vooft.github.io/compose-treeview/ + +# compose-treeview + +A tree view for Compose Multiplatform. This project is a fork of [bonsai](https://github.com/adrielcafe/bonsai) by Adriel Cafe. + +# Supported platforms + +* Android +* iOS +* Desktop +* Web (wasm) ([demo](https://vooft.github.io/compose-treeview/)) + +# Quick start + +Add the dependency to your project: + +```kotlin +kotlin { + ... + + sourceSets { + commonMain.dependencies { + implementation("io.github.vooft:compose-treeview-core:") + } + } +} +``` + +Create a tree using DSL: + +```kotlin +@Composable +fun TreeViewExample() { + // build tree structure + val tree = Tree { + Branch("Mammalia") { + Branch("Carnivora") { + Branch("Canidae") { + Branch("Canis") { + Leaf("Wolf", customIcon = { EmojiIcon("🐺") }) + Leaf("Dog", customIcon = { EmojiIcon("🐶") }) + } + } + Branch("Felidae") { + Branch("Felis") { + Leaf("Cat", customIcon = { EmojiIcon("🐱") }) + } + Branch("Panthera") { + Leaf("Lion", customIcon = { EmojiIcon("🦁") }) + } + } + } + } + } + + // render the tree + TreeView(tree) +} +``` + + +[badge-platform-android]: http://img.shields.io/badge/-android-6EDB8D.svg?style=flat +[badge-platform-jvm]: http://img.shields.io/badge/-jvm-DB413D.svg?style=flat +[badge-platform-ios]: http://img.shields.io/badge/-ios-CDCDCD.svg?style=flat +[badge-platform-wasm]: https://img.shields.io/badge/-wasm-624FE8.svg?style=flat +[badge-demo]: https://img.shields.io/badge/-demo-4E8EF7.svg?style=flat diff --git a/buildSrc/src/main/kotlin/compose-treeview-multiplatform-lib.gradle.kts b/buildSrc/src/main/kotlin/compose-treeview-multiplatform-lib.gradle.kts index d99b2b7..e1b6ae9 100644 --- a/buildSrc/src/main/kotlin/compose-treeview-multiplatform-lib.gradle.kts +++ b/buildSrc/src/main/kotlin/compose-treeview-multiplatform-lib.gradle.kts @@ -27,16 +27,8 @@ kotlin { binaries.executable() } - listOf( - iosX64(), - iosArm64(), - iosSimulatorArm64() - ).forEach { - it.binaries.framework { - baseName = "compose-treeview" - isStatic = true - } - } + iosArm64() + iosSimulatorArm64() applyDefaultHierarchyTemplate() diff --git a/compose-treeview-core/src/commonMain/kotlin/io/github/vooft/compose/treeview/core/Bonsai.kt b/compose-treeview-core/src/commonMain/kotlin/io/github/vooft/compose/treeview/core/TreeView.kt similarity index 100% rename from compose-treeview-core/src/commonMain/kotlin/io/github/vooft/compose/treeview/core/Bonsai.kt rename to compose-treeview-core/src/commonMain/kotlin/io/github/vooft/compose/treeview/core/TreeView.kt diff --git a/gradle.properties b/gradle.properties index 0ab433b..7c376b9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ #Kotlin kotlin.code.style=official -kotlin.daemon.jvmargs=-Xmx4096M +kotlin.daemon.jvmargs=-Xmx3072M #Gradle -org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx3072M -Dfile.encoding=UTF-8 #Android android.nonTransitiveRClass=true diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index f1f4d5a..cffbde0 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -40,15 +40,7 @@ kotlin { binaries.executable() } - listOf( -// iosArm64(), - iosSimulatorArm64() - ).forEach { iosTarget -> - iosTarget.binaries.framework { - baseName = "SampleApp" - isStatic = true - } - } + iosSimulatorArm64() sourceSets { val desktopMain by getting