Skip to content

Commit aa072cd

Browse files
author
Joel Mongård
committed
build!: Upgrade to Gradle 9.2.1 (and Kotlin 1.8 making this incompatible with Gradle 7)
1 parent 5d0eb6e commit aa072cd

File tree

11 files changed

+37
-38
lines changed

11 files changed

+37
-38
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ tasks.named<KotlinCompile>("compileKotlin") {
7878
jvmTarget = JvmTarget.JVM_17
7979

8080
// See https://docs.gradle.org/current/userguide/compatibility.html#kotlin.
81-
languageVersion = @Suppress("DEPRECATION") KotlinVersion.KOTLIN_1_4
82-
apiVersion = @Suppress("DEPRECATION") KotlinVersion.KOTLIN_1_4
81+
languageVersion = @Suppress("DEPRECATION") KotlinVersion.KOTLIN_1_8
82+
apiVersion = @Suppress("DEPRECATION") KotlinVersion.KOTLIN_1_8
8383
}
8484
}
8585

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[versions]
2-
assertj = "3.27.3"
2+
assertj = "3.27.6"
33
git-semver-plugin = "0.16.1"
4-
jgit = "7.3.0.202506031305-r"
5-
kotlin = "2.0.0"
4+
jgit = "7.4.0.202509020913-r"
5+
kotlin = "2.2.0"
66
plugin-publish = "1.3.1"
77
slf4j = "2.0.17"
88

gradle/wrapper/gradle-wrapper.jar

1.83 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
#
4-
# Copyright © 2015-2021 the original authors.
4+
# Copyright © 2015 the original authors.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
114114
NONSTOP* ) nonstop=true ;;
115115
esac
116116

117-
CLASSPATH="\\\"\\\""
118117

119118

120119
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
172171
# For Cygwin or MSYS, switch paths to Windows format before running java
173172
if "$cygwin" || "$msys" ; then
174173
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
175-
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
176174

177175
JAVACMD=$( cygpath --unix "$JAVACMD" )
178176

@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
212210

213211
set -- \
214212
"-Dorg.gradle.appname=$APP_BASE_NAME" \
215-
-classpath "$CLASSPATH" \
216213
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
217214
"$@"
218215

gradlew.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ goto fail
7070
:execute
7171
@rem Setup the command line
7272

73-
set CLASSPATH=
7473

7574

7675
@rem Execute Gradle
77-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
76+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
7877

