diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index b3d7284..ec04a74 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -26,7 +26,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '11' distribution: 'temurin' - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index db8bec8..58dcc21 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '11' distribution: 'temurin' - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b diff --git a/build.gradle.kts b/build.gradle.kts index ef85622..a286e39 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,12 +3,14 @@ repositories { mavenCentral() } +@Suppress("DSL_SCOPE_VIOLATION") plugins { - kotlin("jvm") + kotlin("jvm") version libs.versions.kotlin.get() `java-library` `maven-publish` signing - id("io.github.gradle-nexus.publish-plugin") + alias(libs.plugins.versions) + alias(libs.plugins.nexusPublishPlugin) id("java-test-fixtures") } @@ -16,50 +18,31 @@ group = "com.target" dependencies { - val kotlinReflectVersion: String by project - implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinReflectVersion") - - val hikariCPVersion: String by project - implementation("com.zaxxer:HikariCP:$hikariCPVersion") - - val logbackVersion: String by project - implementation("ch.qos.logback:logback-classic:$logbackVersion") - val kotlinLoggingVersion: String by project - implementation("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingVersion") - val slf4jVersion: String by project - implementation("org.slf4j:slf4j-api:$slf4jVersion") - - val healthMonitorInterfaceVersion: String by project - api("com.target:health-monitor-interface:$healthMonitorInterfaceVersion") - - val mockkVersion: String by project - testFixturesApi("io.mockk:mockk:$mockkVersion") - - val junitVersion: String by project - testImplementation(kotlin("test-junit5")) - testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion") - val kotestVersion: String by project - testImplementation("io.kotest:kotest-assertions-core:$kotestVersion") - testImplementation("io.kotest:kotest-property:$kotestVersion") - testImplementation("io.kotest:kotest-extensions:$kotestVersion") - testImplementation("io.mockk:mockk:$mockkVersion") - val testContainersVersion: String by project - testImplementation("org.testcontainers:testcontainers:$testContainersVersion") - testImplementation("org.testcontainers:junit-jupiter:$testContainersVersion") - - val postgresqlVersion: String by project - testImplementation("org.postgresql:postgresql:$postgresqlVersion") - - val h2Version: String by project - testApi("com.h2database:h2:$h2Version") + implementation(libs.kotlinReflect) + + implementation(libs.hikariCP) + + implementation(libs.kotlinLogging) + + api(libs.healthMonitorInterface) + + testFixturesApi(libs.mockk) + + testImplementation(libs.bundles.testing) + + testImplementation(libs.bundles.testContainers) + + testImplementation(libs.postgresql) + + testApi(libs.h2) } val jvmTargetVersion: String by project + tasks { - compileJava { options.release.set(jvmTargetVersion.toInt()) } - compileKotlin { kotlinOptions { jvmTarget = jvmTargetVersion } } - compileTestKotlin { kotlinOptions { jvmTarget = jvmTargetVersion } } + // This line configures the target JVM version. For applications, it's typically the latest LTS version. + // For libraries, it's typically the earliest LTS version. + java { toolchain { languageVersion.set(JavaLanguageVersion.of(jvmTargetVersion)) } } withType { useJUnitPlatform() diff --git a/gradle.properties b/gradle.properties index f3025fb..563c680 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,23 +2,6 @@ version=0.0.1-SNAPSHOT jvmTargetVersion=11 -nexusPublishPluginVersion=1.1.0 -kotlinPluginVersion=1.7.10 -testContainersVersion=1.17.6 -postgresqlVersion=42.5.1 - -kotlinReflectVersion=1.6.10 -hikariCPVersion=5.0.1 -logbackVersion=1.4.0 -kotlinLoggingVersion=2.1.23 -slf4jVersion=2.0.0 -healthMonitorInterfaceVersion=1.2.0 - -junitVersion=5.9.0 -kotestVersion=5.4.2 -mockkVersion=1.12.7 -h2Version=2.1.214 - # Properties used by the publishing plugin projectTitle=Lite For JDBC projectDescription=Lightweight library to help simplify JDBC database access diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..a3a7cea --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,48 @@ +[versions] +kotlin = "1.8.10" + +kotlinLogging = "3.0.5" + +versionsPlugin = "0.46.0" +nexusPublishPlugin = "1.3.0" + +hikariCP = "5.0.1" +healthMonitorInterface = "1.2.0" + +jupiter = "5.9.2" +kotest = "5.5.5" +mockk = "1.13.4" +testContainers = "1.17.6" +postgresql = "42.5.4" +h2 = "2.1.214" + +[libraries] +kotlinLogging = { module = "io.github.microutils:kotlin-logging-jvm", version.ref = "kotlinLogging" } + +kotlinReflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" } + +hikariCP = { module = "com.zaxxer:HikariCP", version.ref = "hikariCP" } +healthMonitorInterface = { module = "com.target:health-monitor-interface", version.ref = "healthMonitorInterface" } + +jupiterApi = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "jupiter" } +jupiterEngine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "jupiter" } +jupiterParams = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "jupiter" } +kotestAssertionsCore = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } +kotestJunit5= { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" } +kotestProperty = { module = "io.kotest:kotest-property", version.ref = "kotest" } +kotestAssertionsJson = { module = "io.kotest:kotest-assertions-json", version.ref = "kotest" } +kotestExtensions = { module = "io.kotest:kotest-extensions", version.ref = "kotest" } +mockk = { module = "io.mockk:mockk", version.ref = "mockk" } +testContainers = { module = "org.testcontainers:testcontainers", version.ref = "testContainers" } +testContainersJunit = { module = "org.testcontainers:junit-jupiter", version.ref = "testContainers" } + +postgresql = { module = "org.postgresql:postgresql", version.ref = "postgresql" } +h2 = { module = "com.h2database:h2", version.ref = "h2" } + +[bundles] +testing = ["jupiterApi", "jupiterEngine", "jupiterParams", "kotestAssertionsCore", "kotestJunit5", "kotestProperty", "kotestAssertionsJson", "kotestExtensions", "mockk"] +testContainers = ["testContainers", "testContainersJunit"] + +[plugins] +versions = { id = "com.github.ben-manes.versions", version.ref = "versionsPlugin" } +nexusPublishPlugin = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublishPlugin" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..e1bef7e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle.kts b/settings.gradle.kts index aa5235e..338ff02 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,10 +1 @@ rootProject.name = "lite-for-jdbc" - -pluginManagement { - val kotlinPluginVersion: String by settings - val nexusPublishPluginVersion: String by settings - plugins { - kotlin("jvm") version kotlinPluginVersion - id("io.github.gradle-nexus.publish-plugin") version nexusPublishPluginVersion - } -}