2019-09-30 20:14:36 +08:00
|
|
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
2022-02-23 03:09:37 +08:00
|
|
|
import org.springframework.build.shadow.ShadowSource
|
2019-09-30 20:14:36 +08:00
|
|
|
|
2023-05-08 17:22:47 +08:00
|
|
|
plugins {
|
|
|
|
id 'me.champeau.mrjar'
|
|
|
|
}
|
|
|
|
|
2017-08-21 20:41:55 +08:00
|
|
|
description = "Spring Core"
|
|
|
|
|
2019-08-21 02:26:43 +08:00
|
|
|
apply plugin: "kotlin"
|
2022-09-01 23:59:43 +08:00
|
|
|
apply plugin: "kotlinx-serialization"
|
2019-08-21 02:26:43 +08:00
|
|
|
|
2023-05-08 17:22:47 +08:00
|
|
|
multiRelease {
|
2024-11-29 01:07:23 +08:00
|
|
|
targetVersions 17, 21
|
2023-05-08 17:22:47 +08:00
|
|
|
}
|
|
|
|
|
2022-01-06 21:52:48 +08:00
|
|
|
def javapoetVersion = "1.13.0"
|
2024-09-11 23:15:37 +08:00
|
|
|
def objenesisVersion = "3.4"
|
2017-08-21 20:41:55 +08:00
|
|
|
|
|
|
|
configurations {
|
2023-05-08 17:22:47 +08:00
|
|
|
java21Api.extendsFrom(api)
|
|
|
|
java21Implementation.extendsFrom(implementation)
|
2022-01-06 21:52:48 +08:00
|
|
|
javapoet
|
2017-08-21 20:41:55 +08:00
|
|
|
objenesis
|
2022-06-22 18:17:40 +08:00
|
|
|
graalvm
|
2017-08-21 20:41:55 +08:00
|
|
|
}
|
|
|
|
|
2022-01-06 21:52:48 +08:00
|
|
|
task javapoetRepackJar(type: ShadowJar) {
|
2022-08-01 18:12:36 +08:00
|
|
|
archiveBaseName = 'spring-javapoet-repack'
|
|
|
|
archiveVersion = javapoetVersion
|
2022-01-06 21:52:48 +08:00
|
|
|
configurations = [project.configurations.javapoet]
|
2022-08-01 18:12:36 +08:00
|
|
|
relocate('com.squareup.javapoet', 'org.springframework.javapoet')
|
2022-01-06 21:52:48 +08:00
|
|
|
}
|
|
|
|
|
2022-02-23 03:09:37 +08:00
|
|
|
task javapoetSource(type: ShadowSource) {
|
|
|
|
configurations = [project.configurations.javapoet]
|
2022-08-01 18:12:36 +08:00
|
|
|
relocate('com.squareup.javapoet', 'org.springframework.javapoet')
|
2022-02-23 03:09:37 +08:00
|
|
|
outputDirectory = file("build/shadow-source/javapoet")
|
|
|
|
}
|
|
|
|
|
2022-08-01 18:12:36 +08:00
|
|
|
task javapoetSourceJar(type: Jar) {
|
|
|
|
archiveBaseName = 'spring-javapoet-repack'
|
|
|
|
archiveVersion = javapoetVersion
|
|
|
|
archiveClassifier = 'sources'
|
|
|
|
from javapoetSource
|
|
|
|
}
|
|
|
|
|
2019-09-30 20:14:36 +08:00
|
|
|
task objenesisRepackJar(type: ShadowJar) {
|
2022-08-01 18:12:36 +08:00
|
|
|
archiveBaseName = 'spring-objenesis-repack'
|
|
|
|
archiveVersion = objenesisVersion
|
2019-09-30 20:14:36 +08:00
|
|
|
configurations = [project.configurations.objenesis]
|
2022-08-01 18:12:36 +08:00
|
|
|
relocate('org.objenesis', 'org.springframework.objenesis')
|
2017-08-21 20:41:55 +08:00
|
|
|
}
|
|
|
|
|
2022-02-23 03:09:37 +08:00
|
|
|
task objenesisSource(type: ShadowSource) {
|
|
|
|
configurations = [project.configurations.objenesis]
|
2022-08-01 18:12:36 +08:00
|
|
|
relocate('org.objenesis', 'org.springframework.objenesis')
|
2022-02-23 03:09:37 +08:00
|
|
|
outputDirectory = file("build/shadow-source/objenesis")
|
|
|
|
}
|
|
|
|
|
2022-08-01 18:12:36 +08:00
|
|
|
task objenesisSourceJar(type: Jar) {
|
|
|
|
archiveBaseName = 'spring-objenesis-repack'
|
|
|
|
archiveVersion = objenesisVersion
|
|
|
|
archiveClassifier = 'sources'
|
|
|
|
from objenesisSource
|
|
|
|
}
|
|
|
|
|
2017-08-21 20:41:55 +08:00
|
|
|
dependencies {
|
2022-01-06 21:52:48 +08:00
|
|
|
javapoet("com.squareup:javapoet:${javapoetVersion}@jar")
|
2017-08-21 20:41:55 +08:00
|
|
|
objenesis("org.objenesis:objenesis:${objenesisVersion}@jar")
|
2022-01-06 21:52:48 +08:00
|
|
|
api(files(javapoetRepackJar))
|
2021-05-22 03:16:30 +08:00
|
|
|
api(files(objenesisRepackJar))
|
|
|
|
api(project(":spring-jcl"))
|
2020-02-25 01:00:06 +08:00
|
|
|
compileOnly("io.projectreactor.tools:blockhound")
|
2022-10-17 00:15:01 +08:00
|
|
|
compileOnly("org.graalvm.sdk:graal-sdk")
|
2023-08-29 17:21:47 +08:00
|
|
|
optional("io.micrometer:context-propagation")
|
2023-08-02 06:56:50 +08:00
|
|
|
optional("io.netty:netty-buffer")
|
|
|
|
optional("io.netty:netty5-buffer")
|
|
|
|
optional("io.projectreactor:reactor-core")
|
|
|
|
optional("io.reactivex.rxjava3:rxjava")
|
|
|
|
optional("io.smallrye.reactive:mutiny")
|
2019-08-27 03:13:12 +08:00
|
|
|
optional("net.sf.jopt-simple:jopt-simple")
|
|
|
|
optional("org.aspectj:aspectjweaver")
|
2024-01-15 16:05:09 +08:00
|
|
|
optional("org.eclipse.jetty:jetty-io")
|
2019-07-19 16:20:35 +08:00
|
|
|
optional("org.jetbrains.kotlin:kotlin-reflect")
|
|
|
|
optional("org.jetbrains.kotlin:kotlin-stdlib")
|
2021-08-03 01:28:20 +08:00
|
|
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-core")
|
|
|
|
optional("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
2020-10-16 18:22:04 +08:00
|
|
|
testFixturesImplementation("com.google.code.findbugs:jsr305")
|
2023-08-02 06:56:50 +08:00
|
|
|
testFixturesImplementation("io.projectreactor:reactor-test")
|
|
|
|
testFixturesImplementation("org.assertj:assertj-core")
|
2020-01-03 21:34:29 +08:00
|
|
|
testFixturesImplementation("org.junit.platform:junit-platform-launcher")
|
|
|
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api")
|
|
|
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params")
|
2019-12-28 18:44:40 +08:00
|
|
|
testFixturesImplementation("org.xmlunit:xmlunit-assertj")
|
2023-08-02 06:56:50 +08:00
|
|
|
testImplementation("com.fasterxml.jackson.core:jackson-databind")
|
|
|
|
testImplementation("com.fasterxml.woodstox:woodstox-core")
|
|
|
|
testImplementation("com.google.code.findbugs:jsr305")
|
|
|
|
testImplementation("com.squareup.okhttp3:mockwebserver")
|
|
|
|
testImplementation("io.projectreactor:reactor-test")
|
|
|
|
testImplementation("io.projectreactor.tools:blockhound")
|
|
|
|
testImplementation("jakarta.annotation:jakarta.annotation-api")
|
|
|
|
testImplementation("jakarta.xml.bind:jakarta.xml.bind-api")
|
|
|
|
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json")
|
|
|
|
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
|
2023-12-30 00:41:26 +08:00
|
|
|
testImplementation("org.mockito:mockito-core")
|
2024-11-29 21:43:55 +08:00
|
|
|
testImplementation("com.networknt:json-schema-validator");
|
2023-08-02 06:56:50 +08:00
|
|
|
testImplementation("org.skyscreamer:jsonassert")
|
|
|
|
testImplementation("org.xmlunit:xmlunit-assertj")
|
|
|
|
testImplementation("org.xmlunit:xmlunit-matchers")
|
2017-08-21 20:41:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
jar {
|
2023-08-01 22:10:53 +08:00
|
|
|
manifest.attributes["Dependencies"] = "jdk.unsupported,org.jboss.vfs" // for WildFly (Objenesis and VfsUtils)
|
2020-06-13 20:36:27 +08:00
|
|
|
|
2022-01-06 21:52:48 +08:00
|
|
|
dependsOn javapoetRepackJar
|
2023-06-20 16:30:33 +08:00
|
|
|
from(zipTree(javapoetRepackJar.archiveFile)) {
|
2022-01-06 21:52:48 +08:00
|
|
|
include "org/springframework/javapoet/**"
|
|
|
|
}
|
|
|
|
|
2017-08-21 20:41:55 +08:00
|
|
|
dependsOn objenesisRepackJar
|
2023-06-20 16:30:33 +08:00
|
|
|
from(zipTree(objenesisRepackJar.archiveFile)) {
|
2017-08-21 20:41:55 +08:00
|
|
|
include "org/springframework/objenesis/**"
|
|
|
|
}
|
|
|
|
}
|
2020-01-02 17:29:55 +08:00
|
|
|
|
|
|
|
test {
|
2021-09-23 21:57:43 +08:00
|
|
|
// 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.
|
2022-05-11 09:32:41 +08:00
|
|
|
classpath = sourceSets.main.output.classesDirs + files(sourceSets.main.output.resourcesDir) + classpath - files(jar.archiveFile)
|
2022-01-11 21:54:59 +08:00
|
|
|
|
|
|
|
// Ensure that BlockHound tests run on JDK 13+. For details, see:
|
|
|
|
// https://github.com/reactor/BlockHound/issues/33
|
|
|
|
jvmArgs += [
|
|
|
|
"-XX:+AllowRedefinitionToAddDeleteMethods"
|
|
|
|
]
|
2020-10-16 18:22:04 +08:00
|
|
|
}
|
2022-02-23 03:09:37 +08:00
|
|
|
|
|
|
|
sourcesJar {
|
2022-08-01 18:12:36 +08:00
|
|
|
dependsOn javapoetSourceJar
|
|
|
|
dependsOn objenesisSourceJar
|
2022-02-23 03:09:37 +08:00
|
|
|
from javapoetSource
|
|
|
|
from objenesisSource
|
|
|
|
}
|
2022-08-01 18:12:36 +08:00
|
|
|
|
|
|
|
eclipse {
|
2022-08-12 17:38:43 +08:00
|
|
|
synchronizationTasks javapoetSourceJar, objenesisSourceJar
|
2022-08-01 18:12:36 +08:00
|
|
|
classpath {
|
|
|
|
file {
|
|
|
|
whenMerged {
|
|
|
|
def pattern = ~/\/spring-\w+-repack-/
|
|
|
|
entries.forEach {
|
|
|
|
if (pattern.matcher(it.path).find()) {
|
2023-06-20 16:30:33 +08:00
|
|
|
def sourcesJar = it.path.replace('.jar', '-sources.jar')
|
2022-08-01 18:12:36 +08:00
|
|
|
it.sourcePath = fileReference(file(sourcesJar))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-13 22:18:34 +08:00
|
|
|
|
|
|
|
tasks['eclipse'].dependsOn(javapoetRepackJar, javapoetSourceJar, objenesisRepackJar, objenesisSourceJar)
|