From 446d691e41ddada1451080cc0dff6d3362dbf35c Mon Sep 17 00:00:00 2001 From: Efim Perevalov Date: Tue, 2 May 2023 20:43:50 +0300 Subject: [PATCH 1/2] feat: Add hoplite config --- app/build.gradle.kts | 74 ++++++++++++++---------- app/src/main/kotlin/app/config/Config.kt | 15 +++++ app/src/main/resources/config.yaml | 12 ++++ 3 files changed, 70 insertions(+), 31 deletions(-) create mode 100644 app/src/main/kotlin/app/config/Config.kt create mode 100644 app/src/main/resources/config.yaml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a1156b3..64e8555 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,27 +1,17 @@ -plugins { - kotlin("jvm") version "1.8.20" - kotlin("plugin.serialization") version "1.8.20" - id("io.ktor.plugin") version "2.2.4" - id("jacoco") - id("org.jetbrains.kotlin.plugin.noarg") version "1.8.20" - - application -} -jacoco { - toolVersion = "0.8.7" - reportsDirectory.set(layout.buildDirectory.dir("coverage")) - -} -tasks.withType { - reports { - xml.required.set(true) - csv.required.set(true) - html.required.set(true) - } -} +import org.jetbrains.compose.desktop.application.dsl.TargetFormat repositories { mavenCentral() + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + google() +} + +plugins { + kotlin("jvm") version "1.8.10" + id("org.jetbrains.compose") version "1.4.0" + kotlin("plugin.serialization") version "1.8.10" + id("jacoco") + id("org.jetbrains.kotlin.plugin.noarg") version "1.8.10" } dependencies { @@ -30,31 +20,53 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") implementation("org.neo4j:neo4j-ogm-core:4.0.5") runtimeOnly("org.neo4j:neo4j-ogm-bolt-driver:4.0.5") - implementation("org.postgresql:postgresql:42.6.0") + implementation("org.postgresql:postgresql:42.5.4") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") implementation("org.jetbrains.exposed", "exposed-core", "0.40.1") implementation("org.jetbrains.exposed", "exposed-dao", "0.40.1") implementation("org.jetbrains.exposed", "exposed-jdbc", "0.40.1") + implementation(compose.desktop.currentOs) + implementation(compose.material3) + implementation(compose.materialIconsExtended) + implementation("com.sksamuel.hoplite:hoplite-core:2.7.2") + implementation("com.sksamuel.hoplite:hoplite-json:2.7.4") + implementation("com.sksamuel.hoplite:hoplite-yaml:2.7.4") } +jacoco { + toolVersion = "0.8.7" + reportsDirectory.set(layout.buildDirectory.dir("coverage")) +} + +tasks.withType { + reports { + xml.required.set(true) + csv.required.set(true) + html.required.set(true) + } +} + tasks.test { useJUnitPlatform() finalizedBy(tasks.jacocoTestReport) } -tasks.jar { - manifest.attributes["Main-Class"] = "app.AppKt" -} noArg { annotation("org.neo4j.ogm.annotation.NodeEntity") annotation("org.neo4j.ogm.annotation.RelationshipEntity") } -kotlin { - jvmToolchain(8) -} -application { - // Define the main class for the application. - mainClass.set("app.AppKt") +compose.desktop { + application { + mainClass = "app.AppKt" + + nativeDistributions { + targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) + packageName = "trees-visualizer" + packageVersion = "1.5.0" + } + } } + + diff --git a/app/src/main/kotlin/app/config/Config.kt b/app/src/main/kotlin/app/config/Config.kt new file mode 100644 index 0000000..47f95eb --- /dev/null +++ b/app/src/main/kotlin/app/config/Config.kt @@ -0,0 +1,15 @@ +package app.config + +data class Config( + val postgresHost: String, + val postgresPort: Int, + val postgresDatabase: String, + val postgresUsername: String, + val postgresPassword: String, + + val neo4jUri: String, + val neo4jUsername: String, + val neo4jPassword: String + ) + + diff --git a/app/src/main/resources/config.yaml b/app/src/main/resources/config.yaml new file mode 100644 index 0000000..b4a54a0 --- /dev/null +++ b/app/src/main/resources/config.yaml @@ -0,0 +1,12 @@ +postgresHost: localhost +postgresPort: 5432 +postgresDatabase: database +postgresUsername: postgres +postgresPassword: password + +neo4jUri: bolt://localhost +neo4jUsername: neo4j +neo4jPassword: password + + + From e4aa05e58d15f31e5d860d5885b7ada491687717 Mon Sep 17 00:00:00 2001 From: Efim Perevalov Date: Tue, 2 May 2023 22:16:28 +0300 Subject: [PATCH 2/2] refactor: Return the last gradle --- app/build.gradle.kts | 72 ++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 64e8555..0a3f383 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,17 +1,27 @@ -import org.jetbrains.compose.desktop.application.dsl.TargetFormat +plugins { + kotlin("jvm") version "1.8.20" + kotlin("plugin.serialization") version "1.8.20" + id("io.ktor.plugin") version "2.2.4" + id("jacoco") + id("org.jetbrains.kotlin.plugin.noarg") version "1.8.20" -repositories { - mavenCentral() - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - google() + application } +jacoco { + toolVersion = "0.8.7" + reportsDirectory.set(layout.buildDirectory.dir("coverage")) -plugins { - kotlin("jvm") version "1.8.10" - id("org.jetbrains.compose") version "1.4.0" - kotlin("plugin.serialization") version "1.8.10" - id("jacoco") - id("org.jetbrains.kotlin.plugin.noarg") version "1.8.10" +} +tasks.withType { + reports { + xml.required.set(true) + csv.required.set(true) + html.required.set(true) + } +} + +repositories { + mavenCentral() } dependencies { @@ -20,53 +30,37 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter") implementation("org.neo4j:neo4j-ogm-core:4.0.5") runtimeOnly("org.neo4j:neo4j-ogm-bolt-driver:4.0.5") - implementation("org.postgresql:postgresql:42.5.4") + implementation("org.postgresql:postgresql:42.6.0") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") implementation("org.jetbrains.exposed", "exposed-core", "0.40.1") implementation("org.jetbrains.exposed", "exposed-dao", "0.40.1") implementation("org.jetbrains.exposed", "exposed-jdbc", "0.40.1") - implementation(compose.desktop.currentOs) - implementation(compose.material3) - implementation(compose.materialIconsExtended) implementation("com.sksamuel.hoplite:hoplite-core:2.7.2") implementation("com.sksamuel.hoplite:hoplite-json:2.7.4") implementation("com.sksamuel.hoplite:hoplite-yaml:2.7.4") } -jacoco { - toolVersion = "0.8.7" - reportsDirectory.set(layout.buildDirectory.dir("coverage")) -} - -tasks.withType { - reports { - xml.required.set(true) - csv.required.set(true) - html.required.set(true) - } -} - tasks.test { useJUnitPlatform() finalizedBy(tasks.jacocoTestReport) } +tasks.jar { + manifest.attributes["Main-Class"] = "app.AppKt" +} noArg { annotation("org.neo4j.ogm.annotation.NodeEntity") annotation("org.neo4j.ogm.annotation.RelationshipEntity") } -compose.desktop { - application { - mainClass = "app.AppKt" - - nativeDistributions { - targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) - packageName = "trees-visualizer" - packageVersion = "1.5.0" - } - } +application { + // Define the main class for the application. + mainClass.set("app.AppKt") } - +tasks.withType { + kotlinOptions { + jvmTarget = "11" + } +} \ No newline at end of file