From b3d8493612499c9ddcdd10812958b346c21a35a0 Mon Sep 17 00:00:00 2001 From: snake-4 <18491360+snake-4@users.noreply.github.com> Date: Tue, 26 Mar 2024 19:49:18 +0100 Subject: [PATCH] Added commit hash to version strings --- build.gradle.kts | 9 +++++++++ module/build.gradle.kts | 5 +++-- module/src/main/AndroidManifest.xml | 2 -- 3 files changed, 12 insertions(+), 4 deletions(-) delete mode 100644 module/src/main/AndroidManifest.xml diff --git a/build.gradle.kts b/build.gradle.kts index 43e0f66..f8f0ef5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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") diff --git a/module/build.gradle.kts b/module/build.gradle.kts index d927684..048401d 100644 --- a/module/build.gradle.kts +++ b/module/build.gradle.kts @@ -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 by rootProject.extra @@ -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("prepareModuleFiles$variantCapped") { group = "module" @@ -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 ) } diff --git a/module/src/main/AndroidManifest.xml b/module/src/main/AndroidManifest.xml deleted file mode 100644 index 5c3d365..0000000 --- a/module/src/main/AndroidManifest.xml +++ /dev/null @@ -1,2 +0,0 @@ - -