fix build time showing as EPOCH

This commit is contained in:
granny
2025-12-17 21:20:13 -08:00
parent ccddaf71a2
commit eacf9fdf88

View File

@@ -70,7 +70,15 @@
// Deps that were previously in the API but have now been moved here for backwards compat, eventually to be removed // Deps that were previously in the API but have now been moved here for backwards compat, eventually to be removed
runtimeOnly("commons-lang:commons-lang:2.6") runtimeOnly("commons-lang:commons-lang:2.6")
runtimeOnly("org.xerial:sqlite-jdbc:3.49.1.0") runtimeOnly("org.xerial:sqlite-jdbc:3.49.1.0")
@@ -198,14 +_,14 @@ @@ -191,21 +_,21 @@
val git = Git(rootProject.layout.projectDirectory.path)
val mcVersion = rootProject.providers.gradleProperty("mcVersion").get()
val build = System.getenv("BUILD_NUMBER") ?: null
- val buildTime = providers.environmentVariable("BUILD_STARTED_AT").map(Instant::parse).orElse(Instant.EPOCH).get()
+ val buildTime = if (build != null) Instant.now() else Instant.EPOCH // Purpur
val gitHash = git.exec(providers, "rev-parse", "--short=7", "HEAD").get().trim()
val implementationVersion = "$mcVersion-${build ?: "DEV"}-$gitHash"
val date = git.exec(providers, "show", "-s", "--format=%ci", gitHash).get().trim()
val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim() val gitBranch = git.exec(providers, "rev-parse", "--abbrev-ref", "HEAD").get().trim()
attributes( attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main", "Main-Class" to "org.bukkit.craftbukkit.Main",