Skip to content

Commit

Permalink
Merge pull request #72 from valery1707/gradle/version-catalog
Browse files Browse the repository at this point in the history
Use `version catalog` for dependencies
  • Loading branch information
mergify[bot] authored Dec 29, 2022
2 parents 3add6f3 + e8a7c9d commit 76d175f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
4 changes: 2 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@

[![Mergify Status](https://img.shields.io/endpoint.svg?url=https://api.mergify.com/v1/badges/valery1707/problem-solving&style=flat)](https://dashboard.mergify.com/github/valery1707/repo/problem-solving)

Версии зависимостей контролируются плагином [com.palantir.consistent-versions](https://github.com/palantir/gradle-consistent-versions).
Версии зависимостей управляются через функционал [version catalog](https://docs.gradle.org/current/userguide/platforms.html) (см. файл [libs.versions.toml](gradle/libs.versions.toml)) и валидируются плагином [com.palantir.consistent-versions](https://github.com/palantir/gradle-consistent-versions) (см. файл [versions.lock](versions.lock)).

Сами версии записаны в файле [versions.props](versions.props), обновления файла [versions.lock](versions.lock) выполняется командой `./gradlew --write-locks`.
Обновление файла зависимостей выполняется командой `./gradlew --write-locks`.
26 changes: 13 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Remove when https://youtrack.jetbrains.com/issue/KTIJ-19369 and https://github.com/gradle/gradle/issues/22797 are fixed
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
kotlin("jvm") version "1.7.22"
id("me.champeau.jmh") version "0.6.8"
id("com.palantir.consistent-versions") version "2.11.0"
id("org.jetbrains.kotlinx.kover") version "0.6.1"
id("org.sonarqube") version "3.4.0.2513"
kotlin("jvm") version libs.versions.kotlin
alias(libs.plugins.jmh)
alias(libs.plugins.consistent.versions)
alias(libs.plugins.kover)
alias(libs.plugins.sonarqube)
}

group = "name.valery1707"
version = "0.1.0-SNAPSHOT"

val jmhVersionCust = "1.36"

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_17.majorVersion))
Expand All @@ -25,15 +25,15 @@ repositories {
}

dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind:2.14.1")
implementation("net.andreinc:mockneat:0.4.8")
implementation(libs.jackson.databind)
implementation(libs.mockneat)

testImplementation(kotlin("test"))
testImplementation(platform("org.junit:junit-bom"))
testImplementation(platform(libs.junit))
testImplementation("org.junit.jupiter:junit-jupiter-params")
testImplementation("org.assertj:assertj-core")
testImplementation(libs.assertj)

jmhAnnotationProcessor("org.openjdk.jmh:jmh-generator-annprocess:$jmhVersionCust")
jmhAnnotationProcessor(libs.jmh.ann)
}

//Encoding
Expand All @@ -56,7 +56,7 @@ tasks.withType<Test> {

jmh {
//https://github.com/melix/jmh-gradle-plugin#configuration-options
jmhVersion.set(jmhVersionCust)
jmhVersion.set(libs.versions.jmh.tools)
}

sonarqube {
Expand Down
21 changes: 21 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[versions]
kotlin = "1.7.22"
jackson = "2.14.1"
junit = "5.9.1"
jmh-plugin = "0.6.8"
jmh-tools = "1.36"

[libraries]
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson" }
junit = { module = "org.junit:junit-bom", version.ref = "junit" }
assertj = { module = "org.assertj:assertj-core", version = "3.23.1" }
mockneat = { module = "net.andreinc:mockneat", version = "0.4.8" }
jmh-ann = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh.tools" }

[bundles]

[plugins]
jmh = { id = "me.champeau.jmh", version = "0.6.8" }
kover = { id = "org.jetbrains.kotlinx.kover", version = "0.6.1" }
sonarqube = { id = "org.sonarqube", version = "3.4.0.2513" }
consistent-versions = { id = "com.palantir.consistent-versions", version = "2.11.0" }
4 changes: 4 additions & 0 deletions settings-gradle.lockfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
empty=incomingCatalogForLibs0
2 changes: 0 additions & 2 deletions versions.props
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
org.junit:junit-bom = 5.9.1
org.assertj:assertj-core = 3.23.1

0 comments on commit 76d175f

Please sign in to comment.