NekoX/TMessagesProj/build.gradle

420 lines
12 KiB
Groovy
Raw Normal View History

2021-02-18 03:32:07 +01:00
import cn.hutool.core.util.RuntimeUtil
2021-03-31 21:29:44 +02:00
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
2013-10-25 17:19:00 +02:00
2022-07-07 11:27:32 +02:00
def verName = "8.8.5-preview02"
def verCode = 645
2021-02-18 03:32:07 +01:00
if (System.getenv("DEBUG_BUILD") == "true") {
2022-01-21 10:19:22 +01:00
verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:'%h' -n 1").trim()
2021-02-18 03:32:07 +01:00
}
2022-07-06 14:35:15 +02:00
def officialVer = "8.8.5"
def officialCode = 2721
2020-07-22 05:23:05 +02:00
2020-07-08 06:00:22 +02:00
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
2020-07-22 05:23:05 +02:00
def beta = verName.contains("preview")
2020-07-08 06:00:22 +02:00
if (serviceAccountCredentialsFile.isFile()) {
2020-07-22 05:23:05 +02:00
setupPlay(beta)
2020-07-08 06:00:22 +02:00
play.serviceAccountCredentials = serviceAccountCredentialsFile
} else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) {
2020-07-22 05:23:05 +02:00
setupPlay(beta)
2020-07-08 06:00:22 +02:00
}
2020-07-22 05:23:05 +02:00
void setupPlay(boolean beta) {
2021-03-31 21:29:44 +02:00
apply plugin: "com.github.triplet.play"
2020-07-08 06:00:22 +02:00
play {
2020-07-22 05:23:05 +02:00
track = beta ? "beta" : "production"
2020-07-08 06:00:22 +02:00
defaultToAppBundles = true
}
}
2016-10-11 13:57:01 +02:00
configurations {
2021-03-31 21:29:44 +02:00
compile.exclude module: "support-v4"
2016-10-11 13:57:01 +02:00
}
2021-02-28 15:37:30 +01:00
def keystorePwd = null
def alias = null
def pwd = null
2021-11-15 19:04:57 +01:00
def disableCMakeRelWithDebInfo = System.getenv("COMPILE_NATIVE") == null
2021-02-28 15:37:30 +01:00
Properties properties
def base64 = System.getenv("LOCAL_PROPERTIES")
if (base64 != null && !base64.isBlank()) {
properties = new Properties()
properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64)))
2021-03-31 21:29:44 +02:00
} else if (project.rootProject.file("local.properties").exists()) {
2021-02-28 15:37:30 +01:00
properties = new Properties()
2021-03-31 21:29:44 +02:00
properties.load(project.rootProject.file("local.properties").newDataInputStream())
2021-02-28 15:37:30 +01:00
}
if (properties != null) {
keystorePwd = properties.getProperty("KEYSTORE_PASS")
alias = properties.getProperty("ALIAS_NAME")
pwd = properties.getProperty("ALIAS_PASS")
}
keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS")
alias = alias ?: System.getenv("ALIAS_NAME")
pwd = pwd ?: System.getenv("ALIAS_PASS")
2021-04-13 08:49:48 +02:00
def targetTask = ""
2021-02-28 15:37:30 +01:00
if (!gradle.startParameter.taskNames.isEmpty()) {
if (gradle.startParameter.taskNames.size == 1) {
2021-04-13 08:49:48 +02:00
targetTask = gradle.startParameter.taskNames[0].toLowerCase()
2021-02-28 15:37:30 +01:00
}
}
2021-03-31 21:29:44 +02:00
def nativeTarget = System.getenv("NATIVE_TARGET")
if (nativeTarget == null) nativeTarget = ""
2013-10-25 17:19:00 +02:00
android {
compileSdkVersion 31
2021-07-26 15:37:23 +02:00
buildToolsVersion "31.0.0"
2021-02-18 03:32:07 +01:00
ndkVersion rootProject.ext.ndkVersion
2020-06-24 18:15:30 +02:00
defaultConfig.applicationId = "nekox.messenger"
2017-12-08 18:35:59 +01:00
2021-02-28 08:08:33 +01:00
splits {
abi {
if (targetTask.contains("fdroid")) {
enable false
universalApk true
} else {
enable true
universalApk false
if (!nativeTarget.isBlank()) {
reset()
include nativeTarget
2021-02-28 14:01:58 +01:00
}
2021-02-28 08:08:33 +01:00
}
}
2021-02-28 14:01:58 +01:00
2021-02-28 08:08:33 +01:00
}
2020-06-24 18:15:30 +02:00
defaultConfig {
minSdkVersion 16
2020-11-04 13:43:49 +01:00
//noinspection ExpiredTargetSdkVersion,OldTargetApi
2021-11-06 05:32:15 +01:00
targetSdkVersion 30
2015-10-29 18:10:07 +01:00
2020-06-24 18:15:30 +02:00
versionName verName
versionCode verCode
2021-01-16 17:25:30 +01:00
def appId = "1391584"
def appHash = "355c91550b0d658cfb7ff89dcf91a08c"
2020-06-24 18:15:30 +02:00
//obtain your own keys at https://core.telegram.org/api/obtaining_api_id
2021-01-16 17:25:30 +01:00
if (properties != null) {
appId = properties.getProperty("TELEGRAM_APP_ID") ?: System.getenv("TELEGRAM_APP_ID") ?: appId
appHash = properties.getProperty("TELEGRAM_APP_HASH") ?: System.getenv("TELEGRAM_APP_HASH") ?: appHash
2020-06-24 18:15:30 +02:00
}
2021-02-01 18:24:58 +01:00
2021-03-31 21:29:44 +02:00
buildConfigField "String", "OFFICIAL_VERSION", "\"" + officialVer + "\""
buildConfigField "int", "OFFICIAL_VERSION_CODE", officialCode + ""
buildConfigField "int", "APP_ID", appId
buildConfigField "String", "APP_HASH", "\"" + appHash + "\""
2020-06-24 18:15:30 +02:00
externalNativeBuild {
cmake {
2021-03-31 21:29:44 +02:00
version "3.10.2"
arguments "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-16", "-j=${Runtime.getRuntime().availableProcessors()}"
2020-06-24 18:15:30 +02:00
}
}
}
bundle {
language {
enableSplit = false
}
}
2016-10-11 13:57:01 +02:00
externalNativeBuild {
2020-09-30 15:48:47 +02:00
cmake {
2021-03-31 21:29:44 +02:00
path "jni/CMakeLists.txt"
2016-10-11 13:57:01 +02:00
}
}
2018-07-30 04:07:02 +02:00
lintOptions {
2021-03-31 21:29:44 +02:00
disable "MissingTranslation"
disable "ExtraTranslation"
disable "BlockedPrivateApi"
2018-07-30 04:07:02 +02:00
}
2020-06-24 18:15:30 +02:00
packagingOptions {
2021-03-31 21:29:44 +02:00
exclude "/fabric/**"
exclude "/META-INF/*.version"
exclude "/META-INF/*.kotlin_module"
2021-04-13 04:59:56 +02:00
exclude "/META-INF/native-image/**"
2021-03-31 21:29:44 +02:00
exclude "/builddef.lst"
exclude "/*.txt"
2021-04-13 04:59:56 +02:00
exclude "/DebugProbesKt.bin"
exclude "/okhttp3/internal/publicsuffix/NOTICE"
2020-06-24 18:15:30 +02:00
}
2017-03-31 01:58:05 +02:00
dexOptions {
jumboMode = true
}
2015-01-02 23:15:07 +01:00
compileOptions {
2018-08-27 10:33:11 +02:00
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
2020-08-14 18:58:22 +02:00
coreLibraryDesugaringEnabled true
2015-01-02 23:15:07 +01:00
}
2020-06-24 18:15:30 +02:00
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
2020-12-17 18:32:45 +01:00
testOptions {
unitTests.includeAndroidResources = true
}
2013-12-20 20:25:49 +01:00
signingConfigs {
2019-06-11 07:56:33 +02:00
release {
2021-03-31 21:29:44 +02:00
storeFile project.file("release.keystore")
2020-06-24 18:15:30 +02:00
storePassword keystorePwd
keyAlias alias
keyPassword pwd
2013-12-20 20:25:49 +01:00
}
}
buildTypes {
debug {
2020-11-22 10:26:11 +01:00
isDefault true
2013-12-20 20:25:49 +01:00
debuggable true
jniDebuggable true
2020-04-24 11:21:58 +02:00
multiDexEnabled true
zipAlignEnabled true;
signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release
2021-05-18 12:21:26 +02:00
ndk.debugSymbolLevel = "FULL"
2020-06-24 18:15:30 +02:00
}
2019-12-31 14:08:08 +01:00
2020-06-24 18:15:30 +02:00
releaseNoGcm {
2019-01-23 18:03:33 +01:00
debuggable false
jniDebuggable false
minifyEnabled true
2020-06-24 18:15:30 +02:00
shrinkResources true
2020-09-03 17:37:42 +02:00
multiDexEnabled true
2020-11-22 03:57:43 +01:00
zipAlignEnabled true
2021-03-31 21:29:44 +02:00
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
matchingFallbacks = ["release", "debug"]
2021-02-28 14:01:58 +01:00
signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release
2019-01-23 18:03:33 +01:00
}
2013-12-20 20:25:49 +01:00
release {
2020-09-03 17:37:42 +02:00
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
2020-11-22 03:57:43 +01:00
zipAlignEnabled true
2021-03-31 21:29:44 +02:00
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
matchingFallbacks = ["release", "debug"]
2021-03-08 12:12:22 +01:00
signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release
2020-06-24 18:15:30 +02:00
}
2021-02-28 14:01:58 +01:00
foss {
2020-09-03 17:37:42 +02:00
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
2020-11-22 03:57:43 +01:00
zipAlignEnabled true
2021-03-31 21:29:44 +02:00
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
matchingFallbacks = ["release", "debug"]
2013-12-20 20:25:49 +01:00
}
2021-02-28 14:01:58 +01:00
fdroidRelease {
2021-02-28 14:01:58 +01:00
initWith foss
2021-03-31 21:29:44 +02:00
matchingFallbacks = ["release", "debug"]
2021-02-28 14:01:58 +01:00
}
}
2020-07-08 06:00:22 +02:00
sourceSets {
2014-11-21 20:36:21 +01:00
2020-07-08 06:00:22 +02:00
main {
2021-04-13 04:59:56 +02:00
jni.srcDirs = []
2021-11-15 19:04:57 +01:00
assets.srcDirs = ["src/main/assets", "src/emojis/twitter"]
2020-07-08 06:00:22 +02:00
}
2020-06-24 18:15:30 +02:00
2020-07-08 06:00:22 +02:00
debug {
2021-02-28 03:26:20 +01:00
java {
2021-03-31 21:29:44 +02:00
srcDirs "src/main/java", "src/gservcies/java"
2021-02-28 03:26:20 +01:00
}
2021-11-15 19:04:57 +01:00
jni.srcDirs = ["./jni/"]
2021-02-28 03:26:20 +01:00
manifest {
2021-03-31 21:29:44 +02:00
srcFile "src/gservcies/AndroidManifest.xml"
2021-02-28 03:26:20 +01:00
}
2020-07-08 06:00:22 +02:00
}
2020-06-24 18:15:30 +02:00
2020-07-08 06:00:22 +02:00
releaseNoGcm {
2021-11-15 19:04:57 +01:00
jni.srcDirs = []
2021-02-28 03:26:20 +01:00
jniLibs {
2021-03-31 21:29:44 +02:00
srcDir "src/main/libs"
2021-02-28 03:26:20 +01:00
}
2020-07-08 06:00:22 +02:00
}
2020-06-24 18:15:30 +02:00
2020-07-08 06:00:22 +02:00
release {
2021-02-28 03:26:20 +01:00
java {
2021-03-31 21:29:44 +02:00
srcDirs "src/main/java", "src/gservcies/java"
2021-02-28 03:26:20 +01:00
}
2021-11-15 19:04:57 +01:00
jni.srcDirs = []
2021-02-28 03:26:20 +01:00
jniLibs {
2021-03-31 21:29:44 +02:00
srcDir "src/main/libs"
2021-02-28 03:26:20 +01:00
}
manifest {
2021-03-31 21:29:44 +02:00
srcFile "src/gservcies/AndroidManifest.xml"
2021-02-28 03:26:20 +01:00
}
2020-07-08 06:00:22 +02:00
}
2020-06-24 18:15:30 +02:00
2021-02-28 14:01:58 +01:00
foss {
2021-02-28 03:26:20 +01:00
jni {
2021-03-31 21:29:44 +02:00
srcDirs = ["./jni/"]
2021-02-28 03:26:20 +01:00
}
2020-07-08 06:00:22 +02:00
}
2020-06-24 18:15:30 +02:00
fdroidRelease {
2021-02-28 19:40:50 +01:00
jni {
2021-03-31 21:29:44 +02:00
srcDirs = ["./jni/"]
2021-02-28 19:40:50 +01:00
}
2021-11-15 19:04:57 +01:00
jniLibs.srcDirs = []
2021-02-28 19:40:50 +01:00
}
2020-07-08 06:00:22 +02:00
}
2020-06-24 18:15:30 +02:00
flavorDimensions "version"
2019-05-14 14:08:05 +02:00
2020-06-24 18:15:30 +02:00
productFlavors {
mini {
2021-05-18 12:24:06 +02:00
isDefault true
2021-11-17 14:09:53 +01:00
manifestPlaceholders = [is_full_version: "false"]
2020-06-24 18:15:30 +02:00
}
2020-08-16 03:08:56 +02:00
full {
2021-11-17 14:09:53 +01:00
manifestPlaceholders = [is_full_version: "true"]
2020-08-20 11:08:26 +02:00
}
2021-05-18 12:24:06 +02:00
miniPlay {
2021-03-31 21:29:44 +02:00
versionNameSuffix "-play"
2021-02-28 16:50:19 +01:00
versionCode verCode - 2
2021-11-17 14:09:53 +01:00
manifestPlaceholders = [is_full_version: "false"]
2020-10-11 11:30:08 +02:00
}
2020-06-24 18:15:30 +02:00
}
2019-05-14 14:08:05 +02:00
2020-07-08 05:28:13 +02:00
sourceSets.all { set ->
2021-03-22 11:11:46 +01:00
if (set.name.startsWith("full")) {
set.dependencies {
implementation fileTree("libs")
}
}
2020-06-24 18:15:30 +02:00
}
tasks.all { task ->
if (((task.name.endsWith("Ndk") || task.name.startsWith("generateJsonModel") || task.name.startsWith("externalNativeBuild"))) && !(task.name.contains("Debug") || task.name.contains("Foss") || task.name.contains("Fdroid"))) {
2020-06-24 18:15:30 +02:00
task.enabled = false
}
if (task.name.contains("uploadCrashlyticsMappingFile")) {
enabled = false
}
if (disableCMakeRelWithDebInfo && task.name.contains("CMakeRelWithDebInfo") && !targetTask.contains("fdroid")) {
2021-11-15 19:04:57 +01:00
enabled = false
}
2020-06-24 18:15:30 +02:00
}
applicationVariants.all { variant ->
variant.outputs.all { output ->
2022-01-21 09:53:16 +01:00
outputFileName = outputFileName.replace("TMessagesProj", "NekoX-v" + versionName)
2017-12-08 18:35:59 +01:00
}
2016-03-16 13:26:32 +01:00
}
2013-10-25 17:19:00 +02:00
}
2016-04-22 15:49:00 +02:00
2022-06-21 18:55:12 +02:00
def okHttpVersion = "5.0.0-alpha.9"
def fcmVersion = "21.1.0"
2021-07-26 20:27:01 +02:00
def crashlyticsVersion = "18.2.0"
2021-09-21 02:21:16 +02:00
def playCoreVersion = "1.10.1"
2021-03-14 16:15:57 +01:00
dependencies {
2021-12-20 16:57:51 +01:00
implementation "androidx.browser:browser:1.4.0"
2022-06-21 18:55:12 +02:00
implementation "androidx.core:core-ktx:1.8.0"
2021-03-31 21:29:44 +02:00
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.viewpager:viewpager:1.0.0"
2021-08-07 11:28:34 +02:00
implementation "androidx.exifinterface:exifinterface:1.3.3"
2021-03-14 16:15:57 +01:00
implementation "androidx.interpolator:interpolator:1.0.0"
2021-03-31 21:29:44 +02:00
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
implementation "androidx.multidex:multidex:2.0.1"
implementation "androidx.sharetarget:sharetarget:1.1.0"
2021-03-14 16:15:57 +01:00
2021-07-26 20:27:01 +02:00
compileOnly "org.checkerframework:checker-qual:3.16.0"
2021-03-31 21:29:44 +02:00
compileOnly "org.checkerframework:checker-compat-qual:2.5.5"
2021-03-14 16:15:57 +01:00
2021-03-31 21:29:44 +02:00
// don"t change this :)
2021-03-14 16:15:57 +01:00
//noinspection GradleDependency
2021-08-01 20:10:40 +02:00
implementation "com.googlecode.mp4parser:isoparser:1.0.6"
2021-03-14 16:15:57 +01:00
2021-09-21 02:21:16 +02:00
implementation "com.google.code.gson:gson:2.8.8"
2021-03-31 21:29:44 +02:00
implementation "org.osmdroid:osmdroid-android:6.1.10"
2021-09-21 02:21:16 +02:00
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.30"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
2021-03-14 16:15:57 +01:00
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
2021-09-21 02:21:16 +02:00
implementation 'dnsjava:dnsjava:3.4.1'
2021-03-31 21:29:44 +02:00
implementation "org.dizitart:nitrite:3.4.3"
2021-03-14 16:15:57 +01:00
2021-09-21 02:21:16 +02:00
implementation "cn.hutool:hutool-core:5.7.13"
implementation "cn.hutool:hutool-crypto:5.7.13"
2021-07-26 20:27:01 +02:00
implementation 'cn.hutool:hutool-http:5.7.5'
2021-09-21 02:21:16 +02:00
implementation "com.jakewharton:process-phoenix:2.1.2"
2021-03-14 16:15:57 +01:00
2021-07-26 20:27:01 +02:00
compileOnly 'org.yaml:snakeyaml:1.29'
fullImplementation 'org.yaml:snakeyaml:1.29'
2021-03-14 16:15:57 +01:00
implementation project(":openpgp-api")
compileOnly fileTree("libs")
compileOnly "com.google.firebase:firebase-messaging:$fcmVersion"
compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
compileOnly "com.google.android.play:core:$playCoreVersion"
debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
debugImplementation "com.google.android.play:core:$playCoreVersion"
releaseImplementation "com.google.firebase:firebase-messaging:$fcmVersion"
releaseImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
releaseImplementation "com.google.android.play:core:$playCoreVersion"
2021-03-31 21:29:44 +02:00
testImplementation "junit:junit:4.13.2"
2021-07-26 21:40:08 +02:00
testImplementation "androidx.test:core:1.4.0"
testImplementation "org.robolectric:robolectric:4.5.1"
2021-03-14 16:15:57 +01:00
2021-03-31 21:29:44 +02:00
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
2021-03-14 16:15:57 +01:00
}
2021-03-31 21:29:44 +02:00
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
2020-06-24 18:15:30 +02:00
android {
tasks.all { task ->
2021-03-31 21:29:44 +02:00
if (task.name.startsWith("uploadCrashlyticsMappingFile")) {
2020-06-24 18:15:30 +02:00
task.enabled = false
2021-03-31 21:29:44 +02:00
} else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) {
2020-06-24 18:15:30 +02:00
task.enabled = false
2021-03-31 21:29:44 +02:00
} else if (task.name.endsWith("GoogleServices") && task.name.contains("NoGcm")) {
2020-06-24 18:15:30 +02:00
task.enabled = false
}
}
2021-12-27 04:46:36 +01:00
}