Skip to content

Commit

Permalink
Use ISO-8601 for Build-Date-UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalcolea committed Sep 2, 2021
1 parent 65bcd2a commit e24df4f
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import static java.util.jar.Attributes.Name.*
*/
class BasicInfoPlugin implements Plugin<Project>, InfoCollectorPlugin {
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern('yyyy-MM-dd_HH:mm:ss')
private static final DateTimeFormatter DATE_TIME_ISO_FORMATTER = DateTimeFormatter.ISO_ZONED_DATE_TIME

static final String BUILT_BY_PROPERTY = 'Built-By'
static final String BUILT_OS_PROPERTY = 'Built-OS'
static final String BUILD_DATE_PROPERTY = 'Build-Date'
Expand Down Expand Up @@ -91,11 +93,10 @@ class BasicInfoPlugin implements Plugin<Project>, InfoCollectorPlugin {
manifestPlugin.add(BUILD_TIMEZONE_PROPERTY, TimeZone.default.getID())

// Makes list of attributes not idempotent, which can throw off "changed" checks
LocalDateTime datetimeUtc = LocalDateTime.ofInstant(Instant.now(), ZoneOffset.UTC)
manifestPlugin.add(BUILD_DATE_UTC_PROPERTY, DATE_TIME_FORMATTER.format(datetimeUtc)).changing = true
Instant now = Instant.now()
manifestPlugin.add(BUILD_DATE_UTC_PROPERTY,now.toString()).changing = true

LocalDateTime datetime = LocalDateTime.now()
manifestPlugin.add(BUILD_DATE_PROPERTY, DATE_TIME_FORMATTER.format(datetime)).changing = true
manifestPlugin.add(BUILD_DATE_PROPERTY, DATE_TIME_FORMATTER.format(now.atZone(TimeZone.default.toZoneId()))).changing = true

manifestPlugin.add(GRADLE_VERSION_PROPERTY, { project.gradle.gradleVersion })

Expand Down

0 comments on commit e24df4f

Please sign in to comment.