From 67fc93bde528639a5767b32d9a22092b6e40d88f Mon Sep 17 00:00:00 2001 From: Kavish Devar Date: Fri, 24 Apr 2026 19:48:45 +0530 Subject: [PATCH] android: add packaging task --- .gitignore | 7 +- android/app/build.gradle.kts | 85 +++++++++++++++++-- root-module-manual/.gitignore | 1 + .../META-INF/com/google/android/update-binary | 33 +++++++ .../com/google/android/updater-script | 1 + root-module-manual/module.prop | 7 ++ update_nonpatch.json | 2 +- 7 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 root-module-manual/.gitignore create mode 100644 root-module-manual/META-INF/com/google/android/update-binary create mode 100644 root-module-manual/META-INF/com/google/android/updater-script create mode 100644 root-module-manual/module.prop diff --git a/.gitignore b/.gitignore index ed06b89..c63c246 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,5 @@ -root-module/radare2-5.9.9-android-aarch64.tar.gz -wak.toml -log.txt -btl2capfix.zip -root-module-manual +release .vscode -testing.py .DS_Store CMakeLists.txt.user* diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 07507d6..198928b 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -1,5 +1,7 @@ import java.util.Properties +val versionName = "0.2.3" + plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.compose) @@ -29,15 +31,14 @@ android { minSdk = 33 targetSdk = 37 versionCode = 36 - versionName = "0.2.3" + versionName = versionName } buildTypes { release { isMinifyEnabled = true isShrinkResources = true proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) externalNativeBuild { cmake { @@ -83,7 +84,7 @@ android { } sourceSets { getByName("main") { - res.directories+="src/main/res-apple" + res.directories += "src/main/res-apple" } } @@ -144,9 +145,83 @@ dependencies { } aboutLibraries { - export{ + export { prettyPrint = true excludeFields = listOf("generated") outputFile = file("src/main/res/raw/aboutlibraries.json") } } + +val rootModuleDir = rootProject.file("../root-module-manual") +val releaseDir = rootProject.file("../release") + +fun cap(s: String) = s.replaceFirstChar { it.uppercase() } + +fun registerRootModuleZipTask( + name: String, + flavor: String, + buildType: String +) = tasks.register(name) { + + val variantTask = "assemble${cap(flavor)}${cap(buildType)}" + dependsOn(variantTask) + + val apkPath = "outputs/apk/$flavor/$buildType/app-$flavor-$buildType.apk" + + from(rootModuleDir) + + duplicatesStrategy = DuplicatesStrategy.WARN + + from(layout.buildDirectory.file(apkPath)) { + into("system/priv-app/LibrePods") + rename { "LibrePods.apk" } + } + + archiveFileName.set("LibrePods-FOSS-v$versionName-$buildType.zip") + destinationDirectory.set(layout.buildDirectory.dir("outputs/rootModuleZips")) +} + +val zipRelease = registerRootModuleZipTask( + "zipXposedReleaseModule", + "xposed", + "release" +) + +val zipDebug = registerRootModuleZipTask( + "zipXposedDebugModule", + "xposed", + "debug" +) + +val collect = tasks.register("collectReleaseArtifacts") { + + dependsOn( + zipRelease, + zipDebug, + "bundleXposedPlayRelease" + ) + + into(releaseDir) + + from(layout.buildDirectory.dir("outputs/apk/xposed/release")) { + include("*.apk") + rename(".*", "LibrePods-FOSS-v$versionName-release.apk") + } + + from(layout.buildDirectory.dir("outputs/apk/xposed/debug")) { + include("*.apk") + rename(".*", "LibrePods-FOSS-v$versionName-debug.apk") + } + + from(layout.buildDirectory.dir("outputs/bundle/xposedPlayRelease")) { + include("*.aab") + } + + from(layout.buildDirectory.dir("outputs/rootModuleZips")) { + include("*.zip") + } +} + +tasks.register("packageReleaseArtifacts") { + dependsOn(collect) +} diff --git a/root-module-manual/.gitignore b/root-module-manual/.gitignore new file mode 100644 index 0000000..6d86d95 --- /dev/null +++ b/root-module-manual/.gitignore @@ -0,0 +1 @@ +system/ diff --git a/root-module-manual/META-INF/com/google/android/update-binary b/root-module-manual/META-INF/com/google/android/update-binary new file mode 100644 index 0000000..ea4889e --- /dev/null +++ b/root-module-manual/META-INF/com/google/android/update-binary @@ -0,0 +1,33 @@ +#!/sbin/sh + +################# +# Initialization +################# + +umask 022 + +# echo before loading util_functions +ui_print() { echo "$1"; } + +require_new_magisk() { + ui_print "*******************************" + ui_print " Please install Magisk v20.4+! " + ui_print "*******************************" + exit 1 +} + +######################### +# Load util_functions.sh +######################### + +OUTFD=$2 +ZIPFILE=$3 + +mount /data 2>/dev/null + +[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk +. /data/adb/magisk/util_functions.sh +[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk + +install_module +exit 0 \ No newline at end of file diff --git a/root-module-manual/META-INF/com/google/android/updater-script b/root-module-manual/META-INF/com/google/android/updater-script new file mode 100644 index 0000000..11d5c96 --- /dev/null +++ b/root-module-manual/META-INF/com/google/android/updater-script @@ -0,0 +1 @@ +#MAGISK diff --git a/root-module-manual/module.prop b/root-module-manual/module.prop new file mode 100644 index 0000000..693a9b9 --- /dev/null +++ b/root-module-manual/module.prop @@ -0,0 +1,7 @@ +id=librepods +name=LibrePods +version=v0.2.0 +versionCode=34 +author=@kavishdevar +description=Installs LibrePods as a system app for granting BLUETOOTH_PRIVILEGED and MODIFY_PHONE_STATE permission for better integraion with android. +updateJson=https://raw.githubusercontent.com/kavishdevar/librepods/main/update_nonpatch.json diff --git a/update_nonpatch.json b/update_nonpatch.json index e931cb7..4130319 100644 --- a/update_nonpatch.json +++ b/update_nonpatch.json @@ -1,6 +1,6 @@ { "version": "v0.2.3", "versionCode": 36, - "zipUrl": "https://github.com/kavishdevar/librepods/releases/download/v0.2.3/LibrePods-v0.2.3-release.zip", + "zipUrl": "https://github.com/kavishdevar/librepods/releases/download/v0.2.3/LibrePods-FOSS-v0.2.3-release.zip", "changelog": "https://raw.githubusercontent.com/kavishdevar/librepods/main/CHANGELOG.md" }