@@ -173,20 +173,32 @@ tasks.register('versionInfoFile') {
173173 // capture at configuration time (no Task.project usage later)
174174 def versionString = project. version. toString()
175175
176+ // Inputs so the task reruns when metadata changes:
177+ // - project version changes
178+ inputs. property(" projectVersion" , versionString)
179+ // - HEAD changes (branch updates)
180+ inputs. file(new File (repoDir, " .git/HEAD" )). withPropertyName(" gitHeadRef" )
181+ // - branch ref changes (only for branch-based HEAD; harmless if missing)
182+ inputs. files(fileTree(new File (repoDir, " .git/refs" ))). withPropertyName(" gitRefs" )
183+ // - tags move / new tags (for git describe --tags)
184+ inputs. files(fileTree(new File (repoDir, " .git/refs/tags" ))). withPropertyName(" gitTags" )
185+ // - packed refs can contain tags/refs
186+ inputs. file(new File (repoDir, " .git/packed-refs" )). optional(). withPropertyName(" gitPackedRefs" )
187+ // - working tree dirtiness affects "--dirty"
188+ inputs. file(new File (repoDir, " .git/index" )). optional(). withPropertyName(" gitIndex" )
189+
176190 doLast {
177191 def rev8 = [" git" , " rev-parse" , " --short=8" , " HEAD" ]. execute(null , repoDir). text. trim()
178192 def revLong = [" git" , " rev-parse" , " HEAD" ]. execute(null , repoDir). text. trim()
179193 def tag = [" git" , " describe" , " --tags" , " --always" , " --dirty" ]. execute(null , repoDir). text. trim()
180194
181195 def wurstVersion = " ${ versionString} -${ tag} "
182- def currentTime = new Date (). format(" yyyy/MM/dd KK:mm:ss" )
183196
184197 dir. mkdirs()
185198 out. text = """
186199package de.peeeq.wurstscript;
187200
188201public class CompileTimeInfo {
189- public static final String time="${ currentTime} ";
190202 public static final String revision="${ rev8} ";
191203 public static final String revisionLong="${ revLong} ";
192204 public static final String version="${ wurstVersion} ";
@@ -196,6 +208,7 @@ public class CompileTimeInfo {
196208}
197209
198210
211+
199212/* * -------- Aggregate generation + wiring into compile -------- */
200213
201214tasks. register(' gen' ) {
0 commit comments