spring-boot/spring-boot-project/spring-boot-tools/spring-boot-configuration-metadata-changelog-generator/build.gradle
2023-07-01 00:30:26 +01:00

59 lines
2.0 KiB
Groovy

plugins {
id "java"
id "org.springframework.boot.conventions"
}
description = "Spring Boot Configuration Metadata Changelog Generator"
configurations {
oldMetadata
newMetadata
}
dependencies {
implementation(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies")))
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-configuration-metadata"))
testImplementation(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies")))
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter")
}
if (project.hasProperty("oldVersion") && project.hasProperty("newVersion")) {
dependencies {
["spring-boot",
"spring-boot-actuator",
"spring-boot-actuator-autoconfigure",
"spring-boot-autoconfigure",
"spring-boot-devtools",
"spring-boot-test-autoconfigure"].each {
oldMetadata("org.springframework.boot:$it:$oldVersion")
newMetadata("org.springframework.boot:$it:$newVersion")
}
}
def prepareOldMetadata = tasks.register("prepareOldMetadata", Sync) {
from(configurations.oldMetadata)
if (project.hasProperty("oldVersion")) {
destinationDir = project.file("build/configuration-metadata-diff/$oldVersion")
}
}
def prepareNewMetadata = tasks.register("prepareNewMetadata", Sync) {
from(configurations.newMetadata)
if (project.hasProperty("newVersion")) {
destinationDir = project.file("build/configuration-metadata-diff/$newVersion")
}
}
tasks.register("generate", JavaExec) {
inputs.files(prepareOldMetadata, prepareNewMetadata)
outputs.file(project.file("build/configuration-metadata-changelog.adoc"))
classpath = sourceSets.main.runtimeClasspath
mainClass = 'org.springframework.boot.configurationmetadata.changelog.ChangelogGenerator'
if (project.hasProperty("oldVersion") && project.hasProperty("newVersion")) {
args = [project.file("build/configuration-metadata-diff/$oldVersion"), project.file("build/configuration-metadata-diff/$newVersion"), project.file("build/configuration-metadata-changelog.adoc")]
}
}
}