mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
158 lines
4.8 KiB
Groovy
158 lines
4.8 KiB
Groovy
plugins {
|
|
id "java-gradle-plugin"
|
|
id "maven-publish"
|
|
id "org.asciidoctor.jvm.convert"
|
|
id "org.springframework.boot.conventions"
|
|
id "org.springframework.boot.maven-repository"
|
|
id "org.springframework.boot.optional-dependencies"
|
|
}
|
|
|
|
description = "Spring Boot Gradle Plugins"
|
|
|
|
configurations {
|
|
documentation
|
|
"testCompileClasspath" {
|
|
// Downgrade SLF4J is required for tests to run in Eclipse
|
|
resolutionStrategy.force("org.slf4j:slf4j-api:1.7.36")
|
|
}
|
|
all {
|
|
resolutionStrategy {
|
|
eachDependency { dependency ->
|
|
// Downgrade Jackson as Gradle cannot cope with 2.15.0's multi-version
|
|
// jar files with bytecode in META-INF/versions/19
|
|
if (dependency.requested.group.startsWith("com.fasterxml.jackson")) {
|
|
dependency.useVersion("2.14.2")
|
|
}
|
|
// Downgrade Spring Framework as Gradle cannot cope with 6.1.0-M1's
|
|
// multi-version jar files with bytecode in META-INF/versions/21
|
|
if (dependency.requested.group.equals("org.springframework")) {
|
|
dependency.useVersion("6.0.10")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
asciidoctorExtensions("io.spring.asciidoctor:spring-asciidoctor-extensions-section-ids")
|
|
|
|
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.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") {
|
|
exclude(group: "commons-logging", module: "commons-logging")
|
|
}
|
|
|
|
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
|
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-gradle-test-support"))
|
|
testImplementation("com.tngtech.archunit:archunit-junit5:0.22.0")
|
|
testImplementation("org.assertj:assertj-core")
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
testImplementation("org.mockito:mockito-core")
|
|
testImplementation("org.testcontainers:junit-jupiter")
|
|
testImplementation("org.testcontainers:testcontainers")
|
|
}
|
|
|
|
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"
|
|
}
|
|
}
|
|
}
|
|
|
|
task preparePluginValidationClasses(type: Copy) {
|
|
destinationDir = layout.buildDirectory.dir("classes/java/pluginValidation").get().asFile
|
|
from(sourceSets.main.output.classesDirs) {
|
|
exclude "**/CreateBootStartScripts.class"
|
|
}
|
|
}
|
|
|
|
validatePlugins {
|
|
classes.setFrom preparePluginValidationClasses
|
|
enableStricterValidation = true
|
|
}
|
|
|
|
task dependencyVersions(type: org.springframework.boot.build.constraints.ExtractVersionConstraints) {
|
|
enforcedPlatform(":spring-boot-project:spring-boot-dependencies")
|
|
}
|
|
|
|
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
|
|
dependsOn dependencyVersions
|
|
inputs.dir('src/docs/gradle').withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('buildScripts')
|
|
doFirst {
|
|
attributes "dependency-management-plugin-version": dependencyVersions.versionConstraints["io.spring.gradle:dependency-management-plugin"]
|
|
}
|
|
}
|
|
|
|
tasks.named('test') {
|
|
inputs.dir('src/docs/gradle').withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName('buildScripts')
|
|
}
|
|
|
|
asciidoctor {
|
|
sources {
|
|
include "index.adoc"
|
|
}
|
|
}
|
|
|
|
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
|
|
sources {
|
|
include "index.adoc"
|
|
}
|
|
}
|
|
|
|
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
|
|
attributes "native-build-tools-version": nativeBuildToolsVersion
|
|
}
|
|
|
|
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/"
|
|
}
|
|
}
|
|
|
|
task zip(type: Zip) {
|
|
dependsOn asciidoctor, asciidoctorPdf
|
|
duplicatesStrategy "fail"
|
|
from(asciidoctorPdf.outputDir) {
|
|
into "reference/pdf"
|
|
rename "index.pdf", "${project.name}-reference.pdf"
|
|
}
|
|
from(asciidoctor.outputDir) {
|
|
into "reference/htmlsingle"
|
|
}
|
|
from(javadoc) {
|
|
into "api"
|
|
}
|
|
}
|
|
|
|
artifacts {
|
|
"documentation" zip
|
|
}
|
|
|
|
toolchain {
|
|
maximumCompatibleJavaVersion = JavaLanguageVersion.of(20)
|
|
}
|