Use git commit count as verCode

This commit is contained in:
Nullptr 2022-03-04 13:29:46 +08:00
parent 5a16a34cd8
commit 4dd6369e1a
4 changed files with 11 additions and 5 deletions

View File

@ -15,7 +15,7 @@ dependencies {
implementation("org.bouncycastle:bcpkix-jdk15on:1.70") implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
implementation("org.bouncycastle:bcprov-jdk15on:1.70") implementation("org.bouncycastle:bcprov-jdk15on:1.70")
api("com.google.guava:guava:31.0.1-jre") api("com.google.guava:guava:31.0.1-jre")
api("com.android.tools.build:apksig:7.1.1") api("com.android.tools.build:apksig:7.1.2")
compileOnlyApi("com.google.auto.value:auto-value-annotations:1.9") compileOnlyApi("com.google.auto.value:auto-value-annotations:1.9")
annotationProcessor("com.google.auto.value:auto-value:1.9") annotationProcessor("com.google.auto.value:auto-value:1.9")
} }

View File

@ -96,5 +96,5 @@ dependencies {
implementation(projects.share) implementation(projects.share)
implementation(projects.imanager) implementation(projects.imanager)
implementation("com.google.code.gson:gson:2.8.9") implementation("com.google.code.gson:gson:2.9.0")
} }

View File

@ -1,4 +1,5 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. import org.eclipse.jgit.api.Git
import org.eclipse.jgit.internal.storage.file.FileRepository
buildscript { buildscript {
repositories { repositories {
@ -8,14 +9,19 @@ buildscript {
val agpVersion by extra("7.1.2") val agpVersion by extra("7.1.2")
dependencies { dependencies {
classpath("com.android.tools.build:gradle:$agpVersion") classpath("com.android.tools.build:gradle:$agpVersion")
classpath("org.eclipse.jgit:org.eclipse.jgit:6.0.0.202111291000-r")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
} }
} }
val repo = FileRepository(rootProject.file(".git"))
val refId = repo.refDatabase.exactRef("refs/remotes/origin/lsp").objectId!!
val commitCount = Git(repo).log().add(refId).call().count()
// sync from https://github.com/LSPosed/LSPosed/blob/master/build.gradle.kts // sync from https://github.com/LSPosed/LSPosed/blob/master/build.gradle.kts
val defaultManagerPackageName by extra("org.lsposed.lspatch") val defaultManagerPackageName by extra("org.lsposed.lspatch")
val apiCode by extra(93) val apiCode by extra(93)
val verCode by extra(1) val verCode by extra(commitCount)
val verName by extra("0.3") val verName by extra("0.3")
val androidMinSdkVersion by extra(28) val androidMinSdkVersion by extra(28)
val androidTargetSdkVersion by extra(32) val androidTargetSdkVersion by extra(32)

View File

@ -18,5 +18,5 @@ dependencies {
implementation("commons-io:commons-io:2.11.0") implementation("commons-io:commons-io:2.11.0")
implementation("com.beust:jcommander:1.82") implementation("com.beust:jcommander:1.82")
implementation("com.google.code.gson:gson:2.8.9") implementation("com.google.code.gson:gson:2.9.0")
} }