ZaStoGram/build.gradle

45 lines
2.4 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.6.1'
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:1.9.20"
// ZaStoGram plugin engine: Chaquopy embeds CPython 3.11 into the APK.
// 16.1.x supports AGP 7.0-8.13 (we use 8.6.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 zastoGithubRepositoryValue = (findProperty("zastoGithubRepository") ?: System.getenv("ZASTO_GITHUB_REPOSITORY") ?: "youtubediscord/ZaStoGram").toString().trim()
if (!(zastoGithubRepositoryValue ==~ /[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+/)) {
throw new GradleException("Invalid ZaStoGram GitHub repository '${zastoGithubRepositoryValue}'. 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")
}
ext.zastoReleaseIdentity = [
updateChannel: zastoUpdateChannelValue,
releaseTag: zastoReleaseTagValue,
githubRepository: zastoGithubRepositoryValue,
buildNumber: zastoBuildNumberValue.toInteger(),
]