diff --git a/android/android_framework/patch-magisk/module.thanox.gradle b/android/android_framework/patch-magisk/module.thanox.gradle index f1a26d337..4e448831b 100644 --- a/android/android_framework/patch-magisk/module.thanox.gradle +++ b/android/android_framework/patch-magisk/module.thanox.gradle @@ -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 } \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index 6c76ce8e4..0186481ae 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -11,6 +11,10 @@ buildscript { } } +plugins { + id 'com.gladed.androidgitversion' version '0.4.10' +} + allprojects { addRepos(repositories) @@ -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 + } +} \ No newline at end of file