7978
:end
8079
@rem End local scope for the variables with windows NT shell

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ class GitSemverPluginFunctionalTest {
2525
@JvmStatic
2626
fun gradleVersions(): List<Arguments> {
2727
return listOf(
28+
// Arguments.of("9.0.0"),
29+
Arguments.of("8.14.3"),
2830
// Arguments.of("8.6"),
29-
Arguments.of("8.7"),
30-
Arguments.of("7.6.4"),
31+
// Arguments.of("7.6.4"),
3132
// Arguments.of("6.9.4"),
3233
// Arguments.of("5.6.4")
3334
)
@@ -85,24 +86,21 @@ class GitSemverPluginFunctionalTest {
8586

8687
@ParameterizedTest
8788
@CsvSource(value = [
89+
"printChangeLog, added test files",
8890
"printVersion, \\d+\\.\\d+\\.\\d+",
8991
"printInfoVersion, \\d+\\.\\d+\\.\\d+-SNAPSHOT\\+\\d{3}",
9092
"printSemVersion, \\d+\\.\\d+\\.\\d+-SNAPSHOT\\+\\d{3}\\.sha"])
91-
fun `can run printVersion task`(printTask: String, pattern: String) {
93+
fun `can run print task`(printTask: String, pattern: String) {
9294
val projectDir = setupTestProject()
9395

94-
val result = run(projectDir, null, printTask, "-q")
96+
val result = run(projectDir, null, printTask, "--configuration-cache", "-q")
9597

9698
assertThat(result.output).containsPattern(pattern)
97-
}
98-
99-
@Test
100-
fun `can run printChangeLog task`() {
101-
val projectDir = setupTestProject()
10299

103-
val result = run(projectDir, null, "printChangeLog", "-q")
100+
//Run it again to make sure configuration cache don't break it
101+
val result2 = run(projectDir, null, printTask, "--configuration-cache", "-q")
104102

105-
assertThat(result.output).containsPattern("added test files")
103+
assertThat(result2.output).containsPattern(pattern)
106104
}
107105

108106
@Test

src/main/kotlin/git/semver/plugin/gradle/GitSemverPlugin.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class GitSemverPlugin: Plugin<Project> {
1616
override fun apply(project: Project) {
1717
val extension = project.extensions.create("semver", GitSemverPluginExtension::class.java, project)
1818

19-
project.tasks.register("printVersion", PrintTask::class.java, extension::versionValue, "Prints the current project version")
20-
project.tasks.register("printSemVersion", PrintTask::class.java, extension::semVersion, "Prints the current project semantic version")
21-
project.tasks.register("printInfoVersion", PrintTask::class.java, extension::infoVersion, "Prints the current project info version")
19+
project.tasks.register("printVersion", PrintTask::class.java, extension::versionValue, "Prints the current project version", "")
20+
project.tasks.register("printSemVersion", PrintTask::class.java, extension::semVersion, "Prints the current project semantic version", "")
21+
project.tasks.register("printInfoVersion", PrintTask::class.java, extension::infoVersion, "Prints the current project info version", "")
2222

2323
if (project == project.rootProject) {
2424
project.tasks.register("printChangeLog", PrintTask::class.java, {
@@ -30,7 +30,7 @@ class GitSemverPlugin: Plugin<Project> {
3030
settings,
3131
extension.changeLogTexts
3232
)
33-
}, "Prints a change log")
33+
}, "Prints a change log", "Not serializable configuration")
3434

3535
project.tasks.register("releaseVersion", ReleaseTask::class.java, extension)
3636
}

src/main/kotlin/git/semver/plugin/gradle/GitSemverPluginExtension.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import git.semver.plugin.semver.SemInfoVersion
66
import git.semver.plugin.semver.SemVersion
77
import git.semver.plugin.semver.SemverSettings
88
import org.gradle.api.Project
9-
import org.gradle.api.file.Directory
109
import org.gradle.api.file.DirectoryProperty
11-
import org.gradle.api.provider.Provider
10+
import org.gradle.api.provider.Property
1211
import org.gradle.api.provider.ProviderFactory
13-
import org.gradle.api.tasks.Internal
1412

1513

1614
abstract class GitSemverPluginExtension(project: Project, providerFactory: ProviderFactory) : BaseSettings() {
1715
init {
1816
gitDirectory.convention(project.layout.projectDirectory)
17+
createReleaseCommit.convention(true)
18+
createReleaseTag.convention(true)
1919
}
2020

2121
private val defaultPreReleaseProperty = project.findProperty("defaultPreRelease")
@@ -32,14 +32,14 @@ abstract class GitSemverPluginExtension(project: Project, providerFactory: Provi
3232
* This parameter can be overridden by command line argument to the release task.
3333
* Default: true.
3434
*/
35-
var createReleaseCommit = true
35+
abstract val createReleaseCommit: Property<Boolean>
3636

3737
/**
3838
* Should a release tag be created when running the release task.
3939
* This parameter can be overridden by command line argument to the release task.
4040
* Default: true.
4141
*/
42-
var createReleaseTag = true
42+
abstract val createReleaseTag: Property<Boolean>
4343

4444
/**
4545
* Format used when producing change log. Used to configure any predefined logging format.
@@ -50,6 +50,7 @@ abstract class GitSemverPluginExtension(project: Project, providerFactory: Provi
5050
* </ul>
5151
* The format can also be set using a builder.
5252
*/
53+
@Transient
5354
var changeLogFormat = ChangeLogFormat.defaultChangeLog
5455

5556
/**
@@ -80,6 +81,7 @@ abstract class GitSemverPluginExtension(project: Project, providerFactory: Provi
8081
* </ul>
8182
* The text can also be set using a builder.
8283
*/
84+
@Transient
8385
var changeLogTexts: ChangeLogTexts = DefaultChangeLogTexts
8486

8587
/**

src/main/kotlin/git/semver/plugin/gradle/PrintTask.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@ import javax.inject.Inject
1010
import kotlin.io.path.createDirectories
1111
import kotlin.io.path.writeText
1212

13-
open class PrintTask @Inject constructor(private val printout: () -> Any, desc: String) : DefaultTask() {
13+
open class PrintTask @Inject constructor(private val printout: () -> Any, desc: String, reason: String) : DefaultTask() {
1414
private var file:String? = null
1515
private val logger = LoggerFactory.getLogger(PrintTask::class.java)
1616

1717
init {
1818
group = GitSemverPlugin.VERSIONING_GROUP
1919
description = desc
20+
if (!reason.isEmpty()) {
21+
notCompatibleWithConfigurationCache(reason)
22+
}
2023
}
2124

2225
@Option(option = "file", description = "Print to a file ")

0 commit comments

Comments
 (0)