diff --git a/build.gradle b/build.gradle index 01c5389..785f626 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + /* * Copyright © 2017-2024 Kynetics, Inc. * @@ -9,22 +11,14 @@ */ plugins { - id 'org.jetbrains.kotlin.jvm' version '1.8.10' - id 'io.gitlab.arturbosch.detekt' version '1.17.1' - id 'jacoco' - id 'java' - id 'com.github.jk1.dependency-license-report' version '1.16' - id("org.jetbrains.dokka") version "1.6.10" - id "org.sonarqube" version "4.4.1.3373" -} - -repositories { - mavenCentral() - mavenLocal() + id 'java' apply true + id 'jacoco' apply true + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.license.report) apply true + alias(libs.plugins.dokka) apply false + alias(libs.plugins.sonarqube) apply true } -final def deps = gradle.settings.app_dependencies -final def tdeps = gradle.settings.test_dependencies final def app_version = '2.0.0' ext.keep_test_container_alive = project.hasProperty('keep_test_container_alive') ? project.getProperty('keep_test_container_alive').toBoolean() : false @@ -45,19 +39,16 @@ sonar { allprojects { apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'maven-publish' - apply from: "$rootDir/ktlint.gradle" apply plugin: 'java' - apply plugin: "org.jetbrains.dokka" apply plugin: "org.sonarqube" - repositories { - mavenCentral() - mavenLocal() - } + apply from: "$rootDir/ktlint.gradle" + dependencies { - implementation deps.kotlin_stdlib - implementation deps.kotlin_x - implementation deps.joda + + implementation libs.kotlin.stdlib + implementation libs.kotlin.coroutines.jdk8 + implementation libs.joda.time } publishing { @@ -70,8 +61,7 @@ allprojects { java { toolchain { - languageVersion = JavaLanguageVersion.of(11) - vendor = JvmVendorSpec.ADOPTOPENJDK + languageVersion = JavaLanguageVersion.of(17) } } } @@ -84,20 +74,19 @@ project(':ddi-consumer') { dependencies { implementation project(subprj) implementation project(':hara-ddiclient-api') - implementation deps.retrofit_converter + implementation libs.retrofit.converter.gson } allprojects { dependencies { - implementation deps.okhttp - implementation deps.retrofit - implementation deps.slf4j_api - + implementation libs.okhttp + implementation libs.retrofit + implementation libs.slf4j.api } } project(subprj) { dependencies { - implementation deps.gson - testImplementation tdeps.testng + implementation libs.gson + testImplementation libs.testng } test { useTestNG() @@ -118,7 +107,7 @@ project(':hara-ddiclient-api') { group 'org.eclipse.hara.hara-ddiclient.api' version app_version dependencies { - implementation deps.okhttp + implementation libs.okhttp } } @@ -133,16 +122,18 @@ project(':virtual-device'){ implementation project(':hara-ddiclient-api') implementation project(':ddi-consumer') implementation project(':ddi-consumer:ddi-api') - implementation deps.slf4j_simple - implementation deps.okhttp - testImplementation deps.kotlin_stdlib - testImplementation deps.kotlin_x - testImplementation tdeps.testng - testImplementation tdeps.mockk - testImplementation deps.retrofit - testImplementation deps.okhttp - testImplementation deps.okhttp_logging - testImplementation deps.retrofit_converter + + implementation libs.okhttp + implementation libs.slf4j.simple + + testImplementation libs.kotlin.stdlib + testImplementation libs.kotlin.coroutines.jdk8 + testImplementation libs.testng + testImplementation libs.mockk + testImplementation libs.retrofit + testImplementation libs.okhttp + testImplementation libs.okhttp.logging + testImplementation libs.retrofit.converter.gson } jacocoTestReport { @@ -168,9 +159,15 @@ project(':virtual-device'){ mainClassName = 'org.eclipse.hara.ddiclient.virtualdevice.MainKt' - tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { + tasks.withType(KotlinCompile).configureEach { kotlinOptions.freeCompilerArgs += ["-opt-in=kotlin.RequiresOptIn"] } + + tasks.withType(JavaCompile).configureEach { + javaCompiler = javaToolchains.compilerFor { + languageVersion = JavaLanguageVersion.of(17) + } + } } boolean doHead(url) { @@ -183,13 +180,6 @@ boolean doHead(url) { } } -detekt { - toolVersion = "1.17.1" - config = files("$rootDir/default-detekt-config.yml", "$rootDir/detekt-config.yml") - input = files("$projectDir") - buildUponDefaultConfig = true -} - jacocoTestReport { dependsOn tasks.withType(Test) @@ -309,15 +299,17 @@ dependencies{ implementation project(':hara-ddiclient-api') implementation project(':ddi-consumer') implementation project(':ddi-consumer:ddi-api') - implementation deps.slf4j_api - implementation deps.joda - implementation deps.gson - implementation deps.retrofit_converter - testImplementation tdeps.testng - testImplementation deps.kotlin_stdlib - testImplementation deps.kotlin_x - testImplementation deps.joda - testImplementation deps.okhttp - testImplementation deps.okhttp_logging - testImplementation deps.retrofit + + implementation libs.slf4j.api + implementation libs.joda.time + implementation libs.gson + implementation libs.retrofit.converter.gson + + testImplementation libs.testng + testImplementation libs.kotlin.stdlib + testImplementation libs.kotlin.coroutines.jdk8 + testImplementation libs.joda.time + testImplementation libs.okhttp + testImplementation libs.okhttp.logging + testImplementation libs.retrofit } diff --git a/dependencies.gradle b/dependencies.gradle deleted file mode 100644 index 5b844ac..0000000 --- a/dependencies.gradle +++ /dev/null @@ -1,32 +0,0 @@ -/* -* Copyright © 2017-2024 Kynetics, Inc. -* -* This program and the accompanying materials are made -* available under the terms of the Eclipse Public License 2.0 -* which is available at https://www.eclipse.org/legal/epl-2.0/ -* -* SPDX-License-Identifier: EPL-2.0 -*/ -ext { - javaSourceCompatibility = '1.8' - retrofitVersion = '2.9.0' - okhttpVersion = '4.9.3' - slf4jVersion = '1.7.33' - - app_dependencies = [ - slf4j_api:"org.slf4j:slf4j-api:$slf4jVersion", - slf4j_simple:"org.slf4j:slf4j-simple:$slf4jVersion", - kotlin_stdlib: 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10', - kotlin_x: 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.6.1', - gson: 'com.google.code.gson:gson:2.8.9', - retrofit: "com.squareup.retrofit2:retrofit:$retrofitVersion", - retrofit_converter: "com.squareup.retrofit2:converter-gson:$retrofitVersion", - okhttp: "com.squareup.okhttp3:okhttp:${okhttpVersion}", - okhttp_logging: "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}", - joda:'joda-time:joda-time:2.10.13' - ] - test_dependencies = [ - testng: 'org.testng:testng:7.9.0', - mockk: 'io.mockk:mockk:1.12.0' - ] -} diff --git a/docker/client/Dockerfile b/docker/client/Dockerfile index 2df17fd..c61d936 100644 --- a/docker/client/Dockerfile +++ b/docker/client/Dockerfile @@ -7,7 +7,7 @@ # # SPDX-License-Identifier: EPL-2.0 # -FROM eclipse-temurin:11 +FROM eclipse-temurin:17 COPY ./virtual-device /client diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..6c28f4b --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,34 @@ +[versions] +dokka = "1.9.20" +gson = "2.10.1" +jodaTime = "2.10.14" +kotlin = "1.9.23" +kotlinxCoroutines = "1.8.1" +license-report = "1.16" +mockk = "1.12.0" +okhttp = "4.9.3" +retrofit = "2.9.0" +slf4j = "2.0.16" +sonarqube = "5.1.0.4882" +testng = "7.9.0" + +[libraries] +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +joda-time = { module = "joda-time:joda-time", version.ref = "jodaTime" } +kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } +kotlin-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinxCoroutines" } +mockk = { module = "io.mockk:mockk", version.ref = "mockk" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +okhttp-logging = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } +retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +retrofit-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } +slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } +slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" } +testng = { module = "org.testng:testng", version.ref = "testng" } + +[plugins] +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +license-report = { id = "com.github.jk1.dependency-license-report", version.ref = "license-report" } +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } +sonarqube = { id = "org.sonarqube", version.ref = "sonarqube" } + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..ec2a41f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Dec 16 09:41:12 CET 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/ktlint.gradle b/ktlint.gradle index 5ebcc5b..7857dc1 100644 --- a/ktlint.gradle +++ b/ktlint.gradle @@ -1,13 +1,10 @@ -repositories { - mavenCentral() -} - configurations { ktlint } dependencies { - ktlint "com.pinterest:ktlint:0.34.2"} + ktlint "com.pinterest:ktlint:0.34.2" +} task checkStyle(type: JavaExec, group: "klint") { description = "Check Kotlin code style." diff --git a/settings.gradle b/settings.gradle index 8151ae6..40d28a6 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,17 +1,36 @@ /* -* Copyright © 2017-2024 Kynetics, Inc. -* -* This program and the accompanying materials are made -* available under the terms of the Eclipse Public License 2.0 -* which is available at https://www.eclipse.org/legal/epl-2.0/ -* -* SPDX-License-Identifier: EPL-2.0 -*/ + * Copyright © 2017-2024 Kynetics, Inc. + * + * All Rights Reserved. + */ + +pluginManagement { + repositories { + google { + content { + includeGroupByRegex("com\\.android.*") + includeGroupByRegex("com\\.google.*") + includeGroupByRegex("androidx.*") + } + } + mavenCentral() + gradlePluginPortal() + } +} plugins { id "com.gradle.enterprise" version "3.16.1" } +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + } +} + gradleEnterprise { buildScan { termsOfServiceUrl = "https://gradle.com/terms-of-service" @@ -28,6 +47,4 @@ rootProject.name = 'hara-ddiclient' include ':ddi-consumer' include ':ddi-consumer:ddi-api' include ':hara-ddiclient-api' -include ':virtual-device' - -apply from: 'dependencies.gradle' +include ':virtual-device' \ No newline at end of file diff --git a/virtual-device/src/main/kotlin/org/eclipse/hara/ddiclient/virtualdevice/Main.kt b/virtual-device/src/main/kotlin/org/eclipse/hara/ddiclient/virtualdevice/Main.kt index 9dc1f5b..b8ff743 100644 --- a/virtual-device/src/main/kotlin/org/eclipse/hara/ddiclient/virtualdevice/Main.kt +++ b/virtual-device/src/main/kotlin/org/eclipse/hara/ddiclient/virtualdevice/Main.kt @@ -14,6 +14,7 @@ import okhttp3.OkHttpClient import org.eclipse.hara.ddiclient.api.HaraClientDefaultImpl import org.eclipse.hara.ddiclient.api.HaraClientData import org.eclipse.hara.ddiclient.virtualdevice.entrypoint.* +import org.slf4j.simple.SimpleLogger.DEFAULT_LOG_LEVEL_KEY import java.time.Duration import kotlin.random.Random.Default.nextLong @@ -21,7 +22,7 @@ val virtualMachineGlobalScope = CoroutineScope(Dispatchers.Default) fun main() { Configuration.apply { - System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, logLevel) + System.setProperty(DEFAULT_LOG_LEVEL_KEY, logLevel) val connTimeoutDuration = Duration.ofSeconds(connectTimeout) val callTimeoutDuration = Duration.ofSeconds(callTimeout) val readTimeoutDuration = Duration.ofSeconds(readTimeout)