| 7 |
| def verCode = 1106 |
| 8 |
| 9 | if (System.getenv("DEBUG_BUILD") == "true") { |
| 10 | verName += "-" + RuntimeUtil.execForStr("git log --pretty=format:%h -n 1").trim() |
| 11 | } |
| 12 |
| 13 | def officialVer = "8.8.5" |
| 14 | def officialCode = 2721 |
| 15 |
| 16 | configurations { |
| 17 | compile.exclude module: "support-v4" |
| 18 | } |
| 19 |
| 20 | def keystorePwd = null |
| 21 | def alias = null |
| 22 | def pwd = null |
| 23 | def disableCMakeRelWithDebInfo = System.getenv("COMPILE_NATIVE") == null |
| 24 |
| 25 | Properties properties |
| 26 | def base64 = System.getenv("LOCAL_PROPERTIES") |
| 27 | if (base64 != null && !base64.isBlank()) { |
| 28 | properties = new Properties() |
| 29 | properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64))) |
| 30 | } else if (project.rootProject.file("local.properties").exists()) { |
| 31 | properties = new Properties() |
| 32 | properties.load(project.rootProject.file("local.properties").newDataInputStream()) |
| 33 | } |
| 34 |
| 35 | if (properties != null) { |
| 36 | keystorePwd = properties.getProperty("KEYSTORE_PASS") |
| 37 | alias = properties.getProperty("ALIAS_NAME") |
| 38 | pwd = properties.getProperty("ALIAS_PASS") |
| 39 | } |
| 40 |
| 41 | keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS") |
| 42 | alias = alias ?: System.getenv("ALIAS_NAME") |
| 43 | pwd = pwd ?: System.getenv("ALIAS_PASS") |
| 44 |
| 45 | def targetTask = "" |
| 46 | if (!gradle.startParameter.taskNames.isEmpty()) { |
| 47 | if (gradle.startParameter.taskNames.size == 1) { |
| 48 | targetTask = gradle.startParameter.taskNames[0].toLowerCase() |
| 49 | } |
| 50 | } |
| 51 |
| 52 | def nativeTarget = System.getenv("NATIVE_TARGET") |
| 53 | if (nativeTarget == null) nativeTarget = "" |
| 54 |
| 55 | android { |
| 56 | compileSdkVersion 32 |
| 57 | buildToolsVersion "32.0.0" |
| 58 | ndkVersion rootProject.ext.ndkVersion |
| 59 |
| 60 | defaultConfig.applicationId = "xyz.nextalone.nagram" |
| 61 |
| 62 | splits { |
| 63 |
| 64 | abi { |
| 65 | if (targetTask.contains("fdroid")) { |
| 66 | enable false |
| 67 | universalApk true |
| 68 | } else { |
| 69 | if (System.getenv("DEBUG_BUILD") == "true") { |
| 70 | enable false |
| 71 | universalApk true |
| 72 | } else { |
| 73 | enable true |
| 74 | universalApk false |
| 75 | } |
| 76 | if (!nativeTarget.isBlank()) { |
| 77 | reset() |
| 78 | include nativeTarget |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 |
| 83 | } |
| 84 |
| 85 | defaultConfig { |
| 86 | minSdkVersion 21 |
| 87 | //noinspection ExpiredTargetSdkVersion,OldTargetApi |
| 88 | targetSdkVersion 30 |
| 89 |
| 90 | versionName verName |
| 91 | versionCode verCode |
| 92 |
| 93 | def appId = "1391584" |
| 94 | def appHash = "355c91550b0d658cfb7ff89dcf91a08c" |
| 95 |
| 96 | //obtain your own keys at https://core.telegram.org/api/obtaining_api_id |
| 97 |
| 98 | if (properties != null) { |
| 99 | appId = properties.getProperty("TELEGRAM_APP_ID") ?: System.getenv("TELEGRAM_APP_ID") ?: appId |
| 100 | appHash = properties.getProperty("TELEGRAM_APP_HASH") ?: System.getenv("TELEGRAM_APP_HASH") ?: appHash |
| 101 | } |
| 102 |
| 103 |
| 104 | buildConfigField "String", "OFFICIAL_VERSION", "\"" + officialVer + "\"" |
| 105 | buildConfigField "int", "OFFICIAL_VERSION_CODE", officialCode + "" |
| 106 | buildConfigField "int", "APP_ID", appId |
| 107 | buildConfigField "String", "APP_HASH", "\"" + appHash + "\"" |
| 108 |
| 109 | externalNativeBuild { |
| 110 | cmake { |
| 111 | arguments "-DANDROID_STL=c++_static", "-DANDROID_PLATFORM=android-21" |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 |
| 116 | bundle { |
| 117 | language { |
| 118 | enableSplit = false |
| 119 | } |
| 120 | } |
| 121 |
| 122 | externalNativeBuild { |
| 123 | cmake { |
| 124 | path "jni/CMakeLists.txt" |
| 125 | } |
| 126 | } |
| 127 |
| 128 | lintOptions { |
| 129 | disable "MissingTranslation" |
| 130 | disable "ExtraTranslation" |
| 131 | disable "BlockedPrivateApi" |
| 132 | } |
| 133 |
| 134 | packagingOptions { |
| 135 |
| 136 | exclude "/fabric/**" |
| 137 | exclude "/META-INF/*.version" |
| 138 | exclude "/META-INF/*.kotlin_module" |
| 139 | exclude "/META-INF/native-image/**" |
| 140 | exclude "/builddef.lst" |
| 141 | exclude "/*.txt" |
| 142 | exclude "/DebugProbesKt.bin" |
| 143 | exclude "/okhttp3/internal/publicsuffix/NOTICE" |
| 144 |
| 145 | } |
| 146 |
| 147 | compileOptions { |
| 148 | sourceCompatibility JavaVersion.VERSION_11 |
| 149 | targetCompatibility JavaVersion.VERSION_11 |
| 150 |
| 151 | coreLibraryDesugaringEnabled true |
| 152 | } |
| 153 |
| 154 | kotlinOptions { |
| 155 | jvmTarget = JavaVersion.VERSION_11 |
| 156 | } |
| 157 |
| 158 | testOptions { |
| 159 | unitTests.includeAndroidResources = true |
| 160 | } |
| 161 |
| 162 | signingConfigs { |
| 163 | release { |
| 164 | storeFile project.file("release.keystore") |
| 165 | storePassword keystorePwd |
| 166 | keyAlias alias |
| 167 | keyPassword pwd |
| 168 | } |
| 169 | } |
| 170 |
| 171 | buildTypes { |
| 172 | debug { |
| 173 | isDefault true |
| 174 | debuggable true |
| 175 | jniDebuggable true |
| 176 | multiDexEnabled true |
| 177 | zipAlignEnabled true; |
| 178 | signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release |
| 179 | ndk.debugSymbolLevel = "FULL" |
| 180 | } |
| 181 |
| 182 | releaseNoGcm { |
| 183 | debuggable false |
| 184 | jniDebuggable false |
| 185 | minifyEnabled true |
| 186 | shrinkResources true |
| 187 | multiDexEnabled true |
| 188 | zipAlignEnabled true |
| 189 | proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" |
| 190 | matchingFallbacks = ["release", "debug"] |
| 191 | signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release |
| 192 | } |
| 193 |
| 194 | release { |
| 195 | debuggable false |
| 196 | jniDebuggable false |
| 197 | minifyEnabled true |
| 198 | shrinkResources true |
| 199 | multiDexEnabled true |
| 200 | zipAlignEnabled true |
| 201 | proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" |
| 202 | matchingFallbacks = ["release", "debug"] |
| 203 | signingConfig keystorePwd == null ? signingConfigs.debug : signingConfigs.release |
| 204 | } |
| 205 |
| 206 | foss { |
| 207 | debuggable false |
| 208 | jniDebuggable false |
| 209 | minifyEnabled true |
| 210 | shrinkResources true |
| 211 | multiDexEnabled true |
| 212 | zipAlignEnabled true |
| 213 | proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" |
| 214 | matchingFallbacks = ["release", "debug"] |
| 215 | } |
| 216 |
| 217 | fdroidRelease { |
| 218 | initWith foss |
| 219 | matchingFallbacks = ["release", "debug"] |
| 220 | } |
| 221 | } |
| 222 |
| 223 | sourceSets { |
| 224 |
| 225 | main { |
| 226 | jni.srcDirs = [] |
| 227 | assets.srcDirs = ["src/main/assets", "src/emojis/twitter"] |
| 228 | } |
| 229 |
| 230 | debug { |
| 231 | java { |
| 232 | srcDirs "src/main/java", "src/gservcies/java" |
| 233 | } |
| 234 | jni.srcDirs = ["./jni/"] |
| 235 | manifest { |
| 236 | srcFile "src/gservcies/AndroidManifest.xml" |
| 237 | } |
| 238 | } |
| 239 |
| 240 | releaseNoGcm { |
| 241 | jni.srcDirs = [] |
| 242 | jniLibs { |
| 243 | srcDir "src/main/libs" |
| 244 | } |
| 245 | } |
| 246 |
| 247 | release { |
| 248 | java { |
| 249 | srcDirs "src/main/java", "src/gservcies/java" |
| 250 | } |
| 251 | jni.srcDirs = [] |
| 252 | jniLibs { |
| 253 | srcDir "src/main/libs" |
| 254 | } |
| 255 | manifest { |
| 256 | srcFile "src/gservcies/AndroidManifest.xml" |
| 257 | } |
| 258 | } |
| 259 |
| 260 | foss { |
| 261 | jni { |
| 262 | srcDirs = ["./jni/"] |
| 263 | } |
| 264 | } |
| 265 |
| 266 | fdroidRelease { |
| 267 | jni { |
| 268 | srcDirs = ["./jni/"] |
| 269 | } |
| 270 | jniLibs.srcDirs = [] |
| 271 | } |
| 272 |
| 273 | } |
| 274 |
| 275 | flavorDimensions "version" |
| 276 |
| 277 | productFlavors { |
| 278 | mini { |
| 279 | isDefault true |
| 280 | manifestPlaceholders = [is_full_version: "false"] |
| 281 | } |
| 282 | full { |
| 283 | manifestPlaceholders = [is_full_version: "true"] |
| 284 | } |
| 285 | } |
| 286 |
| 287 | sourceSets.all { set -> |
| 288 | if (set.name.startsWith("full")) { |
| 289 | set.dependencies { |
| 290 | implementation fileTree("libs") |
| 291 | } |
| 292 | } |
| 293 | } |
| 294 |
| 295 | tasks.all { task -> |
| 296 | 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"))) { |
| 297 | task.enabled = false |
| 298 | } |
| 299 | if (task.name.contains("uploadCrashlyticsMappingFile")) { |
| 300 | enabled = false |
| 301 | } |
| 302 | if (disableCMakeRelWithDebInfo && task.name.contains("CMakeRelWithDebInfo") && !targetTask.contains("fdroid")) { |
| 303 | enabled = false |
| 304 | } |
| 305 | } |
| 306 |
| 307 | applicationVariants.all { variant -> |
| 308 | variant.outputs.all { output -> |
| 309 | outputFileName = outputFileName.replace("TMessagesProj", "Nagram-v" + versionName + "(" + versionCode + ")").replace("-release", "") |
| 310 | } |
| 311 | } |
| 312 |
| 313 | } |
| 314 |
| 315 | def okHttpVersion = "5.0.0-alpha.9" |
| 316 | def fcmVersion = "21.1.0" |
| 317 | def crashlyticsVersion = "18.2.0" |
| 318 | def playCoreVersion = "1.10.1" |
| 319 |
| 320 | dependencies { |
| 321 |
| 322 | implementation "androidx.browser:browser:1.4.0" |
| 323 | implementation "androidx.core:core-ktx:1.8.0" |
| 324 | implementation "androidx.palette:palette-ktx:1.0.0" |
| 325 | implementation "androidx.viewpager:viewpager:1.0.0" |
| 326 | implementation "androidx.exifinterface:exifinterface:1.3.3" |
| 327 | implementation "androidx.interpolator:interpolator:1.0.0" |
| 328 | implementation "androidx.dynamicanimation:dynamicanimation:1.0.0" |
| 329 | implementation "androidx.multidex:multidex:2.0.1" |
| 330 | implementation "androidx.sharetarget:sharetarget:1.1.0" |
| 331 |
| 332 | compileOnly "org.checkerframework:checker-qual:3.16.0" |
| 333 | compileOnly "org.checkerframework:checker-compat-qual:2.5.5" |
| 334 |
| 335 | // don"t change this :) |
| 336 | //noinspection GradleDependency |
| 337 | implementation "com.googlecode.mp4parser:isoparser:1.0.6" |
| 338 |
| 339 | implementation "com.google.code.gson:gson:2.8.8" |
| 340 | implementation "org.osmdroid:osmdroid-android:6.1.10" |
| 341 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.20" |
| 342 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2" |
| 343 |
| 344 | implementation "com.squareup.okhttp3:okhttp:$okHttpVersion" |
| 345 | implementation 'dnsjava:dnsjava:3.4.1' |
| 346 | implementation "org.dizitart:nitrite:3.4.3" |
| 347 |
| 348 | implementation "cn.hutool:hutool-core:5.7.13" |
| 349 | implementation "cn.hutool:hutool-crypto:5.7.13" |
| 350 | implementation 'cn.hutool:hutool-http:5.7.5' |
| 351 | implementation "com.jakewharton:process-phoenix:2.1.2" |
| 352 |
| 353 | compileOnly 'org.yaml:snakeyaml:1.29' |
| 354 | fullImplementation 'org.yaml:snakeyaml:1.29' |
| 355 |
| 356 | implementation project(":openpgp-api") |
| 357 |
| 358 | compileOnly fileTree("libs") |
| 359 |
| 360 | compileOnly "com.google.firebase:firebase-messaging:$fcmVersion" |
| 361 | compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 362 | compileOnly "com.google.android.play:core:$playCoreVersion" |
| 363 |
| 364 | debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion" |
| 365 | debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 366 | debugImplementation "com.google.android.play:core:$playCoreVersion" |
| 367 | releaseImplementation "com.google.firebase:firebase-messaging:$fcmVersion" |
| 368 | releaseImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 369 | releaseImplementation "com.google.android.play:core:$playCoreVersion" |
| 370 |
| 371 | testImplementation "junit:junit:4.13.2" |
| 372 | testImplementation "androidx.test:core:1.4.0" |
| 373 | testImplementation "org.robolectric:robolectric:4.5.1" |
| 374 |
| 375 | coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5" |
| 376 |
| 377 | } |
| 378 | dependencies { |
| 379 | // add for undo and redo |
| 380 | implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3' |
| 381 | // add splash screen |
| 382 | implementation("androidx.core:core-splashscreen:1.0.0-beta02") |
| 383 | } |
| 384 |
| 385 | apply plugin: "com.google.gms.google-services" |
| 386 | apply plugin: "com.google.firebase.crashlytics" |
| 387 |
| 388 | android { |
| 389 |
| 390 | tasks.all { task -> |
| 391 | if (task.name.startsWith("uploadCrashlyticsMappingFile")) { |
| 392 | task.enabled = false |
| 393 | } else if (task.name.contains("Crashlytics") && task.name.contains("NoGcm")) { |
| 394 | task.enabled = false |
| 395 | } |
| 396 | } |
| 397 |
| 398 | } |
| 399 |