ZaStoGram/TMessagesProj_AppStandalone/build.gradle
loop-uh d3be3bfe8d
All checks were successful
Build four ZaStoGram APKs / build (arm64-v8a, ZaStoGram-standalone-arm64-v8a, Arm64, arm64) (push) Successful in 8m19s
Build four ZaStoGram APKs / build (armeabi-v7a, ZaStoGram-standalone-armeabi-v7a, Armv7, armv7) (push) Successful in 8m1s
Build four ZaStoGram APKs / build (x86, ZaStoGram-standalone-x86, X86, x86) (push) Successful in 8m36s
Build four ZaStoGram APKs / build (x86_64, ZaStoGram-standalone-x86_64, X64, x64) (push) Successful in 7m54s
ZaStoGram source guards / guards (push) Successful in 12s
Move Android builds and updates to Forgejo
2026-08-07 01:29:02 +03:00

250 lines
8.5 KiB
Groovy

apply plugin: 'com.android.application'
def zastoReleaseIdentity = rootProject.ext.zastoReleaseIdentity
def zastoUpdateChannel = zastoReleaseIdentity.updateChannel
def zastoBuildNumber = zastoReleaseIdentity.buildNumber
def zastoApplicationId = zastoUpdateChannel == "dev" ? "${APP_PACKAGE}.dev" : APP_PACKAGE
def zastoApplicationName = zastoUpdateChannel == "dev" ? "ZaStoGram Dev" : "ZaStoGram"
def zastoJavaString = { String value ->
return '"' + value.replace('\\', '\\\\').replace('"', '\\"') + '"'
}
def zastoReadSigningSecret = { String envName ->
def secretPath = System.getenv(envName)?.trim()
if (!secretPath) {
return null
}
def secretFile = file(secretPath)
if (!secretFile.isFile()) {
throw new GradleException("ZaStoGram signing secret file does not exist: ${secretPath}")
}
return secretFile.getText("UTF-8").trim()
}
def zastoReleaseKeystorePath = System.getenv("ZASTO_RELEASE_KEYSTORE")?.trim()
def zastoReleaseStorePassword = zastoReadSigningSecret("ZASTO_RELEASE_STORE_PASSWORD_FILE")
def zastoReleaseKeyPassword = zastoReadSigningSecret("ZASTO_RELEASE_KEY_PASSWORD_FILE")
def zastoReleaseKeyAlias = zastoReadSigningSecret("ZASTO_RELEASE_KEY_ALIAS_FILE")
def zastoExternalSigningValues = [
zastoReleaseKeystorePath,
zastoReleaseStorePassword,
zastoReleaseKeyPassword,
zastoReleaseKeyAlias,
]
if (zastoExternalSigningValues.any { it } && !zastoExternalSigningValues.every { it }) {
throw new GradleException("ZaStoGram external signing requires the keystore and all three credential files")
}
def zastoReleaseKeystoreFile = zastoReleaseKeystorePath
? file(zastoReleaseKeystorePath)
: file("../TMessagesProj/config/release.keystore")
if (zastoReleaseKeystorePath && !zastoReleaseKeystoreFile.isFile()) {
throw new GradleException("ZaStoGram release keystore does not exist: ${zastoReleaseKeystorePath}")
}
repositories {
mavenCentral()
google()
}
configurations {
compile.exclude module: 'support-v4'
}
configurations.all {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'androidx.recyclerview', module: 'recyclerview'
}
dependencies {
implementation project(':TMessagesProj')
implementation 'androidx.fragment:fragment:1.8.9'
implementation 'androidx.core:core:1.16.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
implementation files('../TMessagesProj/libs/libgsaverification-client.aar')
}
android {
compileSdkVersion 35
buildToolsVersion '35.0.0'
defaultConfig.applicationId = zastoApplicationId
sourceSets.main.jniLibs.srcDirs = ['../TMessagesProj/jni/']
lintOptions {
disable 'MissingTranslation'
disable 'ExtraTranslation'
disable 'BlockedPrivateApi'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
}
signingConfigs {
debug {
storeFile zastoReleaseKeystoreFile
storePassword zastoReleaseStorePassword ?: RELEASE_STORE_PASSWORD
keyAlias zastoReleaseKeyAlias ?: RELEASE_KEY_ALIAS
keyPassword zastoReleaseKeyPassword ?: RELEASE_KEY_PASSWORD
}
release {
storeFile zastoReleaseKeystoreFile
storePassword zastoReleaseStorePassword ?: RELEASE_STORE_PASSWORD
keyAlias zastoReleaseKeyAlias ?: RELEASE_KEY_ALIAS
keyPassword zastoReleaseKeyPassword ?: RELEASE_KEY_PASSWORD
}
}
buildTypes {
debug {
debuggable true
jniDebuggable true
signingConfig signingConfigs.debug
applicationIdSuffix ".web"
minifyEnabled false
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro', '../TMessagesProj/proguard-rules-beta.pro'
ndk.debugSymbolLevel = 'FULL'
}
standalone {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
minifyEnabled true
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
ndk.debugSymbolLevel = 'FULL'
}
}
sourceSets.debug {
manifest.srcFile '../TMessagesProj/config/release/AndroidManifest_standalone.xml'
}
sourceSets.standalone {
manifest.srcFile '../TMessagesProj/config/release/AndroidManifest_standalone.xml'
}
flavorDimensions "minApi"
productFlavors {
afat {
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
}
ext {
abiVersionCode = 9
}
sourceSets.standalone {
manifest.srcFile '../TMessagesProj/config/release/AndroidManifest_standalone.xml'
}
}
arm64 {
ndk {
abiFilters "arm64-v8a"
}
ext {
abiVersionCode = 11
}
sourceSets.standalone {
manifest.srcFile '../TMessagesProj/config/release/AndroidManifest_standalone.xml'
}
}
armv7 {
ndk {
abiFilters "armeabi-v7a"
}
ext {
abiVersionCode = 12
}
sourceSets.standalone {
manifest.srcFile '../TMessagesProj/config/release/AndroidManifest_standalone.xml'
}
}
x86 {
ndk {
abiFilters "x86"
}
ext {
abiVersionCode = 13
}
sourceSets.standalone {
manifest.srcFile '../TMessagesProj/config/release/AndroidManifest_standalone.xml'
}
}
x64 {
ndk {
abiFilters "x86_64"
}
ext {
abiVersionCode = 14
}
sourceSets.standalone {
manifest.srcFile '../TMessagesProj/config/release/AndroidManifest_standalone.xml'
}
}
}
defaultConfig.versionCode = Integer.parseInt(APP_VERSION_CODE)
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "app.apk"
// Reserve five decimal digits per upstream Telegram version: four for the
// Forgejo Actions run and one for the ABI. A newer dev prerelease can then
// be installed over the previous prerelease even when APP_VERSION_CODE did
// not change between workflow runs.
def abiVersionDigit = variant.productFlavors.get(0).abiVersionCode % 10
output.versionCodeOverride = defaultConfig.versionCode * 100000 + zastoBuildNumber * 10 + abiVersionDigit
}
}
def standaloneBuildFlavors = ["afat", "arm64", "armv7", "x86", "x64"]
variantFilter { variant ->
def names = variant.flavors*.name
if (variant.buildType.name != "release" && !names.any { standaloneBuildFlavors.contains(it) }) {
setIgnore(true)
}
}
defaultConfig {
minSdkVersion 24 // ZaStoGram: raised for Chaquopy (plugin engine); must match library
targetSdkVersion 35
versionName APP_VERSION_NAME
ndkVersion "27.2.12479018"
// Stable and dev are independent installed applications. Keep their
// package, visible label and updater channel derived from one identity.
resValue "string", "ZastoApplicationName", zastoApplicationName
buildConfigField "String", "ZASTO_UPDATE_CHANNEL", zastoJavaString(zastoUpdateChannel)
buildConfigField "String", "ZASTO_RELEASE_TAG", zastoJavaString(zastoReleaseIdentity.releaseTag)
buildConfigField "String", "ZASTO_FORGEJO_REPOSITORY", zastoJavaString(zastoReleaseIdentity.forgejoRepository)
buildConfigField "int", "ZASTO_BUILD_NUMBER", zastoBuildNumber.toString()
multiDexEnabled true
vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
externalNativeBuild {
cmake {
version '3.10.2'
arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-21' //, '-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON'
}
}
}
buildFeatures {
buildConfig = true
}
namespace 'org.telegram.messenger.web'
lintOptions {
checkReleaseBuilds false
}
}
apply plugin: 'com.google.gms.google-services'