mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-24 22:34:54 +00:00
Merge pull request #12823 from JosJuice/android-new-version-code
Android: Adopt a new versionCode scheme
This commit is contained in:
commit
1bec2b6484
1 changed files with 10 additions and 1 deletions
|
@ -170,7 +170,7 @@ fun getGitVersion(): String {
|
|||
|
||||
fun getBuildVersionCode(): Int {
|
||||
try {
|
||||
return Integer.valueOf(
|
||||
val commitCount = Integer.valueOf(
|
||||
ProcessBuilder("git", "rev-list", "--first-parent", "--count", "HEAD")
|
||||
.directory(project.rootDir)
|
||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||
|
@ -178,6 +178,15 @@ fun getBuildVersionCode(): Int {
|
|||
.start().inputStream.bufferedReader().use { it.readText() }
|
||||
.trim()
|
||||
)
|
||||
|
||||
val isRelease = ProcessBuilder("git", "describe", "--exact-match", "HEAD")
|
||||
.directory(project.rootDir)
|
||||
.redirectOutput(ProcessBuilder.Redirect.PIPE)
|
||||
.redirectError(ProcessBuilder.Redirect.PIPE)
|
||||
.start()
|
||||
.waitFor() == 0
|
||||
|
||||
return commitCount * 2 + (if (isRelease) 0 else 1)
|
||||
} catch (e: Exception) {
|
||||
logger.error("Cannot find git, defaulting to dummy version code")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue