Prior to this commit, the ApiDiff Gradle task would be configured for all submodules of the Spring Framework project and would assume that they all existed for the baseline version considered for the API diff. This would cause issues when: * the sub-project is not published as it's not an official "spring-*" module * the "spring-*" module is new and did not exist for the baseline version This commit ensures that only "spring-*" modules are considered for this task and that we trigger an early resolution of the baseline version - if the version doesn't exist, a warn message is logged and we assume that this is a new module, to be compared with an empty configuration. This commit also renames the "spring-core-graalvm" project to "graalvm-feature", since this sub-project is not an official module published to Maven Central, but rather an internal dependency. Fixes gh-28818
125 lines
4.7 KiB
Groovy
125 lines
4.7 KiB
Groovy
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
|
|
description = "Spring Core"
|
|
|
|
apply plugin: "kotlin"
|
|
|
|
// spring-core includes asm, javapoet and repackages cglib, inlining all into the
|
|
// spring-core jar. cglib itself depends on asm and is therefore further transformed by
|
|
// the ShadowJar task to depend on org.springframework.asm; this avoids including two
|
|
// different copies of asm.
|
|
def cglibVersion = "3.3.0"
|
|
def javapoetVersion = "1.13.0"
|
|
def objenesisVersion = "3.2"
|
|
|
|
configurations {
|
|
cglib
|
|
javapoet
|
|
objenesis
|
|
graalvm
|
|
}
|
|
|
|
task cglibRepackJar(type: ShadowJar) {
|
|
archiveBaseName.set('spring-cglib-repack')
|
|
archiveVersion.set(cglibVersion)
|
|
configurations = [project.configurations.cglib]
|
|
relocate 'net.sf.cglib', 'org.springframework.cglib'
|
|
relocate 'org.objectweb.asm', 'org.springframework.asm'
|
|
}
|
|
|
|
task javapoetRepackJar(type: ShadowJar) {
|
|
archiveBaseName.set('spring-javapoet-repack')
|
|
archiveVersion.set(javapoetVersion)
|
|
configurations = [project.configurations.javapoet]
|
|
relocate 'com.squareup.javapoet', 'org.springframework.javapoet'
|
|
}
|
|
|
|
task objenesisRepackJar(type: ShadowJar) {
|
|
archiveBaseName.set('spring-objenesis-repack')
|
|
archiveVersion.set(objenesisVersion)
|
|
configurations = [project.configurations.objenesis]
|
|
relocate 'org.objenesis', 'org.springframework.objenesis'
|
|
}
|
|
|
|
dependencies {
|
|
cglib("cglib:cglib:${cglibVersion}@jar")
|
|
javapoet("com.squareup:javapoet:${javapoetVersion}@jar")
|
|
objenesis("org.objenesis:objenesis:${objenesisVersion}@jar")
|
|
graalvm(project(path: ":graalvm-feature", configuration: 'classesOnlyElements'))
|
|
api(files(cglibRepackJar))
|
|
api(files(javapoetRepackJar))
|
|
api(files(objenesisRepackJar))
|
|
api(project(":spring-jcl"))
|
|
compileOnly("io.projectreactor.tools:blockhound")
|
|
optional("net.sf.jopt-simple:jopt-simple")
|
|
optional("org.aspectj:aspectjweaver")
|
|
optional("org.jetbrains.kotlin:kotlin-reflect")
|
|
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
|
optional("io.projectreactor:reactor-core")
|
|
optional("io.reactivex.rxjava3:rxjava")
|
|
optional("io.smallrye.reactive:mutiny")
|
|
optional("io.netty:netty-buffer")
|
|
testImplementation("jakarta.annotation:jakarta.annotation-api")
|
|
testImplementation("jakarta.xml.bind:jakarta.xml.bind-api")
|
|
testImplementation("com.google.code.findbugs:jsr305")
|
|
testImplementation("com.fasterxml.woodstox:woodstox-core")
|
|
testImplementation("org.xmlunit:xmlunit-assertj")
|
|
testImplementation("org.xmlunit:xmlunit-matchers")
|
|
testImplementation("io.projectreactor:reactor-test")
|
|
testImplementation("io.projectreactor.tools:blockhound")
|
|
testImplementation("org.skyscreamer:jsonassert")
|
|
testFixturesImplementation("com.google.code.findbugs:jsr305")
|
|
testFixturesImplementation("org.junit.platform:junit-platform-launcher")
|
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api")
|
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params")
|
|
testFixturesImplementation("org.assertj:assertj-core")
|
|
testFixturesImplementation("org.xmlunit:xmlunit-assertj")
|
|
testFixturesImplementation("io.projectreactor:reactor-test")
|
|
}
|
|
|
|
jar {
|
|
reproducibleFileOrder = true
|
|
preserveFileTimestamps = false // maybe not necessary here, but good for reproducibility
|
|
manifest.attributes["Dependencies"] = "jdk.unsupported" // for WildFly (-> Objenesis 3.2)
|
|
|
|
// Inline repackaged cglib classes directly into spring-core jar
|
|
dependsOn cglibRepackJar
|
|
from(zipTree(cglibRepackJar.archivePath)) {
|
|
include "org/springframework/cglib/**"
|
|
exclude "org/springframework/cglib/beans/**"
|
|
exclude "org/springframework/cglib/core/AbstractClassGenerator*.class"
|
|
exclude "org/springframework/cglib/core/AsmApi*.class"
|
|
exclude "org/springframework/cglib/core/KeyFactory.class"
|
|
exclude "org/springframework/cglib/core/KeyFactory\$*.class"
|
|
exclude "org/springframework/cglib/core/ReflectUtils*.class"
|
|
exclude "org/springframework/cglib/proxy/Enhancer*.class"
|
|
exclude "org/springframework/cglib/proxy/MethodProxy*.class"
|
|
}
|
|
|
|
dependsOn javapoetRepackJar
|
|
from(zipTree(javapoetRepackJar.archivePath)) {
|
|
include "org/springframework/javapoet/**"
|
|
}
|
|
|
|
dependsOn objenesisRepackJar
|
|
from(zipTree(objenesisRepackJar.archivePath)) {
|
|
include "org/springframework/objenesis/**"
|
|
}
|
|
|
|
from configurations.graalvm
|
|
}
|
|
|
|
test {
|
|
// Make sure the classes dir is used on the test classpath (required by ResourceTests).
|
|
// When test fixtures are involved, the JAR is used by default.
|
|
classpath = sourceSets.main.output.classesDirs + files(sourceSets.main.output.resourcesDir) + classpath - files(jar.archiveFile)
|
|
|
|
// Ensure that BlockHound tests run on JDK 13+. For details, see:
|
|
// https://github.com/reactor/BlockHound/issues/33
|
|
jvmArgs += [
|
|
"-XX:+AllowRedefinitionToAddDeleteMethods"
|
|
]
|
|
}
|