Skip to content

Commit 67fc93b

Browse files
committed
android: add packaging task
1 parent 0b578d6 commit 67fc93b

7 files changed

Lines changed: 124 additions & 12 deletions

File tree

.gitignore

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
root-module/radare2-5.9.9-android-aarch64.tar.gz
2-
wak.toml
3-
log.txt
4-
btl2capfix.zip
5-
root-module-manual
1+
release
62
.vscode
7-
testing.py
83
.DS_Store
94
CMakeLists.txt.user*
105

android/app/build.gradle.kts

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import java.util.Properties
22

3+
val versionName = "0.2.3"
4+
35
plugins {
46
alias(libs.plugins.android.application)
57
alias(libs.plugins.kotlin.compose)
@@ -29,15 +31,14 @@ android {
2931
minSdk = 33
3032
targetSdk = 37
3133
versionCode = 36
32-
versionName = "0.2.3"
34+
versionName = versionName
3335
}
3436
buildTypes {
3537
release {
3638
isMinifyEnabled = true
3739
isShrinkResources = true
3840
proguardFiles(
39-
getDefaultProguardFile("proguard-android-optimize.txt"),
40-
"proguard-rules.pro"
41+
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
4142
)
4243
externalNativeBuild {
4344
cmake {
@@ -83,7 +84,7 @@ android {
8384
}
8485
sourceSets {
8586
getByName("main") {
86-
res.directories+="src/main/res-apple"
87+
res.directories += "src/main/res-apple"
8788
}
8889
}
8990

@@ -144,9 +145,83 @@ dependencies {
144145
}
145146

146147
aboutLibraries {
147-
export{
148+
export {
148149
prettyPrint = true
149150
excludeFields = listOf("generated")
150151
outputFile = file("src/main/res/raw/aboutlibraries.json")
151152
}
152153
}
154+
155+
val rootModuleDir = rootProject.file("../root-module-manual")
156+
val releaseDir = rootProject.file("../release")
157+
158+
fun cap(s: String) = s.replaceFirstChar { it.uppercase() }
159+
160+
fun registerRootModuleZipTask(
161+
name: String,
162+
flavor: String,
163+
buildType: String
164+
) = tasks.register<Zip>(name) {
165+
166+
val variantTask = "assemble${cap(flavor)}${cap(buildType)}"
167+
dependsOn(variantTask)
168+
169+
val apkPath = "outputs/apk/$flavor/$buildType/app-$flavor-$buildType.apk"
170+
171+
from(rootModuleDir)
172+
173+
duplicatesStrategy = DuplicatesStrategy.WARN
174+
175+
from(layout.buildDirectory.file(apkPath)) {
176+
into("system/priv-app/LibrePods")
177+
rename { "LibrePods.apk" }
178+
}
179+
180+
archiveFileName.set("LibrePods-FOSS-v$versionName-$buildType.zip")
181+
destinationDirectory.set(layout.buildDirectory.dir("outputs/rootModuleZips"))
182+
}
183+
184+
val zipRelease = registerRootModuleZipTask(
185+
"zipXposedReleaseModule",
186+
"xposed",
187+
"release"
188+
)
189+
190+
val zipDebug = registerRootModuleZipTask(
191+
"zipXposedDebugModule",
192+
"xposed",
193+
"debug"
194+
)
195+
196+
val collect = tasks.register<Copy>("collectReleaseArtifacts") {
197+
198+
dependsOn(
199+
zipRelease,
200+
zipDebug,
201+
"bundleXposedPlayRelease"
202+
)
203+
204+
into(releaseDir)
205+
206+
from(layout.buildDirectory.dir("outputs/apk/xposed/release")) {
207+
include("*.apk")
208+
rename(".*", "LibrePods-FOSS-v$versionName-release.apk")
209+
}
210+
211+
from(layout.buildDirectory.dir("outputs/apk/xposed/debug")) {
212+
include("*.apk")
213+
rename(".*", "LibrePods-FOSS-v$versionName-debug.apk")
214+
}
215+
216+
from(layout.buildDirectory.dir("outputs/bundle/xposedPlayRelease")) {
217+
include("*.aab")
218+
}
219+
220+
from(layout.buildDirectory.dir("outputs/rootModuleZips")) {
221+
include("*.zip")
222+
}
223+
}
224+
225+
tasks.register("packageReleaseArtifacts") {
226+
dependsOn(collect)
227+
}

root-module-manual/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
system/
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/sbin/sh
2+
3+
#################
4+
# Initialization
5+
#################
6+
7+
umask 022
8+
9+
# echo before loading util_functions
10+
ui_print() { echo "$1"; }
11+
12+
require_new_magisk() {
13+
ui_print "*******************************"
14+
ui_print " Please install Magisk v20.4+! "
15+
ui_print "*******************************"
16+
exit 1
17+
}
18+
19+
#########################
20+
# Load util_functions.sh
21+
#########################
22+
23+
OUTFD=$2
24+
ZIPFILE=$3
25+
26+
mount /data 2>/dev/null
27+
28+
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
29+
. /data/adb/magisk/util_functions.sh
30+
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
31+
32+
install_module
33+
exit 0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#MAGISK

root-module-manual/module.prop

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
id=librepods
2+
name=LibrePods
3+
version=v0.2.0
4+
versionCode=34
5+
author=@kavishdevar
6+
description=Installs LibrePods as a system app for granting BLUETOOTH_PRIVILEGED and MODIFY_PHONE_STATE permission for better integraion with android.
7+
updateJson=https://raw.githubusercontent.com/kavishdevar/librepods/main/update_nonpatch.json

update_nonpatch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"version": "v0.2.3",
33
"versionCode": 36,
4-
"zipUrl": "https://github.com/kavishdevar/librepods/releases/download/v0.2.3/LibrePods-v0.2.3-release.zip",
4+
"zipUrl": "https://github.com/kavishdevar/librepods/releases/download/v0.2.3/LibrePods-FOSS-v0.2.3-release.zip",
55
"changelog": "https://raw.githubusercontent.com/kavishdevar/librepods/main/CHANGELOG.md"
66
}

0 commit comments

Comments
 (0)