Merge pull request #14764 from rjernst/utc_build_date
Override Build-Date in jar manifest to be ISO 8601
This commit is contained in:
commit
3cc1d272ff
|
@ -18,6 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.gradle
|
package org.elasticsearch.gradle
|
||||||
|
|
||||||
|
import java.time.ZonedDateTime
|
||||||
|
import java.time.ZoneOffset
|
||||||
|
|
||||||
import nebula.plugin.extraconfigurations.ProvidedBasePlugin
|
import nebula.plugin.extraconfigurations.ProvidedBasePlugin
|
||||||
import org.elasticsearch.gradle.precommit.PrecommitTasks
|
import org.elasticsearch.gradle.precommit.PrecommitTasks
|
||||||
import org.gradle.api.*
|
import org.gradle.api.*
|
||||||
|
@ -41,6 +44,7 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
project.pluginManager.apply('java')
|
project.pluginManager.apply('java')
|
||||||
project.pluginManager.apply('carrotsearch.randomized-testing')
|
project.pluginManager.apply('carrotsearch.randomized-testing')
|
||||||
// these plugins add lots of info to our jars
|
// these plugins add lots of info to our jars
|
||||||
|
configureJarManifest(project) // jar config must be added before info broker
|
||||||
project.pluginManager.apply('nebula.info-broker')
|
project.pluginManager.apply('nebula.info-broker')
|
||||||
project.pluginManager.apply('nebula.info-basic')
|
project.pluginManager.apply('nebula.info-basic')
|
||||||
project.pluginManager.apply('nebula.info-java')
|
project.pluginManager.apply('nebula.info-java')
|
||||||
|
@ -54,7 +58,7 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
configureConfigurations(project)
|
configureConfigurations(project)
|
||||||
project.ext.versions = VersionProperties.versions
|
project.ext.versions = VersionProperties.versions
|
||||||
configureCompile(project)
|
configureCompile(project)
|
||||||
configureJarManifest(project)
|
|
||||||
configureTest(project)
|
configureTest(project)
|
||||||
PrecommitTasks.configure(project)
|
PrecommitTasks.configure(project)
|
||||||
}
|
}
|
||||||
|
@ -228,12 +232,14 @@ class BuildPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
/** Adds additional manifest info to jars */
|
/** Adds additional manifest info to jars */
|
||||||
static void configureJarManifest(Project project) {
|
static void configureJarManifest(Project project) {
|
||||||
project.afterEvaluate {
|
project.tasks.withType(Jar) { Jar jarTask ->
|
||||||
project.tasks.withType(Jar) { Jar jarTask ->
|
jarTask.doFirst {
|
||||||
manifest {
|
// this doFirst is added before the info plugin, therefore it will run
|
||||||
attributes('X-Compile-Elasticsearch-Version': VersionProperties.elasticsearch,
|
// after the doFirst added by the info plugin, and we can override attributes
|
||||||
'X-Compile-Lucene-Version': VersionProperties.lucene)
|
jarTask.manifest.attributes(
|
||||||
}
|
'X-Compile-Elasticsearch-Version': VersionProperties.elasticsearch,
|
||||||
|
'X-Compile-Lucene-Version': VersionProperties.lucene,
|
||||||
|
'Build-Date': ZonedDateTime.now(ZoneOffset.UTC))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue