Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import static java.util.jar.Attributes.Name.*
* <li>Built-Status (project.status)</li>
* <li>Built-By (user.name)</li>
* <li>Build-Date</li>
* <li>Build-Date-Format</li>
* <li>Gradle-Version (project.gradle.gradleVersion)</li>
* </ul>
*/
Expand Down Expand Up @@ -48,8 +49,10 @@ class BasicInfoPlugin implements Plugin<Project>, InfoCollectorPlugin {
manifestPlugin.add('Built-By', System.getProperty('user.name'))
manifestPlugin.add('Built-OS', System.getProperty('os.name'))

String buildDateFormat = "yyyy-MM-dd'T'HH:mm:ssXXX"
// Makes list of attributes not idempotent, which can throw off "changed" checks
manifestPlugin.add('Build-Date', new Date().format('yyyy-MM-dd_HH:mm:ss')).changing = true
manifestPlugin.add('Build-Date', new Date().format(buildDateFormat)).changing = true
manifestPlugin.add('Build-Date-Format', buildDateFormat)

manifestPlugin.add('Gradle-Version', { project.gradle.gradleVersion })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import nebula.plugin.info.InfoBrokerPlugin
import nebula.plugin.info.basic.BasicInfoPlugin
import nebula.test.IntegrationSpec

import java.text.SimpleDateFormat
import java.util.jar.Attributes
import java.util.jar.JarFile
import java.util.jar.Manifest
Expand Down Expand Up @@ -83,6 +84,12 @@ class InfoJarManifestPluginLauncherSpec extends IntegrationSpec {
assertMainfestKeyExists(attributes, 'Built-By')
assertMainfestKeyExists(attributes, 'Built-OS')
assertMainfestKeyExists(attributes, 'Build-Date')
assertMainfestKeyExists(attributes, 'Build-Date-Format')
// ensure that the Build-Date can be parsed and the parsed Date formats to the Build-Date
SimpleDateFormat sdf = new SimpleDateFormat(manifestKey(attributes, 'Build-Date-Format'))
String manifestBuildDate = manifestKey(attributes, 'Build-Date')
Date buildDate = sdf.parse(manifestBuildDate)
sdf.format(buildDate) == manifestBuildDate
assertMainfestKeyExists(attributes, 'Gradle-Version')
}

Expand Down