buildSrc: Use HEAD rev count as version code

In Actions, we do not always have a checkout of the master branch.

This only applies to release builds anyway. For debug builds, we always
use the timestamp.
This commit is contained in:
Peter Cai 2024-03-05 20:07:49 -05:00
parent ca0085e147
commit 8ee3c53492

View file

@ -12,7 +12,7 @@ val Project.gitVersionCode: Int
try {
val stdout = ByteArrayOutputStream()
exec {
commandLine("git", "rev-list", "--first-parent", "--count", "master")
commandLine("git", "rev-list", "--first-parent", "--count", "HEAD")
standardOutput = stdout
}
stdout.toString("utf-8").trim('\n').toInt()