Skip to content

Commit 34f7c00

Browse files
authored
deps: Upgrade JGit to address CVE-2025-4949 and build system modernizations
* test: Do not rely on the current working directory in functional tests Create a clean temporary directory instead. * build: Migrate dependency versions to a version catalog A central version catalog is easier to maintain and has become the de-facto standard. * build: Remove the Kotlin stdlib as an explicit dependency The Kotlin Gradle Plugin add this automatically. * deps: Upgrade JGit to address CVE-2025-4949
1 parent 1abfe94 commit 34f7c00

File tree

3 files changed

+34
-11
lines changed

3 files changed

+34
-11
lines changed

build.gradle.kts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ plugins {
33
`java-gradle-plugin`
44

55
// Apply the Kotlin JVM plugin to add support for Kotlin.
6-
kotlin("jvm") version "1.9.10"
7-
id("com.gradle.plugin-publish") version "1.2.1"
8-
id("com.github.jmongard.git-semver-plugin") version "0.13.0"
6+
alias(libs.plugins.kotlin.jvm)
7+
alias(libs.plugins.plugin.publish)
8+
alias(libs.plugins.git.semver)
99
id("jacoco")
1010
}
1111

@@ -22,14 +22,13 @@ repositories {
2222
}
2323

2424
dependencies {
25-
implementation(kotlin("stdlib"))
26-
implementation("org.eclipse.jgit:org.eclipse.jgit:7.1.0.202411261347-r")
27-
implementation("org.eclipse.jgit:org.eclipse.jgit.gpg.bc:7.1.0.202411261347-r")
28-
implementation("org.slf4j:slf4j-api:1.7.36")
25+
implementation(libs.jgit.core)
26+
implementation(libs.jgit.gpg)
27+
implementation(libs.slf4j.api)
2928

30-
testImplementation(kotlin("test-junit5"))
31-
testImplementation("org.junit.jupiter:junit-jupiter-params")
32-
testImplementation("org.assertj:assertj-core:3.27.2")
29+
testImplementation(libs.kotlin.test.junit5)
30+
testImplementation(libs.junit.jupiter.params)
31+
testImplementation(libs.assertj.core)
3332
}
3433

3534
gradlePlugin {

gradle/libs.versions.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[versions]
2+
assertj = "3.27.2"
3+
git-semver-plugin = "0.13.0"
4+
jgit = "7.3.0.202506031305-r"
5+
kotlin = "1.9.10"
6+
plugin-publish = "1.2.1"
7+
slf4j = "1.7.36"
8+
9+
[plugins]
10+
git-semver = { id = "com.github.jmongard.git-semver-plugin", version.ref = "git-semver-plugin" }
11+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
12+
plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "plugin-publish" }
13+
14+
[libraries]
15+
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertj" }
16+
jgit-core = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "jgit" }
17+
jgit-gpg = { module = "org.eclipse.jgit:org.eclipse.jgit.gpg.bc", version.ref = "jgit" }
18+
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params" }
19+
kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5" }
20+
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }

src/functionalTest/kotlin/git/semver/plugin/gradle/GitSemverPluginFunctionalTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import org.eclipse.jgit.api.Git
55
import org.gradle.testkit.runner.BuildResult
66
import org.gradle.testkit.runner.GradleRunner
77
import org.junit.jupiter.api.Test
8+
import org.junit.jupiter.api.io.TempDir
89
import org.junit.jupiter.params.ParameterizedTest
910
import org.junit.jupiter.params.provider.Arguments
1011
import org.junit.jupiter.params.provider.CsvSource
@@ -18,6 +19,9 @@ import java.io.File
1819
class GitSemverPluginFunctionalTest {
1920

2021
companion object {
22+
@TempDir
23+
lateinit var tempDir: File
24+
2125
@JvmStatic
2226
fun gradleVersions(): List<Arguments> {
2327
return listOf(
@@ -125,7 +129,7 @@ class GitSemverPluginFunctionalTest {
125129
""".trimIndent();
126130

127131
// Setup the test build
128-
val projectDir = File("build/functionalTest")
132+
val projectDir = tempDir.resolve("build/functionalTest")
129133
projectDir.mkdirs()
130134
projectDir.resolve(".gitignore").writeText(".gradle")
131135
projectDir.resolve("settings.gradle").writeText("include ':sub1'")

0 commit comments

Comments
 (0)