refactor(android): simplify Python sync task and remove product flavors from build.gradle

This commit is contained in:
Ivan 2026-04-24 15:02:01 -05:00
parent 2a4fb9cae4
commit 4f4fbc204a
No known key found for this signature in database
GPG key ID: B84314E2D9332AE0
2 changed files with 18 additions and 48 deletions

View file

@ -42,17 +42,6 @@ android {
namespace 'com.meshchatx'
compileSdk 34
flavorDimensions "pythonBundle"
productFlavors {
slim {
dimension "pythonBundle"
isDefault true
}
full {
dimension "pythonBundle"
}
}
defaultConfig {
applicationId "com.meshchatx"
minSdk 24
@ -114,47 +103,28 @@ tasks.register("fetchRepositoryBundledWheels", Exec) {
}
}
def registerMeshchatPythonSync = { String bundle ->
def cap = bundle.capitalize()
tasks.register("syncMeshchatPython${cap}", Sync) {
if (bundle == "full") {
dependsOn("fetchRepositoryBundledWheels")
}
if (!meshchatSourceDir.exists()) {
throw new org.gradle.api.GradleException("Missing meshchatx source directory at ${meshchatSourceDir}")
}
doFirst {
delete(
file("$projectDir/src/main/python/meshchatx"),
file("$projectDir/src/main/python/LXST"),
file("$projectDir/src/main/python/LXMF"),
file("$projectDir/src/main/python/RNS")
)
}
from(meshchatSourceDir) {
if (bundle == "slim") {
exclude("src/frontend/**")
exclude("public/reticulum-docs-bundled/**")
exclude("public/rnode-flasher/**")
exclude("public/repository-server-bundled/**")
}
}
includeEmptyDirs = false
from(new File(repoRoot, "CHANGELOG.md"))
into(file("$projectDir/src/${bundle}/python/meshchatx"))
tasks.register("syncMeshchatPython", Sync) {
dependsOn("fetchRepositoryBundledWheels")
if (!meshchatSourceDir.exists()) {
throw new org.gradle.api.GradleException("Missing meshchatx source directory at ${meshchatSourceDir}")
}
doFirst {
delete(
file("$projectDir/src/main/python/meshchatx"),
file("$projectDir/src/main/python/LXST"),
file("$projectDir/src/main/python/LXMF"),
file("$projectDir/src/main/python/RNS")
)
}
from(meshchatSourceDir)
includeEmptyDirs = false
from(new File(repoRoot, "CHANGELOG.md"))
into(file("$projectDir/src/main/python/meshchatx"))
}
registerMeshchatPythonSync("slim")
registerMeshchatPythonSync("full")
tasks.configureEach { task ->
if (task.name.toLowerCase().contains("merge") && task.name.toLowerCase().contains("pythonsources")) {
if (task.name.contains("Slim")) {
task.dependsOn(tasks.named("syncMeshchatPythonSlim"))
} else if (task.name.contains("Full")) {
task.dependsOn(tasks.named("syncMeshchatPythonFull"))
}
task.dependsOn(tasks.named("syncMeshchatPython"))
}
}

View file

@ -80,7 +80,7 @@ if [[ ! -x "${BT_DIR}/zipalign" || ! -x "${BT_DIR}/apksigner" ]]; then
exit 1
fi
APK_GLOB="${APK_GLOB:-android/app/build/outputs/apk/*/release/*-unsigned.apk}"
APK_GLOB="${APK_GLOB:-android/app/build/outputs/apk/release/*-unsigned.apk}"
shopt -s nullglob
APKS=( ${APK_GLOB} )
shopt -u nullglob