Skip to content

Commit

Permalink
Dynamic version
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornaco committed Jul 25, 2021
1 parent 5afc521 commit 20c52f7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ext {

moduleName = "Thanox-Core"
moduleAuthor = "Tornaco"
moduleDescription = "Provide android framework and app hooks for thanox, requires Riru $moduleMinRiruVersionName or above."
moduleDescription = "Provide android framework and app hooks for thanox, requires Riru $moduleMinRiruVersionName or above(需要安装riru). Only support Android11(只支持Android11)"
moduleVersion = rootProject.ext.versionName
moduleVersionCode = rootProject.ext.versionCode as int
}
34 changes: 32 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ buildscript {
}
}

plugins {
id 'com.gladed.androidgitversion' version '0.4.10'
}

allprojects {
addRepos(repositories)

Expand All @@ -33,7 +37,33 @@ task clean(type: Delete) {
}


androidGitVersion {
prefix 'v'
codeFormat = 'MMNNPP'
baseCode = 2121212
// 1000000
// 191011
// First rel version
// 1191011
// 2041540
}


ext {
versionCode = 3000000
versionName = "3.0.0"
gitCommitCount = getGitCommitCount()
println "### gitCommitCount: ${gitCommitCount} ###"
versionCode = (androidGitVersion.code() as int) + gitCommitCount
println "### versionCode: ${versionCode} ###"
println "### androidGitVersion: ${androidGitVersion.code()} ###"
versionName = androidGitVersion.name()
}

@SuppressWarnings("GrMethodMayBeStatic")
def getGitCommitCount() {
try {
return Integer.parseInt('git rev-list --count HEAD'.execute().text.trim())
} catch (Throwable e) {
e.printStackTrace()
return 0
}
}

0 comments on commit 20c52f7

Please sign in to comment.