ZaStoGram/build.gradle
loop-uh cfafa0c98c
Some checks failed
ZaStoGram source guards / guards (push) Failing after 48s
Build three ZaStoGram APKs / build (armeabi-v7a, ZaStoGram-standalone-armeabi-v7a, Armv7, armv7) (push) Failing after 2m46s
Build three ZaStoGram APKs / build (x86, ZaStoGram-standalone-x86, X86, x86) (push) Failing after 2m59s
Build three ZaStoGram APKs / build (arm64-v8a, ZaStoGram-standalone-arm64-v8a, Arm64, arm64) (push) Failing after 3m14s
Обновить Telegram до 12.10.3 и подключить WEB-прокси
Влит DrKLO/Telegram master 9552e5541 (12.10.2 7086, 12.10.3 7089,
update submodules, PR #1833 с вибрацией звонков на Android 13+).
Сабмодули td, boringssl и media добавлены, tlottie обновлён, как в апстриме.

WEB-прокси из апстрима встроен в прокси-слой ZaStoGram: ProxyInfo хранит
ProxySettings, список прокси получил схему V5 с типом (V3 уже занят старыми
WSS-полями), ссылки tg://webproxy и t.me/webproxy разбираются ProxyLinkHelper,
тип WEB есть в редакторе прокси. Нативный слой видит WEB как обычный MTProxy
на локальном мосте с секретом самого прокси и MtProxyOptions.disabled(): без
FakeTLS, фрагментации, WSS и soft mux. Страж check_web_proxy_isolation.py
держит этот контракт.

Standalone оставлен без shrinkResources: плагины ищут ресурсы по имени.
2026-09-23 16:31:29 +03:00

106 lines
5.3 KiB
Groovy

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
google()
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.13.2'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.huawei.agconnect:agcp:1.9.1.301'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0"
// ZaStoGram plugin engine: Chaquopy embeds CPython 3.11 into the APK.
// 16.1.x supports AGP 7.0-8.13 (we use 8.10.1) and Python 3.8-3.13.
classpath 'com.chaquo.python:gradle:16.1.0'
}
}
repositories {
google()
}
// ZaStoGram release identity is a single build-wide input. The standalone
// application derives both its install identity and updater channel from these
// values, so a dev APK can never accidentally replace the stable application.
def zastoUpdateChannelValue = (findProperty("zastoUpdateChannel") ?: System.getenv("ZASTO_UPDATE_CHANNEL") ?: "stable").toString().trim().toLowerCase()
if (!(zastoUpdateChannelValue in ["dev", "stable"])) {
throw new GradleException("Unsupported ZaStoGram update channel '${zastoUpdateChannelValue}'. Expected dev or stable")
}
def zastoReleaseTagValue = (findProperty("zastoReleaseTag") ?: System.getenv("ZASTO_RELEASE_TAG") ?: "").toString().trim()
def zastoForgejoRepositoryValue = (findProperty("zastoForgejoRepository") ?: System.getenv("ZASTO_FORGEJO_REPOSITORY") ?: "zastogram/ZaStoGram").toString().trim()
if (!(zastoForgejoRepositoryValue ==~ /[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+/)) {
throw new GradleException("Invalid ZaStoGram Forgejo repository '${zastoForgejoRepositoryValue}'. Expected owner/repository")
}
def zastoBuildNumberValue = (findProperty("zastoBuildNumber") ?: System.getenv("ZASTO_BUILD_NUMBER") ?: "0").toString().trim()
if (!(zastoBuildNumberValue ==~ /\d+/) || zastoBuildNumberValue.toInteger() > 9999) {
throw new GradleException("Invalid ZaStoGram build number '${zastoBuildNumberValue}'. Expected an integer from 0 to 9999")
}
// The release tag is the single source of truth for a stable build. Android
// refuses to install a package whose versionCode is not above the installed
// one and reports only "App not installed", so a hand-passed build number is
// a silent trap: pass a smaller one by accident and the release is dead on
// arrival. A semantic tag therefore DERIVES the number instead, which makes
// "1.1.14 is newer than 1.1.13" true by construction.
//
// Layout: X*1000 + Y*100 + Z, so 1.1.14 -> 1114 and 1.2.0 -> 1200. Dev builds
// tag themselves differently (forgejo-build-N-M) and keep the CI run number;
// they install under their own application id and never meet a stable build.
def zastoSemanticTag = (zastoReleaseTagValue =~ /^(\d+)\.(\d+)\.(\d+)$/)
def zastoResolvedBuildNumber = zastoBuildNumberValue.toInteger()
if (zastoSemanticTag.matches()) {
def major = zastoSemanticTag[0][1].toInteger()
def minor = zastoSemanticTag[0][2].toInteger()
def patch = zastoSemanticTag[0][3].toInteger()
if (major > 9 || minor > 9 || patch > 99) {
throw new GradleException(
"Release tag '${zastoReleaseTagValue}' does not fit the versionCode layout. " +
"Expected major and minor below 10 and patch below 100.")
}
zastoResolvedBuildNumber = major * 1000 + minor * 100 + patch
}
ext.zastoReleaseIdentity = [
updateChannel: zastoUpdateChannelValue,
releaseTag: zastoReleaseTagValue,
forgejoRepository: zastoForgejoRepositoryValue,
buildNumber: zastoResolvedBuildNumber,
]
// Strip JLatexMath fonts we don't ship (transitive AAR assets from
// io.noties.markwon:ext-latex -> ru.noties:jlatexmath-android, ~764 KB total under
// assets/org/scilab/forge/jlatexmath/fonts/). Has to live in the APK modules — a
// library's androidResources.ignoreAssetsPattern doesn't filter packaging in apps
// that consume it. Using subprojects keeps it in one place.
// keep: base/, latin/, maths/, euler/ (\mathbb, \mathcal, \mathfrak still work)
// drop: latin/optional/, maths/optional/ (~290 KB; \textbf/\textit/\mathds fall back)
// licences/ (~20 KB; pure license text files)
subprojects {
plugins.withId('com.android.application') {
android {
androidResources {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~:!optional:!licences:!*stmary*:!*eufb*'
}
}
}
if (project.projectDir.absolutePath.contains('/TMessagesProj_Modules/media/')) {
project.plugins.withId('com.android.library') {
project.android {
if (namespace == null) {
def manifestFile = file("${project.projectDir}/src/main/AndroidManifest.xml")
if (manifestFile.exists()) {
def manifest = new XmlSlurper().parse(manifestFile)
def manifestPackage = manifest.@package.text()
if (manifestPackage) {
namespace manifestPackage
}
}
}
}
}
}
}