Skip to content

Commit 01757e7

Browse files
Move buildSrc to build-logic
1 parent 428523e commit 01757e7

22 files changed

Lines changed: 92 additions & 95 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.idea.ext))
1710
}

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.idea-convention.gradle.kts renamed to build-logic/src/main/kotlin/internal.idea-convention.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import org.jetbrains.gradle.ext.Application
21
import org.jetbrains.gradle.ext.Gradle
32
import org.jetbrains.gradle.ext.JUnit
43
import org.jetbrains.gradle.ext.runConfigurations

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-library-convention.gradle.kts renamed to build-logic/src/main/kotlin/internal.java-library-convention.gradle.kts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2+
import org.gradle.api.tasks.testing.logging.TestLogEvent
23

34
plugins {
4-
id("internal.common-convention")
55
id("java-library")
66
}
77

@@ -33,7 +33,7 @@ tasks.withType<Test>().configureEach {
3333
useJUnitPlatform()
3434

3535
testLogging {
36-
events("passed", "skipped", "failed", "standardOut", "standardError")
36+
events(TestLogEvent.FAILED, TestLogEvent.PASSED, TestLogEvent.SKIPPED)
3737
exceptionFormat = TestExceptionFormat.SHORT
3838
showStandardStreams = true
3939
}
@@ -45,7 +45,20 @@ tasks.withType<Test>().configureEach {
4545
systemProperty("user.country", "US")
4646
}
4747

48-
// buildSrc/src/main/kotlin/internal.common-convention.gradle.kts - "printVersion" task definition
48+
// Usage:
49+
// ./gradlew printVersion
50+
tasks.register<DefaultTask>("printVersion") {
51+
description = "Prints the current project version to the console."
52+
group = "help"
53+
54+
val projectName = project.name
55+
val projectVersion = project.version.toString()
56+
57+
doLast {
58+
println("$projectName version: $projectVersion")
59+
}
60+
}
61+
4962
tasks.withType<PublishToMavenLocal>().configureEach {
5063
finalizedBy("printVersion")
5164
}

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import internal.findLicenses
44
import internal.getBooleanProperty
55

66
plugins {
7-
id("internal.common-convention")
87
id("maven-publish")
98
id("signing")
109
}
@@ -32,8 +31,8 @@ publishing {
3231
pom {
3332
name = internalPublishing.displayName
3433
description = internalPublishing.description
35-
url = property("internal.pom.url") as String
36-
inceptionYear = property("internal.pom.inception-year") as String
34+
url = findProperty("internal.pom.url") as? String
35+
inceptionYear = findProperty("internal.pom.inception-year") as? String
3736
licenses {
3837
project.findLicenses().forEach {
3938
license {
@@ -57,13 +56,13 @@ publishing {
5756
}
5857
}
5958
scm {
60-
connection = property("internal.pom.scm.connection") as String
61-
developerConnection = property("internal.pom.scm.developer-connection") as String
62-
url = property("internal.pom.scm.url") as String
59+
connection = findProperty("internal.pom.scm.connection") as? String
60+
developerConnection = findProperty("internal.pom.scm.developer-connection") as? String
61+
url = findProperty("internal.pom.scm.url") as? String
6362
}
6463
issueManagement {
65-
system = property("internal.pom.issue-management.system") as String
66-
url = property("internal.pom.issue-management.url") as String
64+
system = findProperty("internal.pom.issue-management.system") as? String
65+
url = findProperty("internal.pom.issue-management.url") as? String
6766
}
6867
}
6968
}

0 commit comments

Comments
 (0)