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

View file

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

View file

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

View file

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

View file

@ -8,11 +8,11 @@ val ktorVersion: String by rootProject.extra
dependencies { dependencies {
implementation(kotlin("stdlib")) implementation(kotlin("stdlib"))
api(project(":storage")) api(project(":storage"))
implementation("org.postgresql:postgresql:42.3.1") implementation(libs.postgres)
api("com.zaxxer:HikariCP:5.0.0") api(libs.hikari)
implementation("ch.qos.logback:logback-classic:1.2.8") implementation(libs.logback)
testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2") testImplementation(libs.junit.jupiter.api)
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") testRuntimeOnly(libs.junit.jupiter.engine)
} }
tasks.getByName<Test>("test") { 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 #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 distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View file

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

View file

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

View file

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

View file

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