Skip to content

Commit 9feea7a

Browse files
Merge branch 'release-v2.2.x'
2 parents 0005543 + feeed6e commit 9feea7a

26 files changed

Lines changed: 121 additions & 131 deletions

.github/workflows/gradle-build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- "release-*"
99
paths:
1010
- ".github/workflows/gradle-build.yml"
11-
- "buildSrc/**"
1211
- "gradle/**"
1312
- "**/src/**"
1413
- "**/*.gradle.kts"

.github/workflows/gradle-dependency-submission.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- "release-*"
99
paths:
1010
- ".github/workflows/gradle-dependency-submission.yml"
11-
- "buildSrc/**"
1211
- "gradle/**"
1312
- "**/*.gradle.kts"
1413
- "gradle.properties"

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Prioritize changes in the module matching the Spring integration in context.
1616

1717
## Build & Validate
1818

19-
Requires **JDK 17+**. Dependencies managed in `gradle/libs.versions.toml`. Custom Gradle plugins live in `buildSrc`.
19+
Requires **JDK 17+**. Dependencies managed in `gradle/libs.versions.toml`. Custom Gradle plugins live in `build-logic`.
2020

2121
```shell
2222
./gradlew # default: spotlessApply build (preferred)
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
// Note that usage of version catalogs in buildSrc is not as straightforward as in regular modules.
1+
// Note that usage of version catalogs in build-logic is not as straightforward as in regular modules.
22
// For more information, see:
33
// https://docs.gradle.org/current/userguide/version_catalogs.html#sec:buildsrc-version-catalog
44
plugins {
55
`kotlin-dsl`
66
}
77

8-
version = "current"
9-
10-
repositories {
11-
gradlePluginPortal()
12-
mavenCentral()
13-
}
14-
158
dependencies {
169
implementation(plugin(libs.plugins.errorprone))
1710
implementation(plugin(libs.plugins.idea.ext))

build-logic/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Project Settings
2+
group=io.github.problem4j
3+
version=latest
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1-
// Note that usage of version catalogs in buildSrc is not as straightforward as in regular modules.
1+
// Note that usage of version catalogs in build-logic is not as straightforward as in regular modules.
22
// For more information, see:
33
// https://docs.gradle.org/current/userguide/version_catalogs.html#sec:buildsrc-version-catalog
44
pluginManagement {
55
repositories {
66
gradlePluginPortal()
7+
mavenCentral()
78
}
89
}
910

1011
dependencyResolutionManagement {
12+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
13+
repositories {
14+
gradlePluginPortal()
15+
mavenCentral()
16+
}
1117
versionCatalogs {
1218
create("libs") {
1319
from(files("../gradle/libs.versions.toml"))
1420
}
1521
}
1622
}
1723

18-
rootProject.name = "buildSrc"
24+
rootProject.name = "build-logic"

buildSrc/src/main/kotlin/internal.errorprone-convention.gradle.kts renamed to build-logic/src/main/kotlin/internal.errorprone-convention.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import internal.isTestTask
22
import net.ltgt.gradle.errorprone.errorprone
33

44
plugins {
5-
id("internal.java-convention")
5+
id("java")
66
id("net.ltgt.errorprone")
77
}
88

buildSrc/src/main/kotlin/internal.idea-convention.gradle.kts renamed to build-logic/src/main/kotlin/internal.idea-convention.gradle.kts

File renamed without changes.

buildSrc/src/main/kotlin/internal.jacoco-convention.gradle.kts renamed to build-logic/src/main/kotlin/internal.jacoco-convention.gradle.kts

File renamed without changes.

buildSrc/src/main/kotlin/internal.java-convention.gradle.kts renamed to build-logic/src/main/kotlin/internal.java-library-convention.gradle.kts

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
22
import org.gradle.api.tasks.testing.logging.TestLogEvent
33

44
plugins {
5-
id("internal.common-convention")
65
id("java-library")
76
}
87

@@ -19,18 +18,36 @@ plugins {
1918
// Tests are NOT compiled with --release XYZ, so they may use newer Java APIs.
2019

2120
java {
22-
toolchain.languageVersion = JavaLanguageVersion.of(25)
21+
toolchain {
22+
languageVersion = JavaLanguageVersion.of(25)
23+
}
24+
withSourcesJar()
25+
withJavadocJar()
2326
}
2427

2528
tasks.withType<JavaCompile>().configureEach {
2629
options.compilerArgs.add("-parameters")
2730
options.encoding = "UTF-8"
2831
}
2932

30-
tasks.named<JavaCompile>("compileJava") {
33+
tasks.named<JavaCompile>("compileJava").configure {
3134
options.release = 17
3235
}
3336

37+
tasks.withType<Jar>().configureEach {
38+
manifest {
39+
attributes["Implementation-Title"] = project.name
40+
attributes["Implementation-Version"] = project.version
41+
attributes["Build-Jdk-Spec"] = java.toolchain.languageVersion.get().toString()
42+
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
43+
attributes["Automatic-Module-Name"] = project.name.replace('-', '.')
44+
}
45+
from("${rootProject.rootDir}/LICENSE") {
46+
into("META-INF/")
47+
rename { "LICENSE.txt" }
48+
}
49+
}
50+
3451
tasks.withType<Test>().configureEach {
3552
useJUnitPlatform()
3653

@@ -51,14 +68,20 @@ tasks.withType<Javadoc>().configureEach {
5168
javadocTool = javaToolchains.javadocToolFor { languageVersion = JavaLanguageVersion.of(17) }
5269
}
5370

54-
tasks.withType<Jar>().configureEach {
55-
manifest {
56-
attributes["Implementation-Title"] = project.name
57-
attributes["Implementation-Version"] = project.version
58-
attributes["Created-By"] = "Gradle ${gradle.gradleVersion}"
59-
}
60-
from("${rootProject.rootDir}/LICENSE") {
61-
into("META-INF/")
62-
rename { "LICENSE.txt" }
71+
// Usage:
72+
// ./gradlew printVersion
73+
tasks.register<DefaultTask>("printVersion") {
74+
description = "Prints the current project version to the console."
75+
group = "help"
76+
77+
val projectName = project.name
78+
val projectVersion = project.version.toString()
79+
80+
doLast {
81+
println("$projectName version: $projectVersion")
6382
}
6483
}
84+
85+
tasks.withType<PublishToMavenLocal>().configureEach {
86+
finalizedBy("printVersion")
87+
}

0 commit comments

Comments
 (0)