Skip to content

Commit

Permalink
Update build tools, Implement lib.versions.toml versioning
Browse files Browse the repository at this point in the history
Update gradle plugin to v8.5
Increase Java version to 17
Moved all dependencies definitions to lib.versions.toml file

Signed-off-by: Saeed Rezaee <[email protected]>
Signed-off-by: Saeed Rezaee <[email protected]>
  • Loading branch information
SaeedRe committed Dec 16, 2024
1 parent edc6bd0 commit 5f7df4a
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 113 deletions.
116 changes: 54 additions & 62 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* Copyright © 2017-2024 Kynetics, Inc.
*
Expand All @@ -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

Expand All @@ -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 {
Expand All @@ -70,8 +61,7 @@ allprojects {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
vendor = JvmVendorSpec.ADOPTOPENJDK
languageVersion = JavaLanguageVersion.of(17)
}
}
}
Expand All @@ -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()
Expand All @@ -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
}
}

Expand All @@ -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 {
Expand All @@ -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) {
Expand All @@ -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)

Expand Down Expand Up @@ -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
}
32 changes: 0 additions & 32 deletions dependencies.gradle

This file was deleted.

2 changes: 1 addition & 1 deletion docker/client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# SPDX-License-Identifier: EPL-2.0
#
FROM eclipse-temurin:11
FROM eclipse-temurin:17

COPY ./virtual-device /client

Expand Down
34 changes: 34 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }

3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
7 changes: 2 additions & 5 deletions ktlint.gradle
Original file line number Diff line number Diff line change
@@ -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."
Expand Down
39 changes: 28 additions & 11 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ 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

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)
Expand Down

0 comments on commit 5f7df4a

Please sign in to comment.