| 7 |
| def serviceAccountCredentialsFile = rootProject.file("service_account_credentials.json") |
| 8 |
| 9 | def beta = verName.contains("preview") |
| 10 |
| 11 | if (serviceAccountCredentialsFile.isFile()) { |
| 12 |
| 13 | setupPlay(beta) |
| 14 |
| 15 | play.serviceAccountCredentials = serviceAccountCredentialsFile |
| 16 |
| 17 | } else if (System.getenv().containsKey("ANDROID_PUBLISHER_CREDENTIALS")) { |
| 18 |
| 19 | setupPlay(beta) |
| 20 |
| 21 | } |
| 22 |
| 23 | void setupPlay(boolean beta) { |
| 24 |
| 25 | apply plugin: 'com.github.triplet.play' |
| 26 |
| 27 | play { |
| 28 |
| 29 | track = beta ? "beta" : "production" |
| 30 | defaultToAppBundles = true |
| 31 |
| 32 | } |
| 33 |
| 34 | } |
| 35 |
| 36 | configurations { |
| 37 | compile.exclude module: 'support-v4' |
| 38 | } |
| 39 |
| 40 | def okHttpVersion = '4.9.0' |
| 41 | def fcmVersion = '21.0.1' |
| 42 | def crashlyticsVersion = '17.3.0' |
| 43 | def playCoreVersion = '1.9.0' |
| 44 |
| 45 | repositories { |
| 46 |
| 47 | jcenter() |
| 48 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" } |
| 49 |
| 50 | } |
| 51 |
| 52 | dependencies { |
| 53 |
| 54 | implementation 'androidx.core:core-ktx:1.5.0-alpha05' |
| 55 | implementation 'androidx.palette:palette-ktx:1.0.0' |
| 56 | implementation 'androidx.viewpager:viewpager:1.0.0' |
| 57 | implementation 'androidx.exifinterface:exifinterface:1.3.2' |
| 58 | implementation "androidx.interpolator:interpolator:1.0.0" |
| 59 | implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0' |
| 60 | implementation 'androidx.multidex:multidex:2.0.1' |
| 61 | implementation "androidx.sharetarget:sharetarget:1.0.0" |
| 62 |
| 63 | // replace zxing with latest |
| 64 | // TODO: fix problem with android L |
| 65 | implementation 'com.google.zxing:core:3.4.1' |
| 66 |
| 67 | compileOnly 'org.checkerframework:checker-qual:3.8.0' |
| 68 | compileOnly 'org.checkerframework:checker-compat-qual:2.5.5' |
| 69 |
| 70 | // don't change this :) |
| 71 | //noinspection GradleDependency |
| 72 | implementation 'com.googlecode.mp4parser:isoparser:1.0.6' |
| 73 |
| 74 | implementation 'com.google.code.gson:gson:2.8.6' |
| 75 | implementation 'org.osmdroid:osmdroid-android:6.1.8' |
| 76 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.21' |
| 77 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' |
| 78 |
| 79 | implementation "com.squareup.okhttp3:okhttp:$okHttpVersion" |
| 80 | implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:$okHttpVersion" |
| 81 | implementation 'dnsjava:dnsjava:3.3.1' |
| 82 |
| 83 | implementation(platform("org.dizitart:nitrite-bom:4.0.0-SNAPSHOT")) |
| 84 | implementation 'org.dizitart:nitrite' |
| 85 | implementation 'org.dizitart:nitrite-mvstore-adapter' |
| 86 |
| 87 | implementation ('cn.hutool:hutool-crypto:5.5.4') { |
| 88 | exclude group: "org.apache.poi" |
| 89 | } |
| 90 | implementation 'com.jakewharton:process-phoenix:2.0.0' |
| 91 |
| 92 | implementation project(":openpgp-api") |
| 93 |
| 94 | compileOnly files('libs/libv2ray.aar') |
| 95 | compileOnly "com.google.firebase:firebase-messaging:$fcmVersion" |
| 96 | compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 97 | compileOnly "com.google.android.play:core:$playCoreVersion" |
| 98 |
| 99 | debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion" |
| 100 | debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 101 | debugImplementation "com.google.android.play:core:$playCoreVersion" |
| 102 | releaseImplementation "com.google.firebase:firebase-messaging:$fcmVersion" |
| 103 | releaseImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 104 | releaseImplementation "com.google.android.play:core:$playCoreVersion" |
| 105 |
| 106 | testImplementation 'junit:junit:4.13.1' |
| 107 | testImplementation 'androidx.test:core:1.3.0' |
| 108 | testImplementation "org.robolectric:robolectric:4.4" |
| 109 |
| 110 | coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1' |
| 111 |
| 112 | } |
| 113 |
| 114 | android { |
| 115 | compileSdkVersion 30 |
| 116 | buildToolsVersion '30.0.3' |
| 117 | ndkVersion rootProject.ext.ndkVersion |
| 118 |
| 119 | defaultConfig.applicationId = "nekox.messenger" |
| 120 |
| 121 | defaultConfig { |
| 122 | minSdkVersion 16 |
| 123 | //noinspection ExpiredTargetSdkVersion,OldTargetApi |
| 124 | targetSdkVersion 29 |
| 125 |
| 126 | versionName verName |
| 127 | versionCode verCode |
| 128 |
| 129 | def appId = null |
| 130 | def appHash = null |
| 131 |
| 132 | //obtain your own keys at https://core.telegram.org/api/obtaining_api_id |
| 133 |
| 134 | if (project.rootProject.file('local.properties').exists()) { |
| 135 | Properties properties = new Properties() |
| 136 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) |
| 137 | appId = properties.getProperty("TELEGRAM_APP_ID") ?: System.getenv("TELEGRAM_APP_ID") |
| 138 | appHash = properties.getProperty("TELEGRAM_APP_HASH") ?: System.getenv("TELEGRAM_APP_HASH") |
| 139 | } |
| 140 |
| 141 | buildConfigField 'int', 'APP_ID', appId != null ? appId : "1391584" |
| 142 | buildConfigField 'String', 'APP_HASH', "\"" + (appHash != null ? appHash : "355c91550b0d658cfb7ff89dcf91a08c") + "\"" |
| 143 |
| 144 | externalNativeBuild { |
| 145 | cmake { |
| 146 | version '3.10.2' |
| 147 | arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-16', "-j=16" |
| 148 | } |
| 149 | } |
| 150 |
| 151 | } |
| 152 |
| 153 | bundle { |
| 154 | language { |
| 155 | enableSplit = false |
| 156 | } |
| 157 | } |
| 158 |
| 159 | externalNativeBuild { |
| 160 | cmake { |
| 161 | path 'jni/CMakeLists.txt' |
| 162 | } |
| 163 | } |
| 164 |
| 165 | lintOptions { |
| 166 | disable 'MissingTranslation' |
| 167 | disable 'ExtraTranslation' |
| 168 | disable 'BlockedPrivateApi' |
| 169 | } |
| 170 |
| 171 | packagingOptions { |
| 172 |
| 173 | exclude '/fabric/**' |
| 174 | exclude '/META-INF/*.version' |
| 175 | exclude '/META-INF/*.kotlin_module' |
| 176 | exclude '/builddef.lst' |
| 177 | exclude '/*.txt' |
| 178 |
| 179 | } |
| 180 |
| 181 | dexOptions { |
| 182 | jumboMode = true |
| 183 | } |
| 184 |
| 185 | compileOptions { |
| 186 | sourceCompatibility JavaVersion.VERSION_1_8 |
| 187 | targetCompatibility JavaVersion.VERSION_1_8 |
| 188 |
| 189 | coreLibraryDesugaringEnabled true |
| 190 | } |
| 191 |
| 192 | kotlinOptions { |
| 193 | jvmTarget = JavaVersion.VERSION_1_8.toString() |
| 194 | } |
| 195 |
| 196 | testOptions { |
| 197 | unitTests.includeAndroidResources = true |
| 198 | } |
| 199 |
| 200 | signingConfigs { |
| 201 | def keystorePwd = null |
| 202 | def alias = null |
| 203 | def pwd = null |
| 204 | Properties properties |
| 205 |
| 206 | if (project.rootProject.file('local.properties').exists()) { |
| 207 | properties = new Properties() |
| 208 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) |
| 209 | } else { |
| 210 | def base64 = System.getenv("LOCAL_PROPERTIES") |
| 211 | if (base64 != null && !base64.isBlank()) { |
| 212 | properties = new Properties() |
| 213 | properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64))) |
| 214 | } |
| 215 | } |
| 216 |
| 217 | if (properties != null) { |
| 218 | keystorePwd = properties.getProperty("KEYSTORE_PASS") |
| 219 | alias = properties.getProperty("ALIAS_NAME") |
| 220 | pwd = properties.getProperty("ALIAS_PASS") |
| 221 | } |
| 222 |
| 223 | keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS") |
| 224 | alias = alias ?: System.getenv("ALIAS_NAME") |
| 225 | pwd = pwd ?: System.getenv("ALIAS_PASS") |
| 226 |
| 227 | release { |
| 228 |
| 229 | storeFile project.file('release.keystore') |
| 230 | storePassword keystorePwd |
| 231 | keyAlias alias |
| 232 | keyPassword pwd |
| 233 | } |
| 234 |
| 235 | } |
| 236 |
| 237 | buildTypes { |
| 238 | debug { |
| 239 | isDefault true |
| 240 | debuggable true |
| 241 | jniDebuggable false |
| 242 | multiDexEnabled true |
| 243 | zipAlignEnabled true |
| 244 | signingConfig signingConfigs.release |
| 245 | } |
| 246 |
| 247 | releaseNoGcm { |
| 248 | debuggable false |
| 249 | jniDebuggable false |
| 250 | minifyEnabled true |
| 251 | shrinkResources true |
| 252 | multiDexEnabled true |
| 253 | zipAlignEnabled true |
| 254 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 255 | matchingFallbacks = ['debug'] |
| 256 | signingConfig signingConfigs.release |
| 257 | } |
| 258 |
| 259 | release { |
| 260 | debuggable false |
| 261 | jniDebuggable false |
| 262 | minifyEnabled true |
| 263 | shrinkResources true |
| 264 | multiDexEnabled true |
| 265 | zipAlignEnabled true |
| 266 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 267 | matchingFallbacks = ['debug'] |
| 268 | signingConfig signingConfigs.release |
| 269 | } |
| 270 |
| 271 | foss { |
| 272 | debuggable false |
| 273 | jniDebuggable false |
| 274 | minifyEnabled true |
| 275 | shrinkResources true |
| 276 | multiDexEnabled true |
| 277 | zipAlignEnabled true |
| 278 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 279 | matchingFallbacks = ['debug'] |
| 280 | } |
| 281 | } |
| 282 |
| 283 | sourceSets { |
| 284 |
| 285 | main { |
| 286 | jni.srcDirs = [] |
| 287 | } |
| 288 |
| 289 | debug { |
| 290 | jniLibs.srcDir 'src/main/libs' |
| 291 | manifest.srcFile 'src/gservcies/AndroidManifest.xml' |
| 292 | } |
| 293 |
| 294 | releaseNoGcm { |
| 295 | jniLibs.srcDir 'src/main/libs' |
| 296 | } |
| 297 |
| 298 | release { |
| 299 | jniLibs.srcDir 'src/main/libs' |
| 300 | manifest.srcFile 'src/gservcies/AndroidManifest.xml' |
| 301 | } |
| 302 |
| 303 | foss { |
| 304 | jni.srcDirs = ['./jni/'] |
| 305 | } |
| 306 |
| 307 | } |
| 308 |
| 309 | splits.abi { |
| 310 |
| 311 | enable true |
| 312 | universalApk false |
| 313 |
| 314 | } |
| 315 |
| 316 | flavorDimensions "version" |
| 317 |
| 318 | productFlavors { |
| 319 | mini { |
| 320 | versionNameSuffix '-mini' |
| 321 | } |
| 322 | miniNoEmoji { |
| 323 | versionNameSuffix '-mini-no-emoji' |
| 324 | } |
| 325 | miniAppleEmoji { |
| 326 | versionNameSuffix '-mini-apple-emoji' |
| 327 | } |
| 328 | miniTwitterEmoji { |
| 329 | versionNameSuffix '-mini-twitter-emoji' |
| 330 | } |
| 331 | full { |
| 332 | isDefault true |
| 333 | } |
| 334 | fullPlay { |
| 335 | versionNameSuffix '-play' |
| 336 | versionCode verCode - 1 |
| 337 | } |
| 338 | fullNoEmoji { |
| 339 | versionNameSuffix '-full-no-emoji' |
| 340 | } |
| 341 | fullAppleEmoji { |
| 342 | versionNameSuffix '-full-apple-emoji' |
| 343 | } |
| 344 | fullTwitterEmoji { |
| 345 | versionNameSuffix '-full-twitter-emoji' |
| 346 | } |
| 347 | } |
| 348 |
| 349 | sourceSets.all { set -> |
| 350 | if (set.name.startsWith("full")) { |
| 351 | set.dependencies { |
| 352 | implementation files('libs/libv2ray.aar', 'libs/ss-rust-release.aar', 'libs/ssr-libev-release.aar') |
| 353 | } |
| 354 | } |
| 355 | if (set.name.matches("(mini|full).*")) { |
| 356 | if (set.name.contains("Apple")) { |
| 357 | set.assets.srcDirs = ["src/main/assets", "src/emojis/apple"] |
| 358 | } else if (set.name.contains("Twitter")) { |
| 359 | set.assets.srcDirs = ["src/main/assets", "src/emojis/twitter"] |
| 360 | } else if (!set.name.contains("NoEmoji")) { |
| 361 | set.assets.srcDirs = ["src/main/assets", "src/emojis/blob"] |
| 362 | } |
| 363 | } |
| 364 | } |
| 365 |
| 366 | tasks.all { task -> |
| 367 | if (((task.name.endsWith('Ndk') || task.name.startsWith('generateJsonModel') || task.name.startsWith('externalNativeBuild'))) && !task.name.contains("Foss")) { |
| 368 | task.enabled = false |
| 369 | } |
| 370 | if (task.name.contains("uploadCrashlyticsMappingFile")) { |
| 371 | enabled = false |
| 372 | } |
| 373 | } |
| 374 |
| 375 | applicationVariants.all { variant -> |
| 376 | variant.outputs.all { output -> |
| 377 | outputFileName = outputFileName.replace("TMessagesProj", "NekoX") |
| 378 | } |
| 379 | } |
| 380 |
| 381 | } |
| 382 |
| 383 | apply plugin: 'com.google.gms.google-services' |
| 384 | apply plugin: 'com.google.firebase.crashlytics' |
| 385 |
| 386 | android { |
| 387 |
| 388 | tasks.all { task -> |
| 389 | if (task.name.startsWith('uploadCrashlyticsMappingFile')) { |
| 390 | task.enabled = false |
| 391 | } else if (((task.name.contains('Crashlytics'))) && task.name.contains("NoGcm")) { |
| 392 | task.enabled = false |
| 393 | } else if (((task.name.endsWith('GoogleServices'))) && task.name.contains("NoGcm")) { |
| 394 | task.enabled = false |
| 395 | } |
| 396 | } |
| 397 |
| 398 | } |
| 399 |