Nagram/TMessagesProj/build.gradle

512 lines
18 KiB
Groovy
Raw Normal View History

2024-05-07 01:11:53 +00:00
import io.sentry.android.gradle.extensions.InstrumentationFeature
import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel
2021-03-31 19:29:44 +00:00
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
2024-05-07 01:11:53 +00:00
apply plugin: "io.sentry.android.gradle"
2013-10-25 15:19:00 +00:00
repositories {
maven {
url 'https://www.jitpack.io'
content {
includeModule 'com.github.UnifiedPush', 'android-connector'
}
}
}
def verName = "10.12.0"
2024-05-07 03:34:38 +00:00
def verCode = 1173
2021-02-18 02:32:07 +00:00
def officialVer = "10.12.0"
def officialCode = 4710
2020-07-22 03:23:05 +00:00
2020-07-08 04:00:22 +00:00
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
2020-07-22 03:23:05 +00:00
def beta = verName.contains("preview")
2020-07-08 04:00:22 +00:00
if (serviceAccountCredentialsFile.isFile()) {
2020-07-22 03:23:05 +00:00
setupPlay(beta)
2020-07-08 04:00:22 +00:00
play.serviceAccountCredentials = serviceAccountCredentialsFile
} else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) {
2020-07-22 03:23:05 +00:00
setupPlay(beta)
2020-07-08 04:00:22 +00:00
}
2020-07-22 03:23:05 +00:00
void setupPlay(boolean beta) {
2021-03-31 19:29:44 +00:00
apply plugin: "com.github.triplet.play"
2020-07-08 04:00:22 +00:00
play {
2020-07-22 03:23:05 +00:00
track = beta ? "beta" : "production"
2020-07-08 04:00:22 +00:00
defaultToAppBundles = true
}
}
2016-10-11 11:57:01 +00:00
configurations {
2021-03-31 19:29:44 +00:00
compile.exclude module: "support-v4"
2016-10-11 11:57:01 +00:00
}
2021-02-28 14:37:30 +00:00
def keystorePwd = null
def alias = null
def pwd = null
2024-05-07 01:11:53 +00:00
def sentry_token = System.getenv("SENTRY_AUTH_TOKEN")
def sentry_upload = project.rootProject.file("sentry.properties").exists()
2021-11-15 18:04:57 +00:00
def disableCMakeRelWithDebInfo = System.getenv("COMPILE_NATIVE") == null
2021-02-28 14:37:30 +00: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 19:29:44 +00:00
} else if (project.rootProject.file("local.properties").exists()) {
2021-02-28 14:37:30 +00:00
properties = new Properties()
2021-03-31 19:29:44 +00:00
properties.load(project.rootProject.file("local.properties").newDataInputStream())
2021-02-28 14:37:30 +00:00
}
if (properties != null) {
keystorePwd = properties.getProperty("KEYSTORE_PASS")
alias = properties.getProperty("ALIAS_NAME")
pwd = properties.getProperty("ALIAS_PASS")
2024-05-07 01:11:53 +00:00
sentry_token = properties.getProperty("SENTRY_AUTH_TOKEN", sentry_token)
2021-02-28 14:37:30 +00:00
}
keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS")
alias = alias ?: System.getenv("ALIAS_NAME")
pwd = pwd ?: System.getenv("ALIAS_PASS")
2021-04-13 06:49:48 +00:00
def targetTask = ""
2021-02-28 14:37:30 +00:00
if (!gradle.startParameter.taskNames.isEmpty()) {
if (gradle.startParameter.taskNames.size == 1) {
2021-04-13 06:49:48 +00:00
targetTask = gradle.startParameter.taskNames[0].toLowerCase()
2021-02-28 14:37:30 +00:00
}
}
2021-03-31 19:29:44 +00:00
def nativeTarget = System.getenv("NATIVE_TARGET")
if (nativeTarget == null) nativeTarget = ""
2013-10-25 15:19:00 +00:00
android {
2023-02-25 08:01:39 +00:00
compileSdkVersion 33
2021-02-18 02:32:07 +00:00
ndkVersion rootProject.ext.ndkVersion
2020-06-24 16:15:30 +00:00
2022-01-21 15:46:56 +00:00
defaultConfig.applicationId = "xyz.nextalone.nagram"
2017-12-08 17:35:59 +00:00
2021-02-28 07:08:33 +00:00
splits {
abi {
if (targetTask.contains("fdroid")) {
enable false
universalApk true
} else {
enable true
reset()
universalApk false
if (!nativeTarget.isBlank()) {
include nativeTarget
2022-12-02 09:18:18 +00:00
} else {
include 'armeabi-v7a', 'arm64-v8a'
2021-02-28 13:01:58 +00:00
}
2021-02-28 07:08:33 +00:00
}
}
2021-02-28 13:01:58 +00:00
2021-02-28 07:08:33 +00:00
}
2020-06-24 16:15:30 +00:00
defaultConfig {
2022-05-15 12:15:41 +00:00
minSdkVersion 21
2020-11-04 12:43:49 +00:00
//noinspection ExpiredTargetSdkVersion,OldTargetApi
targetSdkVersion 33
2015-10-29 17:10:07 +00:00
2020-06-24 16:15:30 +00:00
versionName verName
versionCode verCode
2022-07-14 11:48:57 +00:00
def appId = "11535358"
def appHash = "33d372962fadb01df47e6ceed4e33cd6"
2020-06-24 16:15:30 +00:00
//obtain your own keys at https://core.telegram.org/api/obtaining_api_id
2021-01-16 16:25:30 +00: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 16:15:30 +00:00
}
buildConfigField "String", "BUILD_VERSION_STRING", "\"" + verName + "\""
2021-03-31 19:29:44 +00: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 16:15:30 +00:00
externalNativeBuild {
cmake {
2022-05-15 12:15:41 +00:00
arguments "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-21"
2020-06-24 16:15:30 +00:00
}
}
}
bundle {
language {
enableSplit = false
}
}
2016-10-11 11:57:01 +00:00
externalNativeBuild {
2020-09-30 13:48:47 +00:00
cmake {
2021-03-31 19:29:44 +00:00
path "jni/CMakeLists.txt"
2016-10-11 11:57:01 +00:00
}
}
2020-06-24 16:15:30 +00:00
2015-01-02 22:15:07 +00:00
compileOptions {
2022-02-07 17:14:50 +00:00
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
2020-08-14 16:58:22 +00:00
coreLibraryDesugaringEnabled true
2015-01-02 22:15:07 +00:00
}
2020-06-24 16:15:30 +00:00
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
2020-06-24 16:15:30 +00:00
}
2020-12-17 17:32:45 +00:00
testOptions {
unitTests.includeAndroidResources = true
}
2013-12-20 19:25:49 +00:00
signingConfigs {
2019-06-11 05:56:33 +00:00
release {
2021-03-31 19:29:44 +00:00
storeFile project.file("release.keystore")
2020-06-24 16:15:30 +00:00
storePassword keystorePwd
keyAlias alias
keyPassword pwd
2013-12-20 19:25:49 +00:00
}
}
buildTypes {
debug {
2020-11-22 09:26:11 +00:00
isDefault true
2013-12-20 19:25:49 +00:00
debuggable true
jniDebuggable true
2020-04-24 09:21:58 +00:00
multiDexEnabled true
zipAlignEnabled true
2022-09-03 18:27:34 +00:00
signingConfig signingConfigs.release
2020-06-24 16:15:30 +00:00
}
2019-12-31 13:08:08 +00:00
2013-12-20 19:25:49 +00:00
release {
2020-09-03 15:37:42 +00:00
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
2020-11-22 02:57:43 +00:00
zipAlignEnabled true
2021-03-31 19:29:44 +00:00
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
matchingFallbacks = ["release", "debug"]
2022-09-03 18:27:34 +00:00
signingConfig signingConfigs.release
2020-06-24 16:15:30 +00:00
}
}
2020-07-08 04:00:22 +00:00
sourceSets {
2014-11-21 19:36:21 +00:00
2020-07-08 04:00:22 +00:00
main {
assets.srcDirs = ["src/main/assets"]
2020-07-08 04:00:22 +00:00
}
2020-06-24 16:15:30 +00:00
2020-07-08 04:00:22 +00:00
debug {
java {
srcDirs "src/main/java"
}
2021-02-28 02:26:20 +00:00
jniLibs {
2021-03-31 19:29:44 +00:00
srcDir "src/main/libs"
2021-02-28 02:26:20 +00:00
}
2020-07-08 04:00:22 +00:00
}
2020-06-24 16:15:30 +00:00
2020-07-08 04:00:22 +00:00
release {
2021-02-28 02:26:20 +00:00
java {
srcDirs "src/main/java"
2021-02-28 02:26:20 +00:00
}
jniLibs {
2021-03-31 19:29:44 +00:00
srcDir "src/main/libs"
2021-02-28 02:26:20 +00:00
}
2020-07-08 04:00:22 +00:00
}
}
2020-06-24 16:15:30 +00:00
flavorDimensions "version"
2019-05-14 12:08:05 +00:00
tasks.configureEach { task ->
if (((task.name.endsWith("Ndk") || task.name.startsWith("generateJsonModel") || task.name.startsWith("externalNativeBuild"))) && !task.name.contains("Debug")) {
2020-06-24 16:15:30 +00:00
task.enabled = false
}
if (task.name.contains("uploadCrashlyticsMappingFile")) {
enabled = false
}
if (disableCMakeRelWithDebInfo && task.name.contains("CMakeRelWithDebInfo")) {
2021-11-15 18:04:57 +00:00
enabled = false
}
2020-06-24 16:15:30 +00:00
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
2024-02-18 04:08:55 +00:00
String gramName = "Nagram"
String first = String.format("%s-v%s(%s)", gramName, versionName, versionCode)
String name = outputFileName.replace("TMessagesProj", first)
name = name.replace("-release", "")
outputFileName = name
2017-12-08 17:35:59 +00:00
}
2016-03-16 12:26:32 +00:00
}
2013-10-25 15:19:00 +00:00
}
2016-04-22 13:49:00 +00:00
def fcmVersion = "23.4.1"
def crashlyticsVersion = "18.6.2"
2022-08-17 09:09:53 +00:00
def playCoreVersion = "1.10.3"
2021-03-14 15:15:57 +00:00
dependencies {
2023-03-27 21:12:27 +00:00
implementation "androidx.browser:browser:1.5.0"
implementation 'androidx.fragment:fragment:1.2.0'
2023-03-27 21:12:27 +00:00
implementation "androidx.core:core-ktx:1.9.0"
2021-03-31 19:29:44 +00:00
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "androidx.exifinterface:exifinterface:1.3.7"
2021-03-14 15:15:57 +00:00
implementation "androidx.interpolator:interpolator:1.0.0"
implementation 'androidx.biometric:biometric:1.1.0'
2021-03-31 19:29:44 +00:00
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
implementation "androidx.multidex:multidex:2.0.1"
2022-11-01 09:51:10 +00:00
implementation "androidx.sharetarget:sharetarget:1.2.0"
2021-03-14 15:15:57 +00:00
2023-03-27 21:12:27 +00:00
// just follow official
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
2021-03-14 15:15:57 +00:00
2021-03-31 19:29:44 +00:00
// don"t change this :)
2021-03-14 15:15:57 +00:00
//noinspection GradleDependency
2021-08-01 18:10:40 +00:00
implementation "com.googlecode.mp4parser:isoparser:1.0.6"
2021-03-14 15:15:57 +00:00
implementation "com.google.code.gson:gson:2.10"
2021-03-31 19:29:44 +00:00
implementation "org.osmdroid:osmdroid-android:6.1.10"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.23"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0"
2021-03-14 15:15:57 +00:00
2022-11-03 12:52:16 +00:00
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.10"
implementation 'com.neovisionaries:nv-websocket-client:2.14'
2021-09-21 00:21:16 +00:00
implementation 'dnsjava:dnsjava:3.4.1'
2021-03-31 19:29:44 +00:00
implementation "org.dizitart:nitrite:3.4.3"
2021-03-14 15:15:57 +00:00
2021-09-21 00:21:16 +00:00
implementation "cn.hutool:hutool-core:5.7.13"
implementation "cn.hutool:hutool-crypto:5.7.13"
2021-07-26 18:27:01 +00:00
implementation 'cn.hutool:hutool-http:5.7.5'
2021-09-21 00:21:16 +00:00
implementation "com.jakewharton:process-phoenix:2.1.2"
2023-03-27 21:12:27 +00:00
implementation 'com.google.guava:guava:31.1-android'
2021-03-14 15:15:57 +00:00
implementation 'com.google.android.gms:play-services-mlkit-subject-segmentation:16.0.0-beta1'
implementation 'com.google.android.gms:play-services-mlkit-image-labeling:16.0.8'
2021-03-14 15:15:57 +00: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"
2024-03-09 13:24:08 +00:00
implementation 'com.google.android.gms:play-services-vision:20.1.3'
implementation 'com.google.android.gms:play-services-maps:18.2.0'
implementation 'com.google.android.gms:play-services-location:21.2.0'
implementation "com.google.firebase:firebase-messaging:$fcmVersion"
implementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion"
implementation "com.google.android.play:core:$playCoreVersion"
2021-03-14 15:15:57 +00:00
implementation 'com.android.billingclient:billing:5.1.0'
2021-03-31 19:29:44 +00:00
testImplementation "junit:junit:4.13.2"
2023-03-27 21:12:27 +00:00
testImplementation "androidx.test:core:1.5.0"
2021-07-26 19:40:08 +00:00
testImplementation "org.robolectric:robolectric:4.5.1"
2021-03-14 15:15:57 +00:00
2022-11-01 09:51:10 +00:00
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.0"
2021-03-14 15:15:57 +00:00
}
dependencies {
// add for undo and redo
implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3'
// add splash screen
implementation("androidx.core:core-splashscreen:1.0.1")
// add for music tag flac...
implementation 'org:jaudiotagger:2.0.3'
// add for auto translate
implementation 'com.google.mlkit:language-id:17.0.5'
// add for emoji
implementation 'com.jaredrummler:truetypeparser-light:1.0.0'
// add for up
implementation 'com.github.UnifiedPush:android-connector:2.3.1'
}
2021-03-14 15:15:57 +00:00
2021-03-31 19:29:44 +00:00
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
2020-06-24 16:15:30 +00:00
android {
2022-11-01 09:51:10 +00:00
packagingOptions {
jniLibs {
excludes += ['/fabric/**', '/META-INF/native-image/**']
2024-03-17 02:41:10 +00:00
useLegacyPackaging true
2022-11-01 09:51:10 +00:00
}
resources {
excludes += ['/fabric/**', '/META-INF/*.version', '/META-INF/*.kotlin_module', '/META-INF/native-image/**', '/builddef.lst', '/*.txt', '/DebugProbesKt.bin', '/okhttp3/internal/publicsuffix/NOTICE']
}
2024-02-26 01:56:14 +00:00
2024-03-09 13:24:08 +00:00
def lib = "libtmessages.*.so"
2024-03-30 06:41:15 +00:00
pickFirst "lib/armeabi-v7a/$lib"
pickFirst "lib/arm64-v8a/$lib"
2022-11-01 09:51:10 +00:00
}
namespace "org.telegram.messenger"
lint {
disable 'MissingTranslation', 'ExtraTranslation', 'BlockedPrivateApi'
}
2024-03-26 11:43:14 +00:00
buildFeatures {
buildConfig true
}
2022-11-01 09:51:10 +00:00
tasks.configureEach { task ->
2021-03-31 19:29:44 +00:00
if (task.name.startsWith("uploadCrashlyticsMappingFile")) {
2020-06-24 16:15:30 +00:00
task.enabled = false
2021-03-31 19:29:44 +00:00
} else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) {
2020-06-24 16:15:30 +00:00
task.enabled = false
2022-07-12 13:37:52 +00:00
} else if (task.name.endsWith("GoogleServices") && task.name.contains("NoGcm")) {
task.enabled = false
2020-06-24 16:15:30 +00:00
}
}
2021-12-27 03:46:36 +00:00
}
2024-05-07 01:11:53 +00:00
sentry {
// Disables or enables debug log output, e.g. for for sentry-cli.
// Default is disabled.
debug = false
// The slug of the Sentry organization to use for uploading proguard mappings/source contexts.
org = "pagermaid"
// The slug of the Sentry project to use for uploading proguard mappings/source contexts.
projectName = "nagram"
// The authentication token to use for uploading proguard mappings/source contexts.
// WARNING: Do not expose this token in your build.gradle files, but rather set an environment
// variable and read it into this property.
authToken = sentry_token
// The url of your Sentry instance. If you're using SAAS (not self hosting) you do not have to
// set this. If you are self hosting you can set your URL here
url = null
// Disables or enables the handling of Proguard mapping for Sentry.
// If enabled the plugin will generate a UUID and will take care of
// uploading the mapping to Sentry. If disabled, all the logic
// related to proguard mapping will be excluded.
// Default is enabled.
includeProguardMapping = sentry_upload
// Whether the plugin should attempt to auto-upload the mapping file to Sentry or not.
// If disabled the plugin will run a dry-run and just generate a UUID.
// The mapping file has to be uploaded manually via sentry-cli in this case.
// Default is enabled.
autoUploadProguardMapping = sentry_upload
// Experimental flag to turn on support for GuardSquare's tools integration (Dexguard and External Proguard).
// If enabled, the plugin will try to consume and upload the mapping file produced by Dexguard and External Proguard.
// Default is disabled.
dexguardEnabled = false
// Disables or enables the automatic configuration of Native Symbols
// for Sentry. This executes sentry-cli automatically so
// you don't need to do it manually.
// Default is disabled.
uploadNativeSymbols = sentry_upload
// Whether the plugin should attempt to auto-upload the native debug symbols to Sentry or not.
// If disabled the plugin will run a dry-run.
// Default is enabled.
autoUploadNativeSymbols = sentry_upload
// Does or doesn't include the source code of native code for Sentry.
// This executes sentry-cli with the --include-sources param. automatically so
// you don't need to do it manually.
// This option has an effect only when [uploadNativeSymbols] is enabled.
// Default is disabled.
includeNativeSources = false
// Generates a JVM (Java, Kotlin, etc.) source bundle and uploads your source code to Sentry.
// This enables source context, allowing you to see your source
// code as part of your stack traces in Sentry.
includeSourceContext = sentry_upload
// Configure additional directories to be included in the source bundle which is used for
// source context. The directories should be specified relative to the Gradle module/project's
// root. For example, if you have a custom source set alongside 'main', the parameter would be
// 'src/custom/java'.
additionalSourceDirsForSourceContext = []
// Enable or disable the tracing instrumentation.
// Does auto instrumentation for specified features through bytecode manipulation.
// Default is enabled.
tracingInstrumentation {
enabled = true
// Specifies a set of instrumentation features that are eligible for bytecode manipulation.
// Defaults to all available values of InstrumentationFeature enum class.
features = [InstrumentationFeature.DATABASE, InstrumentationFeature.FILE_IO, InstrumentationFeature.OKHTTP, InstrumentationFeature.COMPOSE]
// Enable or disable logcat instrumentation through bytecode manipulation.
// Default is enabled.
logcat {
enabled = true
// Specifies a minimum log level for the logcat breadcrumb logging.
// Defaults to LogcatLevel.WARNING.
minLevel = LogcatLevel.WARNING
}
// The set of glob patterns to exclude from instrumentation. Classes matching any of these
// patterns in the project's sources and dependencies JARs won't be instrumented by the Sentry
// Gradle plugin.
//
// Don't include the file extension. Filtering is done on compiled classes and
// the .class suffix isn't included in the pattern matching.
//
// Example usage:
// ```
// excludes = ['com/example/donotinstrument/**', '**/*Test']
// ```
//
// Only supported when using Android Gradle plugin (AGP) version 7.4.0 and above.
excludes = []
}
// Enable auto-installation of Sentry components (sentry-android SDK and okhttp, timber and fragment integrations).
// Default is enabled.
// Only available v3.1.0 and above.
autoInstallation {
enabled = true
// Specifies a version of the sentry-android SDK and fragment, timber and okhttp integrations.
//
// This is also useful, when you have the sentry-android SDK already included into a transitive dependency/module and want to
// align integration versions with it (if it's a direct dependency, the version will be inferred).
//
// NOTE: if you have a higher version of the sentry-android SDK or integrations on the classpath, this setting will have no effect
// as Gradle will resolve it to the latest version.
//
// Defaults to the latest published Sentry version.
sentryVersion = '7.8.0'
}
// Disables or enables dependencies metadata reporting for Sentry.
// If enabled, the plugin will collect external dependencies and
// upload them to Sentry as part of events. If disabled, all the logic
// related to the dependencies metadata report will be excluded.
//
// Default is enabled.
includeDependenciesReport = true
// Whether the plugin should send telemetry data to Sentry.
// If disabled the plugin won't send telemetry data.
// This is auto disabled if running against a self hosted instance of Sentry.
// Default is enabled.
telemetry = true
}