Skip to content

Commit

Permalink
Added commit hash to version strings
Browse files Browse the repository at this point in the history
  • Loading branch information
snake-4 committed Mar 26, 2024
1 parent b63132e commit b3d8493
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ plugins {
alias(libs.plugins.agp.lib) apply false
}

val commitHash: String by extra({
val stdout = ByteArrayOutputStream()
rootProject.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = stdout
}
stdout.toString().trim()
})

val moduleId by extra("zygisk-assistant")
val moduleName by extra("Zygisk Assistant")
val verName by extra("v2.0.0")
Expand Down
5 changes: 3 additions & 2 deletions module/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
val moduleId: String by rootProject.extra
val moduleName: String by rootProject.extra
val verCode: Int by rootProject.extra
val commitHash: String by rootProject.extra
val verName: String by rootProject.extra
val abiList: List<String> by rootProject.extra

Expand Down Expand Up @@ -39,7 +40,7 @@ androidComponents.onVariants { variant ->
val libOutDir = layout.buildDirectory.dir("intermediates/stripped_native_libs/$variantLowered/out/lib").get()
val moduleDir = layout.buildDirectory.dir("outputs/module/$variantLowered").get()
val zipOutDir = layout.buildDirectory.dir("outputs/release").get()
val zipFileName = "$moduleName-$verName-$verCode-$buildTypeLowered.zip".replace(' ', '-')
val zipFileName = "$moduleName-$verName-$commitHash-$buildTypeLowered.zip".replace(' ', '-')

val prepareModuleFilesTask = task<Sync>("prepareModuleFiles$variantCapped") {
group = "module"
Expand All @@ -50,7 +51,7 @@ androidComponents.onVariants { variant ->
expand(
"moduleId" to moduleId,
"moduleName" to moduleName,
"versionName" to "$verName ($verCode-$variantLowered)",
"versionName" to "$verName ($commitHash-$variantLowered)",
"versionCode" to verCode
)
}
Expand Down
2 changes: 0 additions & 2 deletions module/src/main/AndroidManifest.xml

This file was deleted.

0 comments on commit b3d8493

Please sign in to comment.