Skip to content

Commit

Permalink
Moved dependencies to version catalog (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
babisRoutis authored Oct 5, 2023
1 parent 616078c commit aa8475d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 14 deletions.
48 changes: 34 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
import kotlin.jvm.optionals.getOrNull

plugins {
id("org.jetbrains.dokka") version "1.8.20"
id("org.springframework.boot") version "3.1.2"
id("io.spring.dependency-management") version "1.1.3"
kotlin("jvm") version "1.9.0"
kotlin("plugin.serialization") version "1.9.0"
kotlin("plugin.spring") version "1.9.0"
id("com.diffplug.spotless") version "6.20.0"
base
alias(libs.plugins.dokka)
alias(libs.plugins.spring.boot)
alias(libs.plugins.spring.dependency.management)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.plugin.spring)
alias(libs.plugins.kotlin.plugin.serialization)
alias(libs.plugins.spotless)
}

repositories {
Expand All @@ -19,26 +21,33 @@ repositories {
mavenLocal()
}

val presentationExchangeVersion = "0.1.0-SNAPSHOT"
val nimbusSdkVersion = "10.13.2"

dependencies {
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("eu.europa.ec.eudi:eudi-lib-jvm-presentation-exchange-kt:$presentationExchangeVersion")
implementation("com.nimbusds:oauth2-oidc-sdk:$nimbusSdkVersion")
implementation(libs.presentation.exchange)
implementation(libs.nimbusds.oauth2.oidc.sdk)
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.projectreactor:reactor-test")
}

java {
val javaVersion = getVersionFromCatalog("java")
sourceCompatibility = JavaVersion.toVersion(javaVersion)
}

kotlin {
jvmToolchain(17)

jvmToolchain {
val javaVersion = getVersionFromCatalog("java")
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
}


testing {
suites {
val test by getting(JvmTestSuite::class) {
Expand All @@ -55,8 +64,9 @@ tasks.named<BootBuildImage>("bootBuildImage") {
imageName.set("$group/${project.name}")
}

val ktlintVersion = "0.50.0"

spotless {
val ktlintVersion = getVersionFromCatalog("ktlintVersion")
kotlin {
ktlint(ktlintVersion)
licenseHeaderFile("FileHeader.txt")
Expand All @@ -65,3 +75,13 @@ spotless {
ktlint(ktlintVersion)
}
}


fun getVersionFromCatalog(lookup: String): String {
val versionCatalog: VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
return versionCatalog
.findVersion(lookup)
.getOrNull()
?.requiredVersion
?: throw GradleException("Version '$lookup' is not specified in the version catalog")
}
30 changes: 30 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[versions]
coroutines = "1.7.3"
dokka = "1.9.0"
kotlin = "1.9.10"
foojay = "0.7.0"
springboot = "3.1.4"
springDependencyManagement = "1.1.3"
spotless = "6.20.0"
java = "17"
kotlinxSerialization = "1.6.0"
oauth2OidcSdk="10.13.2"
presentationExchange="0.1.0-SNAPSHOT"
ktlintVersion="0.50.0"


[libraries]
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
nimbusds-oauth2-oidc-sdk = {module ="com.nimbusds:oauth2-oidc-sdk", version.ref="oauth2OidcSdk"}
presentation-exchange = {module ="eu.europa.ec.eudi:eudi-lib-jvm-presentation-exchange-kt", version.ref="presentationExchange"}

[plugins]
foojay-resolver-convention = { id = "org.gradle.toolchains.foojay-resolver-convention", version.ref = "foojay" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
spring-boot = { id = "org.springframework.boot", version.ref = "springboot" }
spring-dependency-management = { id = "io.spring.dependency-management", version.ref = "springDependencyManagement" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

0 comments on commit aa8475d

Please sign in to comment.