-
Notifications
You must be signed in to change notification settings - Fork 71
/
build.gradle
368 lines (298 loc) · 11.1 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
apply plugin: "com.android.application"
apply plugin: "kotlin-android"
repositories {
maven {
url 'https://www.jitpack.io'
content {
includeModule 'com.github.UnifiedPush', 'android-connector'
}
}
}
def verName = "10.12.0"
def verCode = 1172
def officialVer = "10.12.0"
def officialCode = 4710
def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json")
def beta = verName.contains("preview")
if (serviceAccountCredentialsFile.isFile()) {
setupPlay(beta)
play.serviceAccountCredentials = serviceAccountCredentialsFile
} else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) {
setupPlay(beta)
}
void setupPlay(boolean beta) {
apply plugin: "com.github.triplet.play"
play {
track = beta ? "beta" : "production"
defaultToAppBundles = true
}
}
configurations {
compile.exclude module: "support-v4"
}
def keystorePwd = null
def alias = null
def pwd = null
def disableCMakeRelWithDebInfo = System.getenv("COMPILE_NATIVE") == null
Properties properties
def base64 = System.getenv("LOCAL_PROPERTIES")
if (base64 != null && !base64.isBlank()) {
properties = new Properties()
properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64)))
} else if (project.rootProject.file("local.properties").exists()) {
properties = new Properties()
properties.load(project.rootProject.file("local.properties").newDataInputStream())
}
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")
def targetTask = ""
if (!gradle.startParameter.taskNames.isEmpty()) {
if (gradle.startParameter.taskNames.size == 1) {
targetTask = gradle.startParameter.taskNames[0].toLowerCase()
}
}
def nativeTarget = System.getenv("NATIVE_TARGET")
if (nativeTarget == null) nativeTarget = ""
android {
compileSdkVersion 33
ndkVersion rootProject.ext.ndkVersion
defaultConfig.applicationId = "xyz.nextalone.nagram"
splits {
abi {
if (targetTask.contains("fdroid")) {
enable false
universalApk true
} else {
enable true
reset()
universalApk false
if (!nativeTarget.isBlank()) {
include nativeTarget
} else {
include 'armeabi-v7a', 'arm64-v8a'
}
}
}
}
defaultConfig {
minSdkVersion 21
//noinspection ExpiredTargetSdkVersion,OldTargetApi
targetSdkVersion 33
versionName verName
versionCode verCode
def appId = "11535358"
def appHash = "33d372962fadb01df47e6ceed4e33cd6"
//obtain your own keys at https://core.telegram.org/api/obtaining_api_id
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
}
buildConfigField "String", "BUILD_VERSION_STRING", "\"" + verName + "\""
buildConfigField "String", "OFFICIAL_VERSION", "\"" + officialVer + "\""
buildConfigField "int", "OFFICIAL_VERSION_CODE", officialCode + ""
buildConfigField "int", "APP_ID", appId
buildConfigField "String", "APP_HASH", "\"" + appHash + "\""
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-21"
}
}
}
bundle {
language {
enableSplit = false
}
}
externalNativeBuild {
cmake {
path "jni/CMakeLists.txt"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
coreLibraryDesugaringEnabled true
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
testOptions {
unitTests.includeAndroidResources = true
}
signingConfigs {
release {
storeFile project.file("release.keystore")
storePassword keystorePwd
keyAlias alias
keyPassword pwd
}
}
buildTypes {
debug {
isDefault true
debuggable true
jniDebuggable true
multiDexEnabled true
zipAlignEnabled true
signingConfig signingConfigs.release
}
release {
debuggable false
jniDebuggable false
minifyEnabled true
shrinkResources true
multiDexEnabled true
zipAlignEnabled true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
matchingFallbacks = ["release", "debug"]
signingConfig signingConfigs.release
}
}
sourceSets {
main {
assets.srcDirs = ["src/main/assets"]
}
debug {
java {
srcDirs "src/main/java"
}
jniLibs {
srcDir "src/main/libs"
}
}
release {
java {
srcDirs "src/main/java"
}
jniLibs {
srcDir "src/main/libs"
}
}
}
flavorDimensions "version"
tasks.configureEach { task ->
if (((task.name.endsWith("Ndk") || task.name.startsWith("generateJsonModel") || task.name.startsWith("externalNativeBuild"))) && !task.name.contains("Debug")) {
task.enabled = false
}
if (task.name.contains("uploadCrashlyticsMappingFile")) {
enabled = false
}
if (disableCMakeRelWithDebInfo && task.name.contains("CMakeRelWithDebInfo")) {
enabled = false
}
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
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
}
}
}
def fcmVersion = "23.4.1"
def crashlyticsVersion = "18.6.2"
def playCoreVersion = "1.10.3"
dependencies {
implementation "androidx.browser:browser:1.5.0"
implementation 'androidx.fragment:fragment:1.2.0'
implementation "androidx.core:core-ktx:1.9.0"
implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.viewpager:viewpager:1.0.0"
implementation "androidx.exifinterface:exifinterface:1.3.7"
implementation "androidx.interpolator:interpolator:1.0.0"
implementation 'androidx.biometric:biometric:1.1.0'
implementation "androidx.dynamicanimation:dynamicanimation:1.0.0"
implementation "androidx.multidex:multidex:2.0.1"
implementation "androidx.sharetarget:sharetarget:1.2.0"
// just follow official
compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
// don"t change this :)
//noinspection GradleDependency
implementation "com.googlecode.mp4parser:isoparser:1.0.6"
implementation "com.google.code.gson:gson:2.10"
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"
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.10"
implementation 'com.neovisionaries:nv-websocket-client:2.14'
implementation 'dnsjava:dnsjava:3.4.1'
implementation "org.dizitart:nitrite:3.4.3"
implementation "cn.hutool:hutool-core:5.7.13"
implementation "cn.hutool:hutool-crypto:5.7.13"
implementation 'cn.hutool:hutool-http:5.7.5'
implementation "com.jakewharton:process-phoenix:2.1.2"
implementation 'com.google.guava:guava:31.1-android'
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'
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"
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"
implementation 'com.android.billingclient:billing:5.1.0'
testImplementation "junit:junit:4.13.2"
testImplementation "androidx.test:core:1.5.0"
testImplementation "org.robolectric:robolectric:4.5.1"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.2.0"
}
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'
}
apply plugin: "com.google.gms.google-services"
apply plugin: "com.google.firebase.crashlytics"
android {
packagingOptions {
jniLibs {
excludes += ['/fabric/**', '/META-INF/native-image/**']
useLegacyPackaging true
}
resources {
excludes += ['/fabric/**', '/META-INF/*.version', '/META-INF/*.kotlin_module', '/META-INF/native-image/**', '/builddef.lst', '/*.txt', '/DebugProbesKt.bin', '/okhttp3/internal/publicsuffix/NOTICE']
}
def lib = "libtmessages.*.so"
pickFirst "lib/armeabi-v7a/$lib"
pickFirst "lib/arm64-v8a/$lib"
}
namespace "org.telegram.messenger"
lint {
disable 'MissingTranslation', 'ExtraTranslation', 'BlockedPrivateApi'
}
buildFeatures {
buildConfig true
}
tasks.configureEach { task ->
if (task.name.startsWith("uploadCrashlyticsMappingFile")) {
task.enabled = false
} else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) {
task.enabled = false
} else if (task.name.endsWith("GoogleServices") && task.name.contains("NoGcm")) {
task.enabled = false
}
}
}