diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3da5d0f..fe21fc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: 21 + java-version: 17 distribution: "temurin" cache: 'gradle' diff --git a/app/build.gradle b/app/build.gradle index eab0cae..0257f7c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,8 @@ apply plugin: 'com.android.application' android { compileSdkVersion 33 defaultConfig { - applicationId "us.spotco.malwarescanner" + applicationId "org.maintainteam.hypatia" + resValue "string", "app_name", "Hypatia" minSdkVersion 16 targetSdkVersion 32 versionCode 314 @@ -12,9 +13,23 @@ android { } buildTypes { debug { - applicationIdSuffix ".debug" + debuggable true + + // suffix the app id and the app name with git branch name + def workingBranch = getGitWorkingBranch() + def normalizedWorkingBranch = workingBranch.replaceFirst("^[^A-Za-z]+", "").replaceAll("[^0-9A-Za-z]+", "") + if (normalizedWorkingBranch.isEmpty() || workingBranch == "master" || workingBranch == "dev" || workingBranch == "stable") { + // default values when branch name could not be determined or is master, dev or stable + applicationIdSuffix ".debug" + resValue "string", "app_name", "Hypatia Debug" + } else { + applicationIdSuffix ".debug." + normalizedWorkingBranch + resValue "string", "app_name", "Hypatia " + workingBranch + } + minifyEnabled true zipAlignEnabled true + } release { shrinkResources true @@ -40,3 +55,19 @@ dependencies { implementation 'org.bouncycastle:bcpg-jdk15to18:1.77' implementation 'com.google.guava:guava:33.0.0-jre' } + +static String getGitWorkingBranch() { + try { + def gitProcess = "git rev-parse --abbrev-ref HEAD".execute() + gitProcess.waitFor() + if (gitProcess.exitValue() == 0) { + return gitProcess.text.trim() + } else { + // not a git repository + return "" + } + } catch (IOException ignored) { + // git was not found + return "" + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2dfcb44..a54cefa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,7 +1,6 @@ - Hypatia - Copyright 2017-2024 Divested Computing Group + Copyright 2017-2024 Divested Computing Group, 2025 MaintainTeam License: GPL-3.0 Version: %s Powered by ClamAV style signatures