diff --git a/build.gradle.kts b/build.gradle.kts index eb50c258c..8c2b77907 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,657 +1,27 @@ -@file:Suppress("PropertyName") - -import org.gradle.api.tasks.testing.logging.TestExceptionFormat -import java.net.URI -import java.time.LocalDateTime -import java.time.format.DateTimeFormatter - -repositories { - // provides dev versions! - //maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") - maven("https://plugins.gradle.org/m2/") -} - plugins { - java - `java-library` - `java-test-fixtures` - `maven-publish` - // https://github.com/diffplug/spotless - // gradle spotlessApply - id("com.diffplug.spotless").version("6.22.0") + id("naksha.java") + id("naksha.publish") // https://github.com/johnrengelman/shadow id("com.github.johnrengelman.shadow") version "8.1.1" - // overall code coverage - //jacoco - id("jacoco-report-aggregation") - // For latest dev version: - // https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap/org/jetbrains/kotlin/kotlin-compiler/maven-metadata.xml - //id("org.jetbrains.kotlin.multiplatform").version("2.1.0-dev-1329").apply(false) - //kotlin("plugin.js-plain-objects").version("2.1.0-dev-1329") - id("org.jetbrains.kotlin.multiplatform").version("2.0.20").apply(false) - kotlin("plugin.js-plain-objects").version("2.0.20") -} - -group = "com.here.naksha" -version = rootProject.properties["version"] as String - -val jetbrains_annotations = "org.jetbrains:annotations:24.0.1" - -val vertx_version = "4.5.0" -val vertx_core = "io.vertx:vertx-core:$vertx_version" -val vertx_config = "io.vertx:vertx-config:$vertx_version" -val vertx_auth_jwt = "io.vertx:vertx-auth-jwt:$vertx_version" -val vertx_redis_client = "io.vertx:vertx-redis-client:$vertx_version" -val vertx_jdbc_client = "io.vertx:vertx-jdbc-client:$vertx_version" -val vertx_web = "io.vertx:vertx-web:$vertx_version" -val vertx_web_openapi = "io.vertx:vertx-web-openapi:$vertx_version" -val vertx_web_client = "io.vertx:vertx-web-client:$vertx_version" -val vertx_web_templ = "io.vertx:vertx-web-templ-handlebars:$vertx_version" - -val netty_transport_native_kqueue = "io.netty:netty-transport-native-kqueue:4.1.90.Final" -val netty_transport_native_epoll = "io.netty:netty-transport-native-epoll:4.1.90.Final" - -val jackson_core = "com.fasterxml.jackson.core:jackson-core:2.15.2" -val jackson_core_annotations = "com.fasterxml.jackson.core:jackson-annotations:2.15.2" -val jackson_core_databind = "com.fasterxml.jackson.core:jackson-databind:2.15.2" -val jackson_core_dataformat = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2" - -var snakeyaml = "org.yaml:snakeyaml:1.33"; - -val google_flatbuffers = "com.google.flatbuffers:flatbuffers-java:23.5.9" -val google_protobuf = "com.google.protobuf:protobuf-java:3.16.3" -val google_guava = "com.google.guava:guava:31.1-jre" -val google_tink = "com.google.crypto.tink:tink:1.5.0" - -val aws_bom = "software.amazon.awssdk:bom:2.25.19" -val aws_s3="software.amazon.awssdk:s3" - -val jts_core = "org.locationtech.jts:jts-core:1.19.0" -val jts_io_common = "org.locationtech.jts.io:jts-io-common:1.19.0" -val gt_api = "org.geotools:gt-api:19.1" -val gt_referencing = "org.geotools:gt-referencing:19.1" -val gt_epsg_hsql = "org.geotools:gt-epsg-hsql:19.1" -val gt_epsg_extension = "org.geotools:gt-epsg-extension:19.1" - -val spatial4j = "org.locationtech.spatial4j:spatial4j:0.8" - -val slf4j_api = "org.slf4j:slf4j-api:2.0.6" -val slf4j_console = "org.slf4j:slf4j-simple:2.0.6"; -val jcl_slf4j = "org.slf4j:jcl-over-slf4j:2.0.12" - - -val log4j_core = "org.apache.logging.log4j:log4j-core:2.20.0" -val log4j_api = "org.apache.logging.log4j:log4j-api:2.20.0" -val log4j_jcl = "org.apache.logging.log4j:log4j-jcl:2.20.0" -val log4j_slf4j = "org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0" - -val postgres = "org.postgresql:postgresql:42.5.4" -//val zaxxer_hikari = "com.zaxxer:HikariCP:5.1.0" -val commons_dbutils = "commons-dbutils:commons-dbutils:1.7" - -val commons_lang3 = "org.apache.commons:commons-lang3:3.12.0" -val jodah_expiringmap = "net.jodah:expiringmap:0.5.10" -val caffinitas_ohc = "org.caffinitas.ohc:ohc-core:0.7.4" -val lmax_disruptor = "com.lmax:disruptor:3.4.4" -val mchange_commons = "com.mchange:mchange-commons-java:0.2.20" -val mchange_c3p0 = "com.mchange:c3p0:0.9.5.5" - -val jayway_jsonpath = "com.jayway.jsonpath:json-path:2.7.0" -val jayway_restassured = "com.jayway.restassured:rest-assured:2.9.0" -val assertj_core = "org.assertj:assertj-core:3.24.2" -val awaitility = "org.awaitility:awaitility:4.2.0" -val junit_jupiter = "org.junit.jupiter:junit-jupiter:5.9.2" -val junit_params = "org.junit.jupiter:junit-jupiter-params:5.9.2" -val mockito = "org.mockito:mockito-core:5.8.0" -val test_containers = "org.testcontainers:testcontainers:1.19.4" -val test_containers_postgres = "org.testcontainers:postgresql:1.19.4" -val wiremock = "org.wiremock:wiremock:3.3.1" - -val flipkart_zjsonpatch = "com.flipkart.zjsonpatch:zjsonpatch:0.4.13" -val json_assert = "org.skyscreamer:jsonassert:1.5.1" -val resillience4j_retry = "io.github.resilience4j:resilience4j-retry:2.0.0" - -val otel = "io.opentelemetry:opentelemetry-api:1.28.0" - -val cytodynamics = "com.linkedin.cytodynamics:cytodynamics-nucleus:0.2.0" - -val projectRepoURI = getRequiredPropertyFromRootProject("projectRepoURI") -val mavenUrl = getRequiredPropertyFromRootProject("mavenUrl") -val mavenUser = getRequiredPropertyFromRootProject("mavenUser") -val mavenPassword = getRequiredPropertyFromRootProject("mavenPassword") - -/* - Overall coverage of subproject - it might be different for different subprojects - Configurable per project - see `setOverallCoverage` - */ -val minOverallCoverageKey: String = "minOverallCoverage" -val defaultOverallMinCoverage: Double = 0.8 // Don't decrease me! - -/* - IMPORTANT: api vs implementation - - We need to differ between libraries (starting with "here-naksha-lib") and other parts of - the project. For the Naksha libraries we need to select "api" for any dependency, that is - needed for the public API (should be usable by the user of the library), while - “implementation” should be used for all test dependencies, or dependencies that must not be - used by the users of the library. -*/ - -// Apply general settings to all sub-projects -subprojects { - // All subprojects should be in the naksha group (for artifactory) and have the same version! - group = rootProject.group - version = rootProject.version - - repositories { - maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") - maven("https://repo.osgeo.org/repository/release/") - mavenCentral() - } - - apply(plugin = "java") - apply(plugin = "com.diffplug.spotless") - apply(plugin = "java-library") - apply(plugin = "java-test-fixtures") - apply(plugin = "jacoco") - - // https://github.com/diffplug/spotless/tree/main/plugin-gradle - spotless { - java { - // excluding tests where Builder pattern gets broken by palantir - targetExclude("src/test/**") - encoding("UTF-8") - // TODO - Hardcoding it to 2023 for now to avoid all the files conflicting with open PRs - // val YEAR = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy")) - val YEAR = 2024 - licenseHeader(""" -/* - * Copyright (C) 2017-$YEAR HERE Europe B.V. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * License-Filename: LICENSE - */ -""") - // Allow "spotless:off" / "spotless:on" comments to toggle spotless auto-format. - toggleOffOn() - removeUnusedImports() - importOrder() - formatAnnotations() - // https://github.com/diffplug/spotless/issues/1774 - palantirJavaFormat("2.39.0") - indentWithTabs(4) - indentWithSpaces(2) - } - } - - tasks { - test { - maxHeapSize = "4g" - useJUnitPlatform() - testLogging { - showStandardStreams = true - exceptionFormat = TestExceptionFormat.FULL - events("standardOut", "started", "passed", "skipped", "failed") - } - afterTest(KotlinClosure2( - { descriptor: TestDescriptor, result: TestResult -> - val totalTime = result.endTime - result.startTime - println("Total time of $descriptor.name was $totalTime") - } - )) - } - - compileJava { - finalizedBy(spotlessApply) - } - - // Suppress Javadoc errors (we document our checked exceptions). - javadoc { - options { - this as StandardJavadocDocletOptions - addBooleanOption("Xdoclint:none", true) - addStringOption("Xmaxwarns", "1") - } - } - - jacocoTestReport { - dependsOn(test) - reports { - xml.required = true - } - } - - jacocoTestCoverageVerification { - dependsOn(jacocoTestReport) - violationRules { - rule { - limit { - minimum = getOverallCoverage().toBigDecimal() - } - } - } - } - } - - java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - - // Fix transitive dependencies. - - dependencies { - implementation(snakeyaml) { - // https://stackoverflow.com/questions/70154082/getting-java-lang-nosuchmethoderror-org-yaml-snakeyaml-yaml-init-while-runnin - version { - strictly("1.33") - } - } - implementation(platform(aws_bom)) - } - - // Shared dependencies. - - if (name.startsWith("here-naksha-lib")) { - // TODO: We need to expose JTS, but actually we need to upgrade it first. - dependencies { - api(jetbrains_annotations) - api(slf4j_api) - api(jackson_core) - api(jackson_core_databind) - api(jackson_core_dataformat) - api(jackson_core_annotations) - } - } else { - dependencies { - implementation(jetbrains_annotations) - implementation(slf4j_api) - implementation(jackson_core) - implementation(jackson_core_databind) - implementation(jackson_core_dataformat) - implementation(jackson_core_annotations) - } - } - dependencies { - testImplementation(log4j_slf4j) - testImplementation(log4j_api) - testImplementation(log4j_core) - testImplementation(junit_jupiter) - testImplementation(junit_params) - testFixturesApi(junit_jupiter) - } -} - -// Note: We normally would want to move these settings into dedicated files in the subprojects, -// but if we do that, the shared section at the end (about publishing and shadow-jar) are -// not that easy AND, worse: We can't share the constants for the dependencies. - -project(":here-naksha-lib-core") { - description = "Naksha Core Library" - java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - withJavadocJar() - withSourcesJar() - } - dependencies { - // Can we get rid of this? - implementation(google_guava) - implementation(commons_lang3) - implementation(jts_core) - implementation(jts_io_common) - implementation(google_flatbuffers) - api(project(":here-naksha-lib-base")) - api(project(":here-naksha-lib-jbon")) - api(project(":here-naksha-lib-model")) - implementation(spatial4j) - testImplementation(mockito) - testImplementation(json_assert) - } - setOverallCoverage(0.0) // only increasing allowed! -} - -project(":here-naksha-lib-heapcache") { - description = "Naksha Heap Caching Library" - java { - withJavadocJar() - withSourcesJar() - } - dependencies { - api(project(":here-naksha-lib-core")) - testImplementation(mockito) - implementation(jts_core) - } - setOverallCoverage(0.5) // only increasing allowed! } -project(":here-naksha-storage-http") { - description = "Naksha Http Storage Module" - java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - withJavadocJar() - withSourcesJar() - - } - dependencies { - implementation(project(":here-naksha-lib-core")) - implementation(project(":here-naksha-common-http")) - - implementation(commons_lang3) - - testImplementation(mockito) - } - setOverallCoverage(0.0) // only increasing allowed! - -} - - -project(":here-naksha-lib-view") { - description = "Naksha View Library" - java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 - withJavadocJar() - withSourcesJar() - } - dependencies { - api(project(":here-naksha-lib-core")) - implementation(project(":here-naksha-lib-psql")) - - implementation(commons_lang3) - testImplementation(mockito) - testImplementation(project(":here-naksha-lib-psql")) - testImplementation(jts_core) - } - setOverallCoverage(0.0) // only increasing allowed! -} - -/* -project(":here-naksha-lib-extension") { - description = "Naksha Extension Library" - dependencies { - api(project(":here-naksha-lib-core")) - } - setOverallCoverage(0.4) // only increasing allowed! -} -*/ - -project(":here-naksha-handler-activitylog") { - description = "Naksha Activity Log Handler" - dependencies { - implementation(project(":here-naksha-lib-core")) - implementation(project(":here-naksha-lib-psql")) - implementation(project(":here-naksha-lib-handlers")) - - implementation(flipkart_zjsonpatch) - testImplementation(jayway_jsonpath) - testImplementation(mockito) - testImplementation(json_assert) - testImplementation(testFixtures(project(":here-naksha-lib-core"))) - } - setOverallCoverage(0.4) // only increasing allowed! -} - -/* -project(":here-naksha-handler-http") { - description = "Naksha Http Handler" - apply(plugin = "kotlin") - tasks { - // Note: Using compileKotlin {} does not work due to a bug in the Kotlin DSL! - // It only works, when applying the Kotlin plugin for all projects. - withType { - kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString() - finalizedBy(spotlessApply) - } - } - dependencies { - implementation(project(":here-naksha-lib-core")) - testImplementation(project(":here-naksha-lib-extension")) - - implementation(jts_core) - - testImplementation(jayway_jsonpath) - } -} -*/ - configurations.implementation { exclude(module = "commons-logging") } -project(":here-naksha-lib-handlers") { - description = "Naksha Handlers library" - dependencies { - implementation(project(":here-naksha-lib-core")) - implementation(project(":here-naksha-lib-psql")) - implementation(project(":here-naksha-lib-view")) - implementation(project(":here-naksha-storage-http")) - - implementation(commons_lang3) - implementation(commons_dbutils) - - testImplementation(mockito) - testImplementation(json_assert) - testImplementation(testFixtures(project(":here-naksha-lib-core"))) - - setOverallCoverage(0.0) - } -} - -project(":here-naksha-lib-ext-manager") { - description = "Naksha Extension Manager Library" - dependencies { - api(project(":here-naksha-lib-core")) - - implementation(aws_s3) - implementation(jcl_slf4j) - implementation(cytodynamics) - testImplementation(mockito) - } - setOverallCoverage(0.0) // only increasing allowed! -} - -//try { -project(":here-naksha-lib-hub") { - description = "NakshaHub library" - dependencies { - implementation(project(":here-naksha-lib-core")) - implementation(project(":here-naksha-lib-psql")) - implementation(project(":here-naksha-lib-handlers")) - implementation(project(":here-naksha-lib-ext-manager")) - - implementation(commons_lang3) - implementation(jts_core) - implementation(postgres) - implementation(aws_s3) - - testImplementation(json_assert) - testImplementation(mockito) - } - setOverallCoverage(0.2) // only increasing allowed! -} -//} catch (ignore: UnknownProjectException) { -//} - - -//try { -project(":here-naksha-app-service") { - description = "Naksha Service" - dependencies { - implementation(project(":here-naksha-lib-core")) - implementation(project(":here-naksha-lib-psql")) - implementation(project(":here-naksha-storage-http")) - //implementation(project(":here-naksha-lib-extension")) - implementation(project(":here-naksha-lib-hub")) - implementation(project(":here-naksha-common-http")) - - implementation(log4j_slf4j) - implementation(log4j_api) - implementation(log4j_core) - implementation(otel) - implementation(commons_lang3) - implementation(jts_core) - implementation(postgres) - implementation(vertx_core) - implementation(vertx_auth_jwt) - implementation(vertx_web) - implementation(vertx_web_client) - implementation(vertx_web_openapi) - implementation(project(":here-naksha-handler-activitylog")) - - testImplementation(json_assert) - testImplementation(resillience4j_retry) - testImplementation(test_containers) - testImplementation(testFixtures(project(":here-naksha-lib-core"))) - testImplementation(wiremock) - } - setOverallCoverage(0.25) // only increasing allowed! -} -//} catch (ignore: UnknownProjectException) { -//} - -subprojects { - apply(plugin = "maven-publish") - publishing { - repositories { - maven { - url = URI(mavenUrl) - credentials.username = mavenUser - credentials.password = mavenPassword - } - } - - publications { - create("maven") { - groupId = project.group.toString() - artifactId = project.name - version = project.version.toString() - from(components["java"]) - pom { - url = "https://${projectRepoURI}" - licenses { - license { - name = "The Apache License, Version 2.0" - url = "http://www.apache.org/licenses/LICENSE-2.0.txt" - } - } - scm { - connection = "scm:git:https://${projectRepoURI}.git" - developerConnection = "scm:git:ssh://git@${projectRepoURI}.git" - url = "https://${projectRepoURI}" - } - } - } - - artifacts { - file("build/libs/${project.name}-${project.version}.jar") - file("build/libs/${project.name}-${project.version}-javadoc.jar") - file("build/libs/${project.name}-${project.version}-sources.jar") - } - } - } - } - -// For publishing root project (including shaded jar) -publishing { - repositories { - maven { - url = URI(mavenUrl) - credentials.username = mavenUser - credentials.password = mavenPassword - } - } - - publications { - create("maven") { - groupId = project.group.toString() - artifactId = project.name - version = project.version.toString() - from(components["java"]) - pom { - url = "https://${projectRepoURI}" - licenses { - license { - name = "The Apache License, Version 2.0" - url = "http://www.apache.org/licenses/LICENSE-2.0.txt" - } - } - scm { - connection = "scm:git:https://${projectRepoURI}.git" - developerConnection = "scm:git:ssh://git@${projectRepoURI}.git" - url = "https://${projectRepoURI}" - } - } - } - - artifacts { - file("build/libs/${project.name}-${project.version}.jar") - file("build/libs/${project.name}-${project.version}-all.jar") - } - } -} - // Create the fat jar for the whole Naksha. rootProject.dependencies { //This is needed, otherwise the blank root project will include nothing in the fat jar implementation(project(":here-naksha-app-service")) } -// to include license files in Jar -sourceSets { - main { - resources { - setSrcDirs(listOf(".")).setIncludes(listOf("LICENSE","HERE_NOTICE")) - } - } -} - -rootProject.tasks.shadowJar { - //Have all tests run before building the fat jar - dependsOn(allprojects.flatMap { it.tasks.withType(Test::class) }) - archiveClassifier.set("all") - mergeServiceFiles() - isZip64 = true - manifest { - attributes["Implementation-Title"] = "Naksha Service" - attributes["Main-Class"] = "com.here.naksha.app.service.NakshaApp" - } -} - -// print app version -rootProject.tasks.register("printAppVersion") { - println(rootProject.version) -} -fun Project.setOverallCoverage(minOverallCoverage: Double) { - ext.set(minOverallCoverageKey, minOverallCoverage) -} - -fun Project.getOverallCoverage(): Double { - return if (ext.has(minOverallCoverageKey)) { - ext.get(minOverallCoverageKey) as? Double - ?: throw IllegalStateException("Property '$minOverallCoverageKey' is expected to be Double") - } else { - defaultOverallMinCoverage - } +// to include license files in Jar +tasks.withType { + from(rootProject.file("HERE_NOTICE")) + into("") } -fun getRequiredPropertyFromRootProject(propertyKey: String): String { - return rootProject.properties[propertyKey] as? String ?: throw IllegalArgumentException(""" - Not found required property: $propertyKey. - Check your 'gradle.properties' file (in both project and ~/.gradle directory) - """.trimIndent() - ) +tasks.withType { + from(rootProject.file("LICENSE")) + into("") } \ No newline at end of file diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 000000000..c2829feab --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + `kotlin-dsl` + `maven-publish` +} + +group = rootProject.group +version = rootProject.version + +repositories { + maven("https://plugins.gradle.org/m2/") +} + +//apply(plugin = "maven-publish") + +dependencies { + implementation("com.diffplug.spotless:spotless-plugin-gradle:6.22.0") + implementation("org.jetbrains.kotlin.multiplatform:org.jetbrains.kotlin.multiplatform.gradle.plugin:2.0.20") + implementation("org.jetbrains.kotlin.plugin.js-plain-objects:org.jetbrains.kotlin.plugin.js-plain-objects.gradle.plugin:2.0.20") +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/CodeCoverage.kt b/buildSrc/src/main/kotlin/CodeCoverage.kt new file mode 100644 index 000000000..e238f84be --- /dev/null +++ b/buildSrc/src/main/kotlin/CodeCoverage.kt @@ -0,0 +1,17 @@ +import org.gradle.api.Project + +val minOverallCoverageKey: String = "minOverallCoverage" +val defaultOverallMinCoverage: Double = 0.8 // Don't decrease me! + +fun Project.setOverallCoverage(minOverallCoverage: Double) { + this.extensions.extraProperties.set(minOverallCoverageKey, minOverallCoverage) +} + +fun Project.getOverallCoverage(): Double { + return if (this.extensions.extraProperties.has(minOverallCoverageKey)) { + this.extensions.extraProperties.get(minOverallCoverageKey) as? Double + ?: throw IllegalStateException("Property '$minOverallCoverageKey' is expected to be Double") + } else { + defaultOverallMinCoverage + } +} diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt new file mode 100644 index 000000000..48af49dba --- /dev/null +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -0,0 +1,91 @@ +object Lib { + + val jetbrains_annotations = "org.jetbrains:annotations:24.0.1" + + val vertx_version = "4.5.0" + val vertx_core = "io.vertx:vertx-core:$vertx_version" + val vertx_config = "io.vertx:vertx-config:$vertx_version" + val vertx_auth_jwt = "io.vertx:vertx-auth-jwt:$vertx_version" + val vertx_redis_client = "io.vertx:vertx-redis-client:$vertx_version" + val vertx_jdbc_client = "io.vertx:vertx-jdbc-client:$vertx_version" + val vertx_web = "io.vertx:vertx-web:$vertx_version" + val vertx_web_openapi = "io.vertx:vertx-web-openapi:$vertx_version" + val vertx_web_client = "io.vertx:vertx-web-client:$vertx_version" + val vertx_web_templ = "io.vertx:vertx-web-templ-handlebars:$vertx_version" + + val netty_transport_native_kqueue = "io.netty:netty-transport-native-kqueue:4.1.90.Final" + val netty_transport_native_epoll = "io.netty:netty-transport-native-epoll:4.1.90.Final" + + val jackson_core = "com.fasterxml.jackson.core:jackson-core:2.15.2" + val jackson_core_annotations = "com.fasterxml.jackson.core:jackson-annotations:2.15.2" + val jackson_core_databind = "com.fasterxml.jackson.core:jackson-databind:2.15.2" + val jackson_core_dataformat = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.2" + val jackson_kotlin = "com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2" + + var snakeyaml = "org.yaml:snakeyaml:1.33"; + + val google_flatbuffers = "com.google.flatbuffers:flatbuffers-java:23.5.9" + val google_protobuf = "com.google.protobuf:protobuf-java:3.16.3" + val google_guava = "com.google.guava:guava:31.1-jre" + val google_tink = "com.google.crypto.tink:tink:1.5.0" + + val aws_bom = "software.amazon.awssdk:bom:2.25.19" + val aws_s3="software.amazon.awssdk:s3" + + val jts_core = "org.locationtech.jts:jts-core:1.19.0" + val jts_io_common = "org.locationtech.jts.io:jts-io-common:1.19.0" + val gt_api = "org.geotools:gt-api:19.1" + val gt_referencing = "org.geotools:gt-referencing:19.1" + val gt_epsg_hsql = "org.geotools:gt-epsg-hsql:19.1" + val gt_epsg_extension = "org.geotools:gt-epsg-extension:19.1" + + val spatial4j = "org.locationtech.spatial4j:spatial4j:0.8" + + val slf4j_api = "org.slf4j:slf4j-api:2.0.6" + val slf4j_console = "org.slf4j:slf4j-simple:2.0.6"; + val jcl_slf4j = "org.slf4j:jcl-over-slf4j:2.0.12" + + + val log4j_core = "org.apache.logging.log4j:log4j-core:2.20.0" + val log4j_api = "org.apache.logging.log4j:log4j-api:2.20.0" + val log4j_jcl = "org.apache.logging.log4j:log4j-jcl:2.20.0" + val log4j_slf4j = "org.apache.logging.log4j:log4j-slf4j2-impl:2.20.0" + + val postgres = "org.postgresql:postgresql:42.5.4" + //val zaxxer_hikari = "com.zaxxer:HikariCP:5.1.0" + val commons_dbutils = "commons-dbutils:commons-dbutils:1.7" + + val commons_lang3 = "org.apache.commons:commons-lang3:3.12.0" + val jodah_expiringmap = "net.jodah:expiringmap:0.5.10" + val caffinitas_ohc = "org.caffinitas.ohc:ohc-core:0.7.4" + val lmax_disruptor = "com.lmax:disruptor:3.4.4" + val mchange_commons = "com.mchange:mchange-commons-java:0.2.20" + val mchange_c3p0 = "com.mchange:c3p0:0.9.5.5" + + val jayway_jsonpath = "com.jayway.jsonpath:json-path:2.7.0" + val jayway_restassured = "com.jayway.restassured:rest-assured:2.9.0" + val assertj_core = "org.assertj:assertj-core:3.24.2" + val awaitility = "org.awaitility:awaitility:4.2.0" + val junit_jupiter_api = "org.junit.jupiter:junit-jupiter-api:5.9.2" + val junit_jupiter_engine = "org.junit.jupiter:junit-jupiter-engine:5.9.2" + val junit_jupiter = "org.junit.jupiter:junit-jupiter:5.9.2" + val junit_params = "org.junit.jupiter:junit-jupiter-params:5.9.2" + val mockito = "org.mockito:mockito-core:5.8.0" + val mockito_kotlin = "org.mockito.kotlin:mockito-kotlin:5.3.1" + val test_containers = "org.testcontainers:testcontainers:1.19.4" + val test_containers_postgres = "org.testcontainers:postgresql:1.19.4" + val wiremock = "org.wiremock:wiremock:3.3.1" + + val flipkart_zjsonpatch = "com.flipkart.zjsonpatch:zjsonpatch:0.4.13" + val json_assert = "org.skyscreamer:jsonassert:1.5.1" + val resillience4j_retry = "io.github.resilience4j:resilience4j-retry:2.0.0" + + val otel = "io.opentelemetry:opentelemetry-api:1.28.0" + + val cytodynamics = "com.linkedin.cytodynamics:cytodynamics-nucleus:0.2.0" + + val kotlinx_datetime = "org.jetbrains.kotlinx:kotlinx-datetime:0.5.0" + val kotlintest_runner_junit5 = "io.kotlintest:kotlintest-runner-junit5:3.3.2" + + val lz4_java = "org.lz4:lz4-java:1.8.0" +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Properties.kt b/buildSrc/src/main/kotlin/Properties.kt new file mode 100644 index 000000000..fdb1a90fa --- /dev/null +++ b/buildSrc/src/main/kotlin/Properties.kt @@ -0,0 +1,10 @@ +import org.gradle.api.Project + +fun Project.getRequiredPropertyFromRootProject(propertyKey: String): String { + return this.rootProject.properties[propertyKey] as? String ?: throw IllegalArgumentException( + """ + Not found required property: $propertyKey. + Check your 'gradle.properties' file (in both project and ~/.gradle directory) + """.trimIndent() + ) +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/naksha.java.gradle.kts b/buildSrc/src/main/kotlin/naksha.java.gradle.kts new file mode 100644 index 000000000..dea252d62 --- /dev/null +++ b/buildSrc/src/main/kotlin/naksha.java.gradle.kts @@ -0,0 +1,141 @@ +import org.gradle.api.JavaVersion +import org.gradle.api.tasks.testing.TestDescriptor +import org.gradle.api.tasks.testing.TestResult +import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.gradle.external.javadoc.StandardJavadocDocletOptions +import org.gradle.kotlin.dsl.* + +plugins { + id("java") + id("jacoco-report-aggregation") + id("java-library") + id("java-test-fixtures") +} + +group = rootProject.group +version = rootProject.version + +repositories { + maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") + maven("https://repo.osgeo.org/repository/release/") + mavenCentral() +} + +apply(plugin = "java-library") +apply(plugin = "java-test-fixtures") +apply(plugin = "jacoco") + +tasks { + test { + maxHeapSize = "4g" + useJUnitPlatform() + testLogging { + showStandardStreams = true + exceptionFormat = TestExceptionFormat.FULL + events("standardOut", "started", "passed", "skipped", "failed") + } + afterTest(KotlinClosure2( + { descriptor: TestDescriptor, result: TestResult -> + val totalTime = result.endTime - result.startTime + println("Total time of $descriptor.name was $totalTime") + } + )) + } + + // Suppress Javadoc errors (we document our checked exceptions). + javadoc { + options { + this as StandardJavadocDocletOptions + addBooleanOption("Xdoclint:none", true) + addStringOption("Xmaxwarns", "1") + } + } + + jacocoTestReport { + dependsOn(test) + reports { + xml.required = true + } + } + + jacocoTestCoverageVerification { + dependsOn(jacocoTestReport) + violationRules { + rule { + limit { + minimum = getOverallCoverage().toBigDecimal() + } + } + } + } +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} + +// Fix transitive dependencies. + +dependencies { + implementation(Lib.snakeyaml) { + // https://stackoverflow.com/questions/70154082/getting-java-lang-nosuchmethoderror-org-yaml-snakeyaml-yaml-init-while-runnin + version { + strictly("1.33") + } + } + implementation(platform(Lib.aws_bom)) +} + +// Shared dependencies. +/* + IMPORTANT: api vs implementation + + We need to differ between libraries (starting with "here-naksha-lib") and other parts of + the project. For the Naksha libraries we need to select "api" for any dependency, that is + needed for the public API (should be usable by the user of the library), while + “implementation” should be used for all test dependencies, or dependencies that must not be + used by the users of the library. +*/ +if (name.startsWith("here-naksha-lib")) { + // TODO: We need to expose JTS, but actually we need to upgrade it first. + dependencies { + api(Lib.jetbrains_annotations) + api(Lib.slf4j_api) + api(Lib.jackson_core) + api(Lib.jackson_core_databind) + api(Lib.jackson_core_dataformat) + api(Lib.jackson_core_annotations) + } +} else { + dependencies { + implementation(Lib.jetbrains_annotations) + implementation(Lib.slf4j_api) + implementation(Lib.jackson_core) + implementation(Lib.jackson_core_databind) + implementation(Lib.jackson_core_dataformat) + implementation(Lib.jackson_core_annotations) + } +} +dependencies { + testImplementation(Lib.log4j_slf4j) + testImplementation(Lib.log4j_api) + testImplementation(Lib.log4j_core) + testImplementation(Lib.junit_jupiter) + testImplementation(Lib.junit_params) + testFixturesApi(Lib.junit_jupiter) +} + +tasks.withType { + from(rootProject.file("HERE_NOTICE")) + into("") +} + +tasks.withType { + from(rootProject.file("LICENSE")) + into("") +} + +tasks.register("printAppVersion") { + println(rootProject.version) +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/naksha.publish.gradle.kts b/buildSrc/src/main/kotlin/naksha.publish.gradle.kts new file mode 100644 index 000000000..488f55f13 --- /dev/null +++ b/buildSrc/src/main/kotlin/naksha.publish.gradle.kts @@ -0,0 +1,58 @@ +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.kotlin.dsl.assign +import org.gradle.kotlin.dsl.create +import org.gradle.kotlin.dsl.get +import org.gradle.kotlin.dsl.`maven-publish` +import java.net.URI + +plugins { + id("java") + id("maven-publish") +} + +group = "com.here.naksha" +version = rootProject.properties["version"] as String + +val projectRepoURI = getRequiredPropertyFromRootProject("projectRepoURI") +val mavenUrl = getRequiredPropertyFromRootProject("mavenUrl") +val mavenUser = getRequiredPropertyFromRootProject("mavenUser") +val mavenPassword = getRequiredPropertyFromRootProject("mavenPassword") + +publishing { + repositories { + maven { + url = URI(mavenUrl) + credentials.username = mavenUser + credentials.password = mavenPassword + } + } + + publications { + create("maven") { + groupId = project.group.toString() + artifactId = project.name + version = project.version.toString() + from(components["java"]) + pom { + url = "https://${projectRepoURI}" + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + scm { + connection = "scm:git:https://${projectRepoURI}.git" + developerConnection = "scm:git:ssh://git@${projectRepoURI}.git" + url = "https://${projectRepoURI}" + } + } + } + + artifacts { + file("build/libs/${project.name}-${project.version}.jar") + file("build/libs/${project.name}-${project.version}-javadoc.jar") + file("build/libs/${project.name}-${project.version}-sources.jar") + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/naksha.spotless-kotlin.gradle.kts b/buildSrc/src/main/kotlin/naksha.spotless-kotlin.gradle.kts new file mode 100644 index 000000000..a3c77c300 --- /dev/null +++ b/buildSrc/src/main/kotlin/naksha.spotless-kotlin.gradle.kts @@ -0,0 +1,46 @@ +import org.gradle.kotlin.dsl.apply +import java.time.LocalDateTime +import java.time.format.DateTimeFormatter + +plugins { + id("org.jetbrains.kotlin.multiplatform") + id("com.diffplug.spotless") +} + +apply(plugin = "com.diffplug.spotless") + +// https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + + kotlin { + // excluding tests where Builder pattern gets broken by palantir + targetExclude("src/*Test/**") + target("**/*.kt") + encoding("UTF-8") + val YEAR = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy")) + licenseHeader(""" +/* + * Copyright (C) 2017-$YEAR HERE Europe B.V. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ +""") + } +} + +tasks.withType { + finalizedBy("spotlessApply") +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/naksha.spotless.gradle.kts b/buildSrc/src/main/kotlin/naksha.spotless.gradle.kts new file mode 100644 index 000000000..c3814a82b --- /dev/null +++ b/buildSrc/src/main/kotlin/naksha.spotless.gradle.kts @@ -0,0 +1,55 @@ +import org.gradle.kotlin.dsl.apply + +plugins { + id("java") + id("com.diffplug.spotless") +} + +apply(plugin = "com.diffplug.spotless") + +// https://github.com/diffplug/spotless/tree/main/plugin-gradle +spotless { + java { + // excluding tests where Builder pattern gets broken by palantir + targetExclude("src/test/**") + encoding("UTF-8") + // TODO - Hardcoding it to 2023 for now to avoid all the files conflicting with open PRs + // val YEAR = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy")) + val YEAR = 2024 + licenseHeader(""" +/* + * Copyright (C) 2017-$YEAR HERE Europe B.V. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * License-Filename: LICENSE + */ +""") + // Allow "spotless:off" / "spotless:on" comments to toggle spotless auto-format. + toggleOffOn() + removeUnusedImports() + importOrder() + formatAnnotations() + // https://github.com/diffplug/spotless/issues/1774 + palantirJavaFormat("2.39.0") + indentWithTabs(4) + indentWithSpaces(2) + } +} + +tasks { + compileJava { + finalizedBy(spotlessApply) + } +} \ No newline at end of file diff --git a/here-naksha-app-service/build.gradle.kts b/here-naksha-app-service/build.gradle.kts new file mode 100644 index 000000000..5a7fcf4a0 --- /dev/null +++ b/here-naksha-app-service/build.gradle.kts @@ -0,0 +1,35 @@ +plugins { + id("naksha.java") + id("naksha.publish") +} + +description = "Naksha Service" +dependencies { + implementation(project(":here-naksha-lib-core")) + implementation(project(":here-naksha-lib-psql")) + implementation(project(":here-naksha-storage-http")) + //implementation(project(":here-naksha-lib-extension")) + implementation(project(":here-naksha-lib-hub")) + implementation(project(":here-naksha-common-http")) + + implementation(Lib.log4j_slf4j) + implementation(Lib.log4j_api) + implementation(Lib.log4j_core) + implementation(Lib.otel) + implementation(Lib.commons_lang3) + implementation(Lib.jts_core) + implementation(Lib.postgres) + implementation(Lib.vertx_core) + implementation(Lib.vertx_auth_jwt) + implementation(Lib.vertx_web) + implementation(Lib.vertx_web_client) + implementation(Lib.vertx_web_openapi) + implementation(project(":here-naksha-handler-activitylog")) + + testImplementation(Lib.json_assert) + testImplementation(Lib.resillience4j_retry) + testImplementation(Lib.test_containers) + testImplementation(testFixtures(project(":here-naksha-lib-core"))) + testImplementation(Lib.wiremock) +} +setOverallCoverage(0.25) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-common-http/build.gradle.kts b/here-naksha-common-http/build.gradle.kts new file mode 100644 index 000000000..1adb18438 --- /dev/null +++ b/here-naksha-common-http/build.gradle.kts @@ -0,0 +1,3 @@ +plugins { + id("naksha.java") +} diff --git a/here-naksha-handler-activitylog/build.gradle.kts b/here-naksha-handler-activitylog/build.gradle.kts new file mode 100644 index 000000000..cbf99c1f3 --- /dev/null +++ b/here-naksha-handler-activitylog/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + id("naksha.java") + id("naksha.publish") +} +description = "Naksha Activity Log Handler" +dependencies { + implementation(project(":here-naksha-lib-core")) + implementation(project(":here-naksha-lib-psql")) + implementation(project(":here-naksha-lib-handlers")) + + implementation(Lib.flipkart_zjsonpatch) + testImplementation(Lib.jayway_jsonpath) + testImplementation(Lib.mockito) + testImplementation(Lib.json_assert) + testImplementation(testFixtures(project(":here-naksha-lib-core"))) +} +setOverallCoverage(0.4) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-auth/build.gradle.kts b/here-naksha-lib-auth/build.gradle.kts index b88b1c729..072f230fc 100644 --- a/here-naksha-lib-auth/build.gradle.kts +++ b/here-naksha-lib-auth/build.gradle.kts @@ -6,6 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.JsSourceMapNamesPolicy plugins { id("org.jetbrains.kotlin.multiplatform") kotlin("plugin.js-plain-objects") + id("naksha.java") + id("naksha.publish") + + // uncomment spotless to add license comments + // id("naksha.spotless-kotlin") } kotlin { @@ -39,7 +44,7 @@ kotlin { commonMain { dependencies { implementation(kotlin("stdlib-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) implementation(project(":here-naksha-lib-base")) } } @@ -48,19 +53,19 @@ kotlin { implementation(kotlin("test")) implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) } } jvmTest { jvmToolchain(11) dependencies { implementation(kotlin("test")) - implementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") - runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-api:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-params:5.5.2") - api("org.slf4j:slf4j-api:2.0.13") - implementation("org.slf4j:slf4j-simple:2.0.13") + implementation(Lib.kotlintest_runner_junit5) + runtimeOnly(Lib.junit_jupiter_engine) + implementation(Lib.junit_jupiter_api) + implementation(Lib.junit_params) + api(Lib.slf4j_api) + implementation(Lib.slf4j_console) } } } @@ -86,4 +91,5 @@ tasks { useJUnitPlatform() maxHeapSize = "8g" } -} \ No newline at end of file +} +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-base/build.gradle.kts b/here-naksha-lib-base/build.gradle.kts index 2a9cb6394..08faa9b9a 100644 --- a/here-naksha-lib-base/build.gradle.kts +++ b/here-naksha-lib-base/build.gradle.kts @@ -6,6 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.JsSourceMapNamesPolicy plugins { id("org.jetbrains.kotlin.multiplatform") kotlin("plugin.js-plain-objects") + id("naksha.publish") + id("naksha.java") + + // uncomment spotless to add license comments + // id("naksha.spotless-kotlin") } kotlin { @@ -49,7 +54,7 @@ kotlin { implementation(kotlin("test")) implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0") + implementation(Lib.kotlinx_datetime) } } jvmMain { @@ -57,12 +62,11 @@ kotlin { dependencies { implementation(kotlin("stdlib-jdk8")) implementation(kotlin("reflect")) - api("org.lz4:lz4-java:1.8.0") - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.15.2") + api(Lib.lz4_java) + implementation(Lib.jackson_kotlin) // https://mvnrepository.com/artifact/org.slf4j - api("org.slf4j:slf4j-api:2.0.13") - implementation("org.slf4j:slf4j-simple:2.0.13") - api("org.lz4:lz4-java:1.8.0") + api(Lib.slf4j_api) + implementation(Lib.slf4j_console) } resources.setSrcDirs(resources.srcDirs + "${layout.buildDirectory}/dist/js/productionExecutable/") } @@ -95,4 +99,5 @@ tasks { useJUnitPlatform() maxHeapSize = "8g" } -} \ No newline at end of file +} +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-core/build.gradle.kts b/here-naksha-lib-core/build.gradle.kts new file mode 100644 index 000000000..f6bb4d82a --- /dev/null +++ b/here-naksha-lib-core/build.gradle.kts @@ -0,0 +1,28 @@ +description = "Naksha Core Library" + +plugins { + id("naksha.java") + id("naksha.publish") +} + +java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + withJavadocJar() + withSourcesJar() +} +dependencies { + // Can we get rid of this? + implementation(Lib.google_guava) + implementation(Lib.commons_lang3) + implementation(Lib.jts_core) + implementation(Lib.jts_io_common) + implementation(Lib.google_flatbuffers) + api(project(":here-naksha-lib-base")) + api(project(":here-naksha-lib-jbon")) + api(project(":here-naksha-lib-model")) + implementation(Lib.spatial4j) + testImplementation(Lib.mockito) + testImplementation(Lib.json_assert) +} +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-diff/build.gradle.kts b/here-naksha-lib-diff/build.gradle.kts index 6a9e59792..1c9f30aac 100644 --- a/here-naksha-lib-diff/build.gradle.kts +++ b/here-naksha-lib-diff/build.gradle.kts @@ -6,6 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.JsSourceMapNamesPolicy plugins { id("org.jetbrains.kotlin.multiplatform") kotlin("plugin.js-plain-objects") + id("naksha.publish") + id("naksha.java") + + // uncomment spotless to add license comments + // id("naksha.spotless-kotlin") } kotlin { @@ -39,7 +44,7 @@ kotlin { commonMain { dependencies { implementation(kotlin("stdlib-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) implementation(project(":here-naksha-lib-base")) } } @@ -48,19 +53,19 @@ kotlin { implementation(kotlin("test")) implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) } } jvmTest { jvmToolchain(11) dependencies { implementation(kotlin("test")) - implementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") - runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-api:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-params:5.5.2") - api("org.slf4j:slf4j-api:2.0.13") - implementation("org.slf4j:slf4j-simple:2.0.13") + implementation(Lib.kotlintest_runner_junit5) + runtimeOnly(Lib.junit_jupiter_engine) + implementation(Lib.junit_jupiter_api) + implementation(Lib.junit_params) + api(Lib.slf4j_api) + implementation(Lib.slf4j_console) implementation("org.skyscreamer:jsonassert:1.5.1") } } diff --git a/here-naksha-lib-ext-manager/build.gradle.kts b/here-naksha-lib-ext-manager/build.gradle.kts new file mode 100644 index 000000000..b7fc8b71d --- /dev/null +++ b/here-naksha-lib-ext-manager/build.gradle.kts @@ -0,0 +1,14 @@ +plugins { + id("naksha.java") + id("naksha.publish") +} +description = "Naksha Extension Manager Library" +dependencies { + api(project(":here-naksha-lib-core")) + + implementation(Lib.aws_s3) + implementation(Lib.jcl_slf4j) + implementation(Lib.cytodynamics) + testImplementation(Lib.mockito) +} +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-geo/build.gradle.kts b/here-naksha-lib-geo/build.gradle.kts index 36bdcfe2d..07cf87067 100644 --- a/here-naksha-lib-geo/build.gradle.kts +++ b/here-naksha-lib-geo/build.gradle.kts @@ -6,6 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.JsSourceMapNamesPolicy plugins { id("org.jetbrains.kotlin.multiplatform") kotlin("plugin.js-plain-objects") + id("naksha.publish") + id("naksha.java") + + // uncomment spotless to add license comments + // id("naksha.spotless-kotlin") } kotlin { @@ -39,7 +44,7 @@ kotlin { commonMain { dependencies { implementation(kotlin("stdlib-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) implementation(project(":here-naksha-lib-base")) } } @@ -48,7 +53,7 @@ kotlin { implementation(kotlin("test")) implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) } } jvmMain { @@ -56,18 +61,18 @@ kotlin { dependencies { implementation(kotlin("stdlib-jdk8")) implementation(project(":here-naksha-lib-base")) - implementation("org.locationtech.jts:jts-core:1.19.0") + implementation(Lib.jts_core) } resources.setSrcDirs(resources.srcDirs + "$buildDir/dist/js/productionExecutable/") } jvmTest { dependencies { implementation(kotlin("test")) - implementation("org.locationtech.jts.io:jts-io-common:1.19.0") - implementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") - runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-api:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-params:5.5.2") + implementation(Lib.jts_io_common) + implementation(Lib.kotlintest_runner_junit5) + runtimeOnly(Lib.junit_jupiter_engine) + implementation(Lib.junit_jupiter_api) + implementation(Lib.junit_params) } } jsMain { @@ -100,3 +105,4 @@ tasks { maxHeapSize = "8g" } } +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-handlers/build.gradle.kts b/here-naksha-lib-handlers/build.gradle.kts new file mode 100644 index 000000000..e518e8713 --- /dev/null +++ b/here-naksha-lib-handlers/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + id("naksha.java") + id("naksha.publish") +} + +description = "Naksha Handlers library" +dependencies { + implementation(project(":here-naksha-lib-core")) + implementation(project(":here-naksha-lib-psql")) + implementation(project(":here-naksha-lib-view")) + implementation(project(":here-naksha-storage-http")) + + implementation(Lib.commons_lang3) + implementation(Lib.commons_dbutils) + + testImplementation(Lib.mockito) + testImplementation(Lib.json_assert) + testImplementation(testFixtures(project(":here-naksha-lib-core"))) +} + setOverallCoverage(0.0) \ No newline at end of file diff --git a/here-naksha-lib-heapcache/build.gradle.kts b/here-naksha-lib-heapcache/build.gradle.kts new file mode 100644 index 000000000..8cf0aad94 --- /dev/null +++ b/here-naksha-lib-heapcache/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + id("naksha.java") + id("naksha.publish") +} +description = "Naksha Heap Caching Library" +java { + withJavadocJar() + withSourcesJar() +} +dependencies { + api(project(":here-naksha-lib-core")) + testImplementation(Lib.mockito) + implementation(Lib.jts_core) +} +setOverallCoverage(0.5) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-hub/build.gradle.kts b/here-naksha-lib-hub/build.gradle.kts new file mode 100644 index 000000000..79c459c96 --- /dev/null +++ b/here-naksha-lib-hub/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + id("naksha.java") + id("naksha.publish") +} +description = "NakshaHub library" +dependencies { + implementation(project(":here-naksha-lib-core")) + implementation(project(":here-naksha-lib-psql")) + implementation(project(":here-naksha-lib-handlers")) + implementation(project(":here-naksha-lib-ext-manager")) + + implementation(Lib.commons_lang3) + implementation(Lib.jts_core) + implementation(Lib.postgres) + implementation(Lib.aws_s3) + + testImplementation(Lib.json_assert) + testImplementation(Lib.mockito) +} +setOverallCoverage(0.2) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-jbon/build.gradle.kts b/here-naksha-lib-jbon/build.gradle.kts index fd4be7cb5..32e2a09c5 100644 --- a/here-naksha-lib-jbon/build.gradle.kts +++ b/here-naksha-lib-jbon/build.gradle.kts @@ -6,6 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.JsSourceMapNamesPolicy plugins { id("org.jetbrains.kotlin.multiplatform") kotlin("plugin.js-plain-objects") + id("naksha.publish") + id("naksha.java") + + // uncomment spotless to add license comments + // id("naksha.spotless-kotlin") } kotlin { @@ -39,7 +44,7 @@ kotlin { commonMain { dependencies { api(kotlin("stdlib-common")) - api("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + api(Lib.kotlinx_datetime) api(project(":here-naksha-lib-base")) } } @@ -48,7 +53,7 @@ kotlin { implementation(kotlin("test")) implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) implementation(project(":here-naksha-lib-base")) } } @@ -56,8 +61,8 @@ kotlin { jvmToolchain(11) dependencies { implementation(kotlin("stdlib-jdk8")) - api("org.lz4:lz4-java:1.8.0") - implementation("org.slf4j:slf4j-simple:2.0.13") + api(Lib.lz4_java) + implementation(Lib.slf4j_console) } resources.setSrcDirs(resources.srcDirs + "${layout.buildDirectory}/dist/js/productionExecutable/") } @@ -85,3 +90,4 @@ tasks { maxHeapSize = "8g" } } +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-model/build.gradle.kts b/here-naksha-lib-model/build.gradle.kts index 52a63782e..a288e09d3 100644 --- a/here-naksha-lib-model/build.gradle.kts +++ b/here-naksha-lib-model/build.gradle.kts @@ -7,6 +7,11 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack plugins { id("org.jetbrains.kotlin.multiplatform") kotlin("plugin.js-plain-objects") + id("naksha.publish") + id("naksha.java") + + // uncomment spotless to add license comments + // id("naksha.spotless-kotlin") } kotlin { @@ -40,7 +45,7 @@ kotlin { commonMain { dependencies { implementation(kotlin("stdlib-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) api(project(":here-naksha-lib-base")) api(project(":here-naksha-lib-geo")) api(project(":here-naksha-lib-jbon")) @@ -54,7 +59,7 @@ kotlin { implementation(kotlin("test-annotations-common")) implementation("org.mockito.kotlin:mockito-kotlin:5.4.0") implementation("org.mockito:mockito-core:5.13.0") - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) } } jvmMain { @@ -70,7 +75,7 @@ kotlin { } jvmTest { dependencies { - implementation("org.mockito:mockito-core:5.8.0") + implementation(Lib.mockito) } } jsMain { diff --git a/here-naksha-lib-psql/build.gradle.kts b/here-naksha-lib-psql/build.gradle.kts index c2f00447d..f8e7cb3f3 100644 --- a/here-naksha-lib-psql/build.gradle.kts +++ b/here-naksha-lib-psql/build.gradle.kts @@ -6,6 +6,11 @@ import org.jetbrains.kotlin.gradle.dsl.JsSourceMapNamesPolicy plugins { id("org.jetbrains.kotlin.multiplatform") kotlin("plugin.js-plain-objects") + id("naksha.java") + id("naksha.publish") + + // uncomment spotless to add license comments + // id("naksha.spotless-kotlin") } kotlin { @@ -44,7 +49,7 @@ kotlin { api(project(":here-naksha-lib-model")) api(project(":here-naksha-lib-geo")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) } } commonTest { @@ -52,7 +57,7 @@ kotlin { implementation(kotlin("test")) implementation(kotlin("test-common")) implementation(kotlin("test-annotations-common")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) } } jvmMain { @@ -65,15 +70,15 @@ kotlin { api(project(":here-naksha-lib-model")) api(project(":here-naksha-lib-geo")) - implementation("org.apache.commons:commons-lang3:3.12.0") - implementation("org.postgresql:postgresql:42.5.4") - implementation("org.testcontainers:postgresql:1.19.4") - implementation("commons-dbutils:commons-dbutils:1.7") - implementation("org.locationtech.jts:jts-core:1.19.0") - implementation("org.locationtech.jts.io:jts-io-common:1.19.0") + implementation(Lib.commons_lang3) + implementation(Lib.postgres) + implementation(Lib.test_containers_postgres) + implementation(Lib.commons_dbutils) + implementation(Lib.jts_core) + implementation(Lib.jts_io_common) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") - implementation("org.postgresql:postgresql:42.5.4") + implementation(Lib.kotlinx_datetime) + implementation(Lib.postgres) } // TODO: We should replace ${project.buildDir} with ${layout.buildDirectory}, but this is not the same: // println("------------ ${project.buildDir}/dist/js/productionExecutable/") @@ -83,17 +88,17 @@ kotlin { jvmTest { dependencies { implementation(kotlin("test")) - implementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") - runtimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-api:5.5.2") - implementation("org.junit.jupiter:junit-jupiter-params:5.5.2") - implementation("org.slf4j:slf4j-api:2.0.13") - implementation("org.slf4j:slf4j-simple:2.0.13") - implementation("org.testcontainers:postgresql:1.19.4") - implementation("org.postgresql:postgresql:42.5.4") - implementation("org.mockito:mockito-core:5.8.0") - implementation("org.mockito.kotlin:mockito-kotlin:5.3.1") - implementation("org.locationtech.spatial4j:spatial4j:0.8") + implementation(Lib.kotlintest_runner_junit5) + runtimeOnly(Lib.junit_jupiter_engine) + implementation(Lib.junit_jupiter_api) + implementation(Lib.junit_params) + implementation(Lib.slf4j_api) + implementation(Lib.slf4j_console) + implementation(Lib.test_containers_postgres) + implementation(Lib.postgres) + implementation(Lib.mockito) + implementation(Lib.mockito_kotlin) + implementation(Lib.spatial4j) } } jsMain { @@ -104,7 +109,7 @@ kotlin { api(project(":here-naksha-lib-model")) api(project(":here-naksha-lib-geo")) - implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.5.0") + implementation(Lib.kotlinx_datetime) //implementation(npm("postgres", "3.4.4")) } } @@ -137,4 +142,5 @@ tasks { useJUnitPlatform() maxHeapSize = "8g" } -} \ No newline at end of file +} +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-lib-view/build.gradle.kts b/here-naksha-lib-view/build.gradle.kts new file mode 100644 index 000000000..847636e48 --- /dev/null +++ b/here-naksha-lib-view/build.gradle.kts @@ -0,0 +1,23 @@ +description = "Naksha View Library" + +plugins { + id("naksha.java") + id("naksha.publish") +} + +java { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + withJavadocJar() + withSourcesJar() +} +dependencies { + api(project(":here-naksha-lib-core")) + implementation(project(":here-naksha-lib-psql")) + + implementation(Lib.commons_lang3) + testImplementation(Lib.mockito) + testImplementation(project(":here-naksha-lib-psql")) + testImplementation(Lib.jts_core) +} +setOverallCoverage(0.0) // only increasing allowed! \ No newline at end of file diff --git a/here-naksha-storage-http/build.gradle.kts b/here-naksha-storage-http/build.gradle.kts new file mode 100644 index 000000000..396437dc0 --- /dev/null +++ b/here-naksha-storage-http/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + id("naksha.java") + id("naksha.publish") +} +description = "Naksha Http Storage Module" +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + withJavadocJar() + withSourcesJar() +} +dependencies { + implementation(project(":here-naksha-lib-core")) + implementation(project(":here-naksha-common-http")) + + implementation(Lib.commons_lang3) + + testImplementation(Lib.mockito) +} +setOverallCoverage(0.0) // only increasing allowed! diff --git a/settings.gradle.kts b/settings.gradle.kts index 9685ef561..3432300f7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,6 +1,7 @@ pluginManagement { repositories { maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/bootstrap") + maven("https://plugins.gradle.org/m2/") gradlePluginPortal() } }