Previously, when a project's jar was an input into a test task, a cache hit required the current build to be using the same JDK as the one that created the cache entry. This was due to the Created-By entry in the jar's manifest which will vary if JDKs with different values for the java.version and java.specification.vendor version are used. This commit configures normalization of the runtime classpath to ignore META-INF/MANIFEST.MF, thereby allowing a cache hit when the tests were previously run on a different JDK than the one being used now. Typically this is a different update release being used on a CI agent and a developer's machine. This change will therefore improve the likelihood of a cache hit once remote caching has been enabled. Closes gh-23872
65 lines
1.8 KiB
Groovy
65 lines
1.8 KiB
Groovy
apply plugin: 'org.springframework.build.compile'
|
|
apply plugin: 'org.springframework.build.optional-dependencies'
|
|
apply plugin: 'org.springframework.build.test-sources'
|
|
apply from: "$rootDir/gradle/publications.gradle"
|
|
|
|
jar {
|
|
manifest.attributes["Implementation-Title"] = project.name
|
|
manifest.attributes["Implementation-Version"] = project.version
|
|
manifest.attributes["Automatic-Module-Name"] = project.name.replace('-', '.') // for Jigsaw
|
|
manifest.attributes["Created-By"] =
|
|
"${System.getProperty("java.version")} (${System.getProperty("java.specification.vendor")})"
|
|
|
|
from("${rootDir}/src/docs/dist") {
|
|
include "license.txt"
|
|
include "notice.txt"
|
|
into "META-INF"
|
|
expand(copyright: new Date().format("yyyy"), version: project.version)
|
|
}
|
|
}
|
|
|
|
normalization {
|
|
runtimeClasspath {
|
|
ignore "META-INF/MANIFEST.MF"
|
|
}
|
|
}
|
|
|
|
javadoc {
|
|
description = "Generates project-level javadoc for use in -javadoc jar"
|
|
|
|
options.encoding = "UTF-8"
|
|
options.memberLevel = JavadocMemberLevel.PROTECTED
|
|
options.author = true
|
|
options.header = project.name
|
|
options.use = true
|
|
options.links(project.ext.javadocLinks)
|
|
options.addStringOption("Xdoclint:none", "-quiet")
|
|
|
|
// Suppress warnings due to cross-module @see and @link references.
|
|
// Note that global 'api' task does display all warnings.
|
|
logging.captureStandardError LogLevel.INFO
|
|
logging.captureStandardOutput LogLevel.INFO // suppress "## warnings" message
|
|
}
|
|
|
|
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
archiveClassifier.set("sources")
|
|
from sourceSets.main.allSource
|
|
// Don't include or exclude anything explicitly by default. See SPR-12085.
|
|
}
|
|
|
|
task javadocJar(type: Jar) {
|
|
archiveClassifier.set("javadoc")
|
|
from javadoc
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
from components.java
|
|
artifact sourcesJar
|
|
artifact javadocJar
|
|
}
|
|
}
|
|
}
|