Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions .idea/runConfigurations/JsApp.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/desktopApp.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/desktopAppHotReload.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/wasmJsApp.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ JsonTree(

## Search

JsonTree can be searched for keys and values by using the `searchState` parameter. The SearchState provides the following data about the current results. For an example on how to implement a search UI see the sample [here](sample/src/commonMain/kotlin/App.kt).
JsonTree can be searched for keys and values by using the `searchState` parameter. The SearchState provides the following data about the current results. For an example on how to implement a search UI see the sample [here](shared/src/commonMain/kotlin/com/sebastianneubauer/jsontreesample/App.kt).

- `query` - The string which should be searched in the JsonTree
- `totalResults` - The total count of results for the query
Expand Down
6 changes: 3 additions & 3 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
// for testing only, don't do this in your app
signingConfig = signingConfigs.getByName("debug")
Expand All @@ -39,7 +39,7 @@ android {
}

dependencies {
implementation(project(":sample"))
implementation(project(":shared"))
implementation(libs.androidx.activity.compose)
implementation(libs.jb.compose.components.resources)
}
}
14 changes: 8 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ buildscript {
plugins {
alias(libs.plugins.android.application).apply(false)
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.kotlinJvm).apply(false)
alias(libs.plugins.compose).apply(false)
alias(libs.plugins.compose.compiler).apply(false)
alias(libs.plugins.publish).apply(false)
Expand All @@ -18,14 +19,16 @@ plugins {
}

apiValidation {
ignoredProjects.add("sample")
ignoredProjects.addAll(listOf("shared", "desktopApp", "webApp"))
}

val projectSource = file(projectDir)
val configFiles = files("$rootDir/detekt/config.yml")
val baselineFile = File("$rootDir/detekt/baseline.xml")
val kotlinFiles = "**/*.kt"
val sampleModuleFiles = "**/sample/**"
val sharedModuleFiles = "**/shared/**"
val desktopAppModuleFiles = "**/desktopApp/**"
val webAppModuleFiles = "**/webApp/**"
val resourceFiles = "**/resources/**"
val buildFiles = "**/build/**"
val testFiles = "**/commonTest/**"
Expand Down Expand Up @@ -57,15 +60,14 @@ tasks.register<io.gitlab.arturbosch.detekt.DetektCreateBaselineTask>("detektGene
baseline.set(baselineFile)
config.setFrom(configFiles)
include(kotlinFiles)
exclude(sampleModuleFiles, resourceFiles, buildFiles, testFiles)
exclude(sharedModuleFiles, desktopAppModuleFiles, webAppModuleFiles, resourceFiles, buildFiles, testFiles)
}


tasks.withType<Detekt>().configureEach {
include(kotlinFiles)
exclude(sampleModuleFiles, resourceFiles, buildFiles, testFiles)
exclude(sharedModuleFiles, desktopAppModuleFiles, webAppModuleFiles, resourceFiles, buildFiles, testFiles)
}

dependencies {
detektPlugins(libs.detekt.formatting)
}
}
35 changes: 35 additions & 0 deletions desktopApp/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.compose)
alias(libs.plugins.compose.compiler)
}

group = "com.sebastianneubauer.jsontreesample"
version = "1.0"

dependencies {
implementation(project(":shared"))
implementation(compose.desktop.currentOs)
}

kotlin {
jvmToolchain(17)
}

compose.desktop {
application {
mainClass = "com.sebastianneubauer.jsontreesample.MainKt"
buildTypes.release {
proguard {
configurationFiles.from("compose-desktop.pro")
}
}
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "com.sebastianneubauer.jsontreesample"
packageVersion = "1.0.0"
}
}
}
File renamed without changes.
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting",
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
androidKotlinMultiplatformLibrary = { id = "com.android.kotlin.multiplatform.library", version.ref = "agp" }
compose = { id = "org.jetbrains.compose", version.ref = "compose" }
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
Expand Down
6 changes: 3 additions & 3 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :sample:embedAndSignAppleFrameworkForXcode\n";
shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :shared:embedAndSignAppleFrameworkForXcode\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -323,7 +323,7 @@
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../sample/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
"$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
);
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.3;
Expand All @@ -350,7 +350,7 @@
ENABLE_PREVIEWS = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../sample/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
"$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
);
INFOPLIST_FILE = iosApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.3;
Expand Down
2 changes: 1 addition & 1 deletion iosApp/iosApp/ContentView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit
import SwiftUI
import Sample
import Shared

struct ComposeView: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> UIViewController {
Expand Down
3 changes: 1 addition & 2 deletions jsontree/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree

plugins {
alias(libs.plugins.kotlinMultiplatform)
Expand Down Expand Up @@ -81,4 +80,4 @@ kotlin {
implementation(compose.desktop.currentOs)
}
}
}
}

This file was deleted.

12 changes: 0 additions & 12 deletions sample/src/wasmJsMain/resources/index.html

This file was deleted.

7 changes: 0 additions & 7 deletions sample/src/wasmJsMain/resources/styles.css

This file was deleted.

4 changes: 3 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@ dependencyResolutionManagement {
}
rootProject.name = "JsonTree"
include(":jsontree")
include(":sample")
include(":shared")
include(":androidApp")
include(":desktopApp")
include(":webApp")
35 changes: 8 additions & 27 deletions sample/build.gradle.kts → shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
Expand All @@ -25,26 +24,22 @@ kotlin {
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = "Sample"
baseName = "Shared"
isStatic = true
}
}

js {
outputModuleName = "jsontree"
browser()
binaries.executable()
useEsModules()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
outputModuleName = "jsontree"
browser()
binaries.executable()
}

sourceSets {
Expand All @@ -66,32 +61,18 @@ kotlin {
commonTest.dependencies {
implementation(kotlin("test"))
}

jvmMain.dependencies {
implementation(compose.desktop.currentOs)
}
}

//https://kotlinlang.org/docs/native-objc-interop.html#export-of-kdoc-comments-to-generated-objective-c-headers
// https://kotlinlang.org/docs/native-objc-interop.html#export-of-kdoc-comments-to-generated-objective-c-headers
targets.withType<org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget> {
compilations["main"].compilerOptions.options.freeCompilerArgs.add("-Xexport-kdoc")
compilations["main"]
.compilerOptions.options.freeCompilerArgs
.add("-Xexport-kdoc")
}

jvmToolchain(17)
}

compose.desktop {
application {
mainClass = "com.sebastianneubauer.jsontreesample.MainKt"
buildTypes.release {
proguard {
configurationFiles.from("compose-desktop.pro")
}
}
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "com.sebastianneubauer.jsontreesample"
packageVersion = "1.0.0"
}
}
compose.resources {
packageOfResClass = "com.sebastianneubauer.jsontreesample.shared.generated.resources"
}
Loading