Skip to content

Commit 1b45729

Browse files
committed
build: separate build & target versions
1 parent 9c6a273 commit 1b45729

8 files changed

Lines changed: 112 additions & 38 deletions

File tree

‎build.gradle.kts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
33
plugins {
44
`java-library`
55
groovy
6-
kotlin
7-
alias(libs.plugins.versions)
8-
alias(libs.plugins.sonar)
9-
alias(libs.plugins.updates)
6+
kotlin("jvm")
7+
alias(build.plugins.versions)
8+
alias(build.plugins.sonar)
109
id("openapiprocessor.test")
1110
id("openapiprocessor.testInt")
1211
id("openapiprocessor.publish")
1312
id("openapiprocessor.coverage")
13+
id("openapiprocessor.versions")
1414
id("openapiprocessor.newapi")
1515
}
1616

@@ -34,7 +34,6 @@ kotlin {
3434
jvmToolchain(libs.versions.build.jdk.get().toInt())
3535

3636
compilerOptions {
37-
freeCompilerArgs.add("-Xannotation-default-target=param-property")
3837
jvmTarget = JvmTarget.fromTarget(libs.versions.target.jdk.get())
3938
}
4039
}
@@ -103,6 +102,7 @@ dependencies {
103102

104103
tasks.withType<Test>().configureEach {
105104
jvmArgs(listOf(
105+
"-Xshare:off",
106106
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
107107
"--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
108108
"--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
@@ -137,6 +137,7 @@ sonarqube {
137137
property("sonar.projectKey", "openapi-processor_openapi-processor-spring")
138138
property("sonar.organization", "openapi-processor")
139139
property("sonar.host.url", "https://sonarcloud.io")
140-
property("sonar.coverage.jacoco.xmlReportPaths", layout.buildDirectory.dir("reports/jacoco/test/jacocoTestReport.xml").get().toString())
140+
property("sonar.coverage.jacoco.xmlReportPaths",
141+
layout.buildDirectory.dir("reports/jacoco/test/jacocoTestReport.xml").get().toString())
141142
}
142143
}

‎buildSrc/build.gradle.kts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ plugins {
44

55
dependencies {
66
// catalog hack: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
7+
implementation(files(build.javaClass.superclass.protectionDomain.codeSource.location))
78
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
89

9-
implementation(libs.plugin.kotlin)
10-
implementation(libs.plugin.build)
11-
implementation(libs.plugin.jacocolog)
10+
implementation(build.plugin.kotlin)
11+
implementation(build.plugin.updates)
12+
implementation(build.plugin.build)
13+
implementation(build.plugin.jacocolog)
1214

1315
implementation(platform(libs.jackson.bom))
1416
implementation(libs.jackson.kotlin)

‎buildSrc/settings.gradle.kts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ pluginManagement {
99

1010
dependencyResolutionManagement {
1111
versionCatalogs {
12+
create("build") {
13+
from(files("../gradle/build.versions.toml"))
14+
}
1215
create("libs") {
1316
from(files("../gradle/libs.versions.toml"))
1417
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
2+
3+
plugins {
4+
id("io.github.ben-manes.versions")
5+
}
6+
7+
val projectPath = project.path
8+
9+
tasks.named<DependencyUpdatesTask>("dependencyUpdates") {
10+
rejectVersionIf {
11+
// println("candidate: $candidate stable: ${!candidate.version.isNonStable()}")
12+
candidate.version.isNonStable()
13+
}
14+
15+
// outputFormatter {
16+
// exceeded.dependencies.removeIf { d -> ignore.contains("${d.group}:${d.name}") }
17+
//
18+
// val plainTextReporter = PlainTextReporter(
19+
// projectPath,
20+
// revision,
21+
// gradleReleaseChannel
22+
// )
23+
// plainTextReporter.write(System.out, this)
24+
// }
25+
}
26+
27+
fun String.isNonStable(): Boolean {
28+
val nonStable = listOf(
29+
".M[0-9]+$",
30+
".RC[0-9]*$",
31+
".alpha.?[0-9]+$",
32+
".beta.?[0-9]+$",
33+
)
34+
35+
for (n in nonStable) {
36+
if (this.contains("(?i)$n".toRegex())) {
37+
//println("not stable: $this")
38+
return true
39+
}
40+
}
41+
42+
return false
43+
}
44+
45+
val ignore = listOf(
46+
"org.checkerframework:jdk8"
47+
)

‎gradle.properties‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ projectRepo=openapi-processor/openapi-processor-spring
88
kotlin.jvm.target.validation.mode=ignore
99

1010
org.gradle.configuration-cache=true
11-
org.gradle.configuration-cache.parallel=true
11+
#org.gradle.configuration-cache.parallel=true
1212
org.gradle.warning.mode=all
13+
org.gradle.caching=true
1314

14-
org.gradle.jvmargs = -Xmx1g -Xms256m -XX:MaxMetaspaceSize=512m \
15+
org.gradle.jvmargs =-Xshare:off -Xmx1g -Xms256m -XX:MaxMetaspaceSize=512m \
1516
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
1617
--add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
1718
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \

‎gradle/build.versions.toml‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# plugins used by the build and the convention plugins
2+
3+
[versions]
4+
build-plugins = "2026.7"
5+
6+
target-jdk = "17"
7+
build-jdk = "21"
8+
9+
kotlin = "2.4.10"
10+
11+
checker = "0.6.61"
12+
jacoco = "0.8.15"
13+
jacocolog = "4.0.1"
14+
updates = "0.61.0"
15+
16+
[libraries]
17+
plugin-build = { module = "io.openapiprocessor:build-plugins", version.ref = "build-plugins" }
18+
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
19+
plugin-updates = { module = "io.github.ben-manes:gradle-versions-plugin", version.ref = "updates" }
20+
plugin-jacocolog = { module = "org.barfuin.gradle.jacocolog:org.barfuin.gradle.jacocolog.gradle.plugin", version.ref = "jacocolog" }
21+
22+
[plugins]
23+
openapiprocessor-publish = { id = "io.openapiprocessor.build.plugin.publish", version.ref = "build-plugins" }
24+
openapiprocessor-bump = { id = "io.openapiprocessor.build.plugin.bump", version.ref = "build-plugins" }
25+
openapiprocessor-central = { id = "io.openapiprocessor.build.plugin.publish-central", version.ref = "build-plugins" }
26+
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
27+
jacoco = { id = "org.barfuin.gradle.jacocolog", version.ref = "jacocolog" }
28+
jacocolog = { id = "org.barfuin.gradle.jacocolog" }
29+
updates = { id = "io.github.ben-manes.versions", version = "0.61.0" }
30+
publish = { id = "io.openapiprocessor.build.plugin.publish" }
31+
versions = { id = "io.openapiprocessor.build.plugin.create-versions" }
32+
sonar = { id = "org.sonarqube", version = "7.3.1.8318" }

‎gradle/libs.versions.toml‎

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
[versions]
22
processor = "2026.4-SNAPSHOT"
33

4-
kotlin = "2.4.10"
5-
target-jdk = "11"
6-
build-jdk = "17"
74
build-plugins = "2026.7"
8-
95
api = "2024.2"
106
base = "2026.3.1"
117

12-
jacoco = "0.8.14"
8+
target-jdk = "11"
9+
build-jdk = "17"
10+
11+
kotlin = "2.4.10"
12+
13+
jacoco = "0.8.15"
1314
jacocolog = "4.0.1"
1415

1516
spring-web = "7.0.8"
@@ -43,21 +44,3 @@ mockk = "io.mockk:mockk:1.14.11"
4344

4445
groovy-bom = "org.apache.groovy:groovy-bom:5.0.8"
4546
spock = "org.spockframework:spock-core:2.4-groovy-5.0"
46-
47-
# for buildSrc convention plugins
48-
plugin-build = { module = "io.openapiprocessor:build-plugins", version.ref = "build-plugins" }
49-
plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
50-
#plugin-checker = { module = "org.checkerframework:checkerframework-gradle-plugin", version.ref = "checker" }
51-
#plugin-updates = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "updates" }
52-
plugin-jacocolog = { module = "org.barfuin.gradle.jacocolog:org.barfuin.gradle.jacocolog.gradle.plugin", version.ref = "jacocolog" }
53-
#plugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
54-
#plugin-checker = "org.checkerframework:checkerframework-gradle-plugin:0.6.5"
55-
#plugin-outdated = "com.github.ben-manes:gradle-versions-plugin:0.53.0"
56-
57-
[plugins]
58-
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
59-
jacoco = { id = "org.barfuin.gradle.jacocolog", version.ref = "jacocolog" }
60-
updates = { id = "com.github.ben-manes.versions", version = "0.59.0" }
61-
sonar = { id = "org.sonarqube", version = "7.3.1.8318" }
62-
versions = { id = "io.openapiprocessor.build.plugin.create-versions" }
63-
publish = { id = "io.openapiprocessor.build.plugin.publish" }

‎settings.gradle.kts‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
plugins {
2-
id("com.gradle.develocity").version("4.5.0")
3-
}
4-
51
dependencyResolutionManagement {
62
repositories {
73
mavenCentral()
@@ -12,6 +8,15 @@ dependencyResolutionManagement {
128
}
139
}
1410
}
11+
versionCatalogs {
12+
create("build") {
13+
from(files("./gradle/build.versions.toml"))
14+
}
15+
}
16+
}
17+
18+
plugins {
19+
id("com.gradle.develocity").version("4.5.0")
1520
}
1621

1722
develocity {

0 commit comments

Comments
 (0)