@@ -19,15 +19,15 @@ var date: String = (extra.properties["date"] as? String) ?: ""
1919// Get Git metadata during build setup using the Git CLI.
2020// This replaces Grgit/JGit so the build stays compatible with Gradle's configuration cache.
2121// The result is recorded as a build input and can be reused without re-running Git each time.
22- // We keep the short hash length the same as before for consistency .
22+ // crankcase-git has no commit-date accessor, so `date` still goes through this directly .
2323fun gitOutput (vararg args : String ): String =
2424 providers.exec {
2525 commandLine(" git" , * args)
2626 workingDir = rootDir
2727 }.standardOutput.asText.get().trim()
2828
2929date = gitOutput(" show" , " -s" , " --format=%cd" , " --date=format:%y.%m.%d" , " HEAD" )
30- revision = " -" + gitOutput( " rev-parse " , " --short=7 " , " HEAD " )
30+ revision = " -" + git.commitHash.get( )
3131 buildNumber = if (project.hasProperty(" buildnumber" )) {
3232 snapshot + " -" + (project.findProperty(" buildnumber" ) as ? String ? : " " )
3333 } else {
@@ -42,14 +42,12 @@ extra.set("date", date)
4242
4343version = String .format(" %s-%s" , rootVersion, snapshot)
4444
45- if (! project.hasProperty(" gitCommitHash" )) {
46- ext[" gitCommitHash" ] = try {
47- gitOutput(" rev-parse" , " --short=7" , " HEAD" )
48- } catch (e: Exception ) {
49- logger.warn(" Error getting commit hash" , e)
45+ ext[" gitCommitHash" ] = try {
46+ git.commitHash.get()
47+ } catch (e: Exception ) {
48+ logger.warn(" Error getting commit hash" , e)
5049
51- " no.git.id"
52- }
50+ " no.git.id"
5351}
5452
5553val totalReport = tasks.register<JacocoReport >(" jacocoTotalReport" ) {
0 commit comments