Skip to content

Commit

Permalink
add buildtime
Browse files Browse the repository at this point in the history
  • Loading branch information
theshadowco authored Jun 5, 2024
1 parent 824894f commit 9524c13
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import gradlegitproperties.org.ajoberstar.grgit.Grgit
import me.qoomon.gitversioning.commons.GitRefType
import org.apache.tools.ant.filters.EscapeUnicode
import java.util.*
import java.text.SimpleDateFormat

plugins {
`java-library`
Expand Down Expand Up @@ -52,7 +53,7 @@ gitVersioning.apply {
}

gitProperties {
customProperty("git.build.time", "2018-03-28T05:13:53Z")
customProperty("git.build.time", buildTime())
}

val isSnapshot = gitVersioning.gitVersionDetails.refType != GitRefType.TAG
Expand Down Expand Up @@ -390,3 +391,9 @@ nexusStaging {
tasks.withType<GenerateModuleMetadata> {
enabled = false
}

fun buildTime(): String {
val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
formatter.timeZone = TimeZone.getTimeZone("UTC")
return formatter.format(Date())
}

0 comments on commit 9524c13

Please sign in to comment.