Use gradle version catalogs

This commit is contained in:
William Brawner 2022-06-02 20:28:44 -06:00
parent cee28c0e1e
commit 58c6508d0a
11 changed files with 71 additions and 53 deletions

View file

@ -1,20 +1,18 @@
plugins {
kotlin("jvm")
kotlin("plugin.serialization") version "1.5.20"
alias(libs.plugins.kotlin.serialization)
`java-library`
}
val ktorVersion: String by rootProject.extra
dependencies {
implementation(kotlin("stdlib"))
api(project(":core"))
implementation(project(":storage"))
api("io.ktor:ktor-server-core:$ktorVersion")
api("io.ktor:ktor-serialization:$ktorVersion")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
api(libs.ktor.server.core)
api(libs.ktor.serialization)
api(libs.kotlin.coroutines.core)
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
}
tasks.getByName<Test>("test") {

View file

@ -5,7 +5,7 @@ plugins {
java
kotlin("jvm")
application
id("com.github.johnrengelman.shadow") version "7.0.0"
alias(libs.plugins.shadow)
}
repositories {
@ -16,24 +16,20 @@ repositories {
}
}
val kotlinVersion: String by rootProject.extra
val ktorVersion: String by rootProject.extra
dependencies {
implementation(project(":api"))
implementation(project(":core"))
implementation(project(":db"))
implementation(project(":web"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("io.ktor:ktor-server-core:$ktorVersion")
implementation("io.ktor:ktor-server-cio:$ktorVersion")
implementation("io.ktor:ktor-server-sessions:$ktorVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
implementation("ch.qos.logback:logback-classic:1.2.8")
implementation(libs.kotlin.reflect)
implementation(libs.ktor.server.core)
implementation(libs.ktor.server.cio)
implementation(libs.ktor.server.sessions)
implementation(libs.kotlin.coroutines.core)
implementation(libs.logback)
testImplementation(project(":testhelpers"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
}
description = "twigs-server"

View file

@ -2,21 +2,19 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI
buildscript {
val kotlinVersion: String by extra("1.6.10")
val ktorVersion: String by extra("1.6.6")
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath(libs.kotlin.gradle)
}
}
plugins {
java
kotlin("jvm") version "1.5.20"
alias(libs.plugins.kotlin.jvm)
}
allprojects {

View file

@ -1,16 +1,14 @@
plugins {
kotlin("jvm")
`java-library`
kotlin("jvm")
}
val ktorVersion: String by rootProject.extra
dependencies {
implementation(kotlin("stdlib"))
api("io.ktor:ktor-auth:$ktorVersion")
api("at.favre.lib:bcrypt:0.9.0")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
api(libs.ktor.auth)
api(libs.bcrypt)
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
}
tasks.getByName<Test>("test") {

View file

@ -8,11 +8,11 @@ val ktorVersion: String by rootProject.extra
dependencies {
implementation(kotlin("stdlib"))
api(project(":storage"))
implementation("org.postgresql:postgresql:42.3.1")
api("com.zaxxer:HikariCP:5.0.0")
implementation("ch.qos.logback:logback-classic:1.2.8")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
implementation(libs.postgres)
api(libs.hikari)
implementation(libs.logback)
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
}
tasks.getByName<Test>("test") {

32
gradle/libs.versions.toml Normal file
View file

@ -0,0 +1,32 @@
[versions]
bcrypt = "0.9.0"
hikari = "5.0.1"
junit = "5.8.2"
kotlin = "1.6.21"
kotlin-coroutines = "1.6.1"
ktor = "1.6.6"
logback = "1.2.11"
postgres = "42.3.4"
shadow = "7.0.0"
[libraries]
bcrypt = { module = "at.favre.lib:bcrypt", version.ref = "bcrypt" }
hikari = { module = "com.zaxxer:HikariCP", version.ref = "hikari" }
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine" }
kotlin-coroutines-core = { module = "org.jetbrains.kotlin:kotlin-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-coroutines-test = { module = "org.jetbrains.kotlin:kotlin-coroutines-test", version.ref = "kotlin-coroutines" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
ktor-auth = { module = "io.ktor:ktor-auth", version.ref = "ktor" }
ktor-serialization = { module = "io.ktor:ktor-serialization", version.ref = "ktor" }
ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" }
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-sessions = { module = "io.ktor:ktor-server-sessions", version.ref = "ktor" }
logback = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
postgres = { module = "org.postgresql:postgresql", version.ref = "postgres" }
[plugins]
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }

View file

@ -1,5 +1,5 @@
#Fri Feb 07 18:11:46 CST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists

View file

@ -1,3 +1,3 @@
rootProject.name = "twigs"
include("core", "api", "app", "storage", "db", "web")
include("testhelpers")
include("testhelpers")

View file

@ -3,14 +3,12 @@ plugins {
`java-library`
}
val ktorVersion: String by rootProject.extra
dependencies {
implementation(kotlin("stdlib"))
api(project(":core"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
api(libs.kotlin.coroutines.core)
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
}
tasks.getByName<Test>("test") {

View file

@ -6,7 +6,7 @@ plugins {
dependencies {
implementation(kotlin("stdlib"))
implementation(project(":storage"))
api("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2")
api("org.junit.jupiter:junit-jupiter-api:5.8.2")
api("org.junit.jupiter:junit-jupiter-engine")
api(libs.kotlin.coroutines.test)
api(libs.junit.jupiter.api)
runtimeOnly(libs.junit.jupiter.engine)
}

View file

@ -1,17 +1,15 @@
import java.util.*
plugins {
kotlin("jvm")
`java-library`
alias(libs.plugins.kotlin.jvm)
}
val ktorVersion: String by rootProject.extra
dependencies {
implementation(kotlin("stdlib"))
api("io.ktor:ktor-server-core:$ktorVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
api(libs.ktor.server.core)
testImplementation(libs.junit.jupiter.api)
testRuntimeOnly(libs.junit.jupiter.engine)
}
tasks.getByName<Test>("test") {