This commit upgrades to Kotlin 2.1.0. Two related dependencies have been updated as well: Kotlin Coroutines to 1.10, and Kotlin Serialization to 1.8. As of Kotlin 2, it is no longer possible to have a Java type and a Kotlin type with the same name. As our code samples follow that unfortunate pattern, this commit makes sure that the Kotlin sample code does not depend on any of the Java counterpart and configure the kotlin compilation plugin to ignore Java sources. The minimum version of Gradle is 7.6.4. It bundles a version of Kotlin that cannot compile a Kotlin build script when spring-core, compiled with Kotlin 2.1, is on the classpath. Using Gradle 8.12 to run the DSL tests avoids the problem. Closes gh-45486 Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
160 lines
5.2 KiB
Groovy
160 lines
5.2 KiB
Groovy
import org.gradle.plugins.ide.eclipse.EclipsePlugin
|
|
import org.gradle.plugins.ide.eclipse.model.Classpath
|
|
import org.gradle.plugins.ide.eclipse.model.Library
|
|
|
|
plugins {
|
|
id "java-gradle-plugin"
|
|
id "maven-publish"
|
|
id "org.springframework.boot.antora-contributor"
|
|
id "org.springframework.boot.docker-test"
|
|
id "org.springframework.boot.maven-repository"
|
|
id "org.springframework.boot.optional-dependencies"
|
|
}
|
|
|
|
description = "Spring Boot Gradle Plugins"
|
|
|
|
configurations {
|
|
"testCompileClasspath" {
|
|
// Downgrade SLF4J is required for tests to run in Eclipse
|
|
resolutionStrategy.force("org.slf4j:slf4j-api:1.7.36")
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-gradle-test-support"))
|
|
dockerTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support-docker"))
|
|
dockerTestImplementation(gradleTestKit())
|
|
dockerTestImplementation("org.assertj:assertj-core")
|
|
dockerTestImplementation("org.junit.jupiter:junit-jupiter")
|
|
dockerTestImplementation("org.testcontainers:junit-jupiter")
|
|
dockerTestImplementation("org.testcontainers:testcontainers")
|
|
|
|
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform"))
|
|
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
|
|
implementation("io.spring.gradle:dependency-management-plugin")
|
|
implementation("org.apache.commons:commons-compress")
|
|
implementation("org.springframework:spring-core")
|
|
|
|
optional("org.graalvm.buildtools:native-gradle-plugin")
|
|
optional("org.cyclonedx:cyclonedx-gradle-plugin") {
|
|
exclude(group: "org.apache.maven", module: "maven-core")
|
|
}
|
|
optional("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") {
|
|
exclude(group: "commons-logging", module: "commons-logging")
|
|
}
|
|
|
|
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-gradle-test-support"))
|
|
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
|
testImplementation("com.fasterxml.jackson.core:jackson-databind")
|
|
testImplementation("com.fasterxml.jackson.module:jackson-module-parameter-names")
|
|
testImplementation("com.tngtech.archunit:archunit-junit5:1.4.0")
|
|
testImplementation("net.java.dev.jna:jna-platform")
|
|
testImplementation("org.apache.commons:commons-compress")
|
|
testImplementation("org.apache.httpcomponents.client5:httpclient5")
|
|
testImplementation("org.assertj:assertj-core")
|
|
testImplementation("org.graalvm.buildtools:native-gradle-plugin")
|
|
testImplementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
|
testImplementation("org.jetbrains.kotlin:kotlin-compiler-runner:$kotlinVersion")
|
|
testImplementation("org.jetbrains.kotlin:kotlin-daemon-client:$kotlinVersion")
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
testImplementation("org.mockito:mockito-core")
|
|
testImplementation("org.tomlj:tomlj:1.0.0")
|
|
}
|
|
|
|
repositories {
|
|
gradlePluginPortal() {
|
|
content {
|
|
includeGroup("org.cyclonedx")
|
|
}
|
|
}
|
|
}
|
|
|
|
gradlePlugin {
|
|
plugins {
|
|
springBootPlugin {
|
|
id = "org.springframework.boot"
|
|
displayName = "Spring Boot Gradle Plugin"
|
|
description = "Spring Boot Gradle Plugin"
|
|
implementationClass = "org.springframework.boot.gradle.plugin.SpringBootPlugin"
|
|
}
|
|
springBootAotPlugin {
|
|
id = "org.springframework.boot.aot"
|
|
displayName = "Spring Boot AOT Gradle Plugin"
|
|
description = "Spring Boot AOT Gradle Plugin"
|
|
implementationClass = "org.springframework.boot.gradle.plugin.SpringBootAotPlugin"
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register("preparePluginValidationClasses", Copy) {
|
|
destinationDir = layout.buildDirectory.dir("classes/java/pluginValidation").get().asFile
|
|
from(sourceSets.main.output.classesDirs) {
|
|
exclude "**/CreateBootStartScripts.class"
|
|
}
|
|
}
|
|
|
|
validatePlugins {
|
|
classes.setFrom preparePluginValidationClasses
|
|
enableStricterValidation = true
|
|
}
|
|
|
|
tasks.named('test') {
|
|
inputs.dir('src/docs/antora/modules/gradle-plugin/examples').withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('buildScripts')
|
|
}
|
|
|
|
javadoc {
|
|
options {
|
|
author = true
|
|
docTitle = "Spring Boot Gradle Plugin ${project.version} API"
|
|
encoding = "UTF-8"
|
|
memberLevel = "protected"
|
|
outputLevel = "quiet"
|
|
splitIndex = true
|
|
use = true
|
|
windowTitle = "Spring Boot Gradle Plugin ${project.version} API"
|
|
links "https://docs.gradle.org/$gradle.gradleVersion/javadoc"
|
|
links "https://docs.oracle.com/en/java/javase/17/docs/api"
|
|
}
|
|
}
|
|
|
|
antoraContributions {
|
|
'gradle-plugin' {
|
|
catalogContent {
|
|
from(javadoc) {
|
|
into("api/java")
|
|
}
|
|
}
|
|
localAggregateContent {
|
|
from(tasks.named("generateAntoraYml")) {
|
|
into "modules"
|
|
}
|
|
}
|
|
source()
|
|
}
|
|
}
|
|
|
|
tasks.named("generateAntoraPlaybook") {
|
|
antoraExtensions.xref.stubs = ["appendix:.*", "api:.*", "reference:.*"]
|
|
asciidocExtensions.excludeJavadocExtension = true
|
|
}
|
|
|
|
plugins.withType(EclipsePlugin) {
|
|
eclipse {
|
|
classpath.file { merger ->
|
|
merger.whenMerged { content ->
|
|
if (content instanceof Classpath) {
|
|
content.entries.each { entry ->
|
|
if (entry instanceof Library && (entry.path.contains("gradle-api-") || entry.path.contains("groovy-"))) {
|
|
entry.entryAttributes.remove("test")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
toolchain {
|
|
maximumCompatibleJavaVersion = JavaLanguageVersion.of(23)
|
|
}
|