| 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-2' |
| 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 | implementation 'org.dizitart:nitrite:3.4.3' |
| 83 |
| 84 | implementation 'cn.hutool:hutool-core:5.5.6' |
| 85 | implementation 'cn.hutool:hutool-crypto:5.5.6' |
| 86 | implementation 'cn.hutool:hutool-http:5.5.6' |
| 87 |
| 88 | implementation 'com.jakewharton:process-phoenix:2.0.0' |
| 89 |
| 90 | implementation project(":openpgp-api") |
| 91 |
| 92 | compileOnly files('libs/libv2ray.aar') |
| 93 | compileOnly "com.google.firebase:firebase-messaging:$fcmVersion" |
| 94 | compileOnly "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 95 | compileOnly "com.google.android.play:core:$playCoreVersion" |
| 96 |
| 97 | debugImplementation "com.google.firebase:firebase-messaging:$fcmVersion" |
| 98 | debugImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 99 | debugImplementation "com.google.android.play:core:$playCoreVersion" |
| 100 | releaseImplementation "com.google.firebase:firebase-messaging:$fcmVersion" |
| 101 | releaseImplementation "com.google.firebase:firebase-crashlytics:$crashlyticsVersion" |
| 102 | releaseImplementation "com.google.android.play:core:$playCoreVersion" |
| 103 |
| 104 | testImplementation 'junit:junit:4.13.1' |
| 105 | testImplementation 'androidx.test:core:1.3.0' |
| 106 | testImplementation "org.robolectric:robolectric:4.4" |
| 107 |
| 108 | coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.1' |
| 109 |
| 110 | } |
| 111 |
| 112 | android { |
| 113 | compileSdkVersion 30 |
| 114 | buildToolsVersion '30.0.3' |
| 115 | ndkVersion rootProject.ext.ndkVersion |
| 116 |
| 117 | defaultConfig.applicationId = "nekox.messenger" |
| 118 |
| 119 | defaultConfig { |
| 120 | minSdkVersion 16 |
| 121 | //noinspection ExpiredTargetSdkVersion,OldTargetApi |
| 122 | targetSdkVersion 29 |
| 123 |
| 124 | versionName verName |
| 125 | versionCode verCode |
| 126 |
| 127 | def appId = null |
| 128 | def appHash = null |
| 129 |
| 130 | //obtain your own keys at https://core.telegram.org/api/obtaining_api_id |
| 131 |
| 132 | if (project.rootProject.file('local.properties').exists()) { |
| 133 | Properties properties = new Properties() |
| 134 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) |
| 135 | appId = properties.getProperty("TELEGRAM_APP_ID") ?: System.getenv("TELEGRAM_APP_ID") |
| 136 | appHash = properties.getProperty("TELEGRAM_APP_HASH") ?: System.getenv("TELEGRAM_APP_HASH") |
| 137 | } |
| 138 |
| 139 | buildConfigField 'int', 'APP_ID', appId != null ? appId : "1391584" |
| 140 | buildConfigField 'String', 'APP_HASH', "\"" + (appHash != null ? appHash : "355c91550b0d658cfb7ff89dcf91a08c") + "\"" |
| 141 |
| 142 | externalNativeBuild { |
| 143 | cmake { |
| 144 | version '3.10.2' |
| 145 | arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-16', "-j=16" |
| 146 | } |
| 147 | } |
| 148 |
| 149 | } |
| 150 |
| 151 | bundle { |
| 152 | language { |
| 153 | enableSplit = false |
| 154 | } |
| 155 | } |
| 156 |
| 157 | externalNativeBuild { |
| 158 | cmake { |
| 159 | path 'jni/CMakeLists.txt' |
| 160 | } |
| 161 | } |
| 162 |
| 163 | lintOptions { |
| 164 | disable 'MissingTranslation' |
| 165 | disable 'ExtraTranslation' |
| 166 | disable 'BlockedPrivateApi' |
| 167 | } |
| 168 |
| 169 | packagingOptions { |
| 170 |
| 171 | exclude '/fabric/**' |
| 172 | exclude '/META-INF/*.version' |
| 173 | exclude '/META-INF/*.kotlin_module' |
| 174 | exclude '/builddef.lst' |
| 175 | exclude '/*.txt' |
| 176 |
| 177 | } |
| 178 |
| 179 | dexOptions { |
| 180 | jumboMode = true |
| 181 | } |
| 182 |
| 183 | compileOptions { |
| 184 | sourceCompatibility JavaVersion.VERSION_1_8 |
| 185 | targetCompatibility JavaVersion.VERSION_1_8 |
| 186 |
| 187 | coreLibraryDesugaringEnabled true |
| 188 | } |
| 189 |
| 190 | kotlinOptions { |
| 191 | jvmTarget = JavaVersion.VERSION_1_8.toString() |
| 192 | } |
| 193 |
| 194 | testOptions { |
| 195 | unitTests.includeAndroidResources = true |
| 196 | } |
| 197 |
| 198 | signingConfigs { |
| 199 | def keystorePwd = null |
| 200 | def alias = null |
| 201 | def pwd = null |
| 202 | Properties properties |
| 203 |
| 204 | if (project.rootProject.file('local.properties').exists()) { |
| 205 | properties = new Properties() |
| 206 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) |
| 207 | } else { |
| 208 | def base64 = System.getenv("LOCAL_PROPERTIES") |
| 209 | if (base64 != null && !base64.isBlank()) { |
| 210 | properties = new Properties() |
| 211 | properties.load(new ByteArrayInputStream(Base64.decoder.decode(base64))) |
| 212 | } |
| 213 | } |
| 214 |
| 215 | if (properties != null) { |
| 216 | keystorePwd = properties.getProperty("KEYSTORE_PASS") |
| 217 | alias = properties.getProperty("ALIAS_NAME") |
| 218 | pwd = properties.getProperty("ALIAS_PASS") |
| 219 | } |
| 220 |
| 221 | keystorePwd = keystorePwd ?: System.getenv("KEYSTORE_PASS") |
| 222 | alias = alias ?: System.getenv("ALIAS_NAME") |
| 223 | pwd = pwd ?: System.getenv("ALIAS_PASS") |
| 224 |
| 225 | release { |
| 226 |
| 227 | storeFile project.file('release.keystore') |
| 228 | storePassword keystorePwd |
| 229 | keyAlias alias |
| 230 | keyPassword pwd |
| 231 | } |
| 232 |
| 233 | } |
| 234 |
| 235 | buildTypes { |
| 236 | debug { |
| 237 | isDefault true |
| 238 | debuggable true |
| 239 | jniDebuggable false |
| 240 | multiDexEnabled true |
| 241 | zipAlignEnabled true |
| 242 | signingConfig signingConfigs.release |
| 243 | } |
| 244 |
| 245 | releaseNoGcm { |
| 246 | debuggable false |
| 247 | jniDebuggable false |
| 248 | minifyEnabled true |
| 249 | shrinkResources true |
| 250 | multiDexEnabled true |
| 251 | zipAlignEnabled true |
| 252 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 253 | matchingFallbacks = ['debug'] |
| 254 | signingConfig signingConfigs.release |
| 255 | } |
| 256 |
| 257 | release { |
| 258 | debuggable false |
| 259 | jniDebuggable false |
| 260 | minifyEnabled true |
| 261 | shrinkResources true |
| 262 | multiDexEnabled true |
| 263 | zipAlignEnabled true |
| 264 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 265 | matchingFallbacks = ['debug'] |
| 266 | signingConfig signingConfigs.release |
| 267 | } |
| 268 |
| 269 | foss { |
| 270 | debuggable false |
| 271 | jniDebuggable false |
| 272 | minifyEnabled true |
| 273 | shrinkResources true |
| 274 | multiDexEnabled true |
| 275 | zipAlignEnabled true |
| 276 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
| 277 | matchingFallbacks = ['debug'] |
| 278 | } |
| 279 | } |
| 280 |
| 281 | sourceSets { |
| 282 |
| 283 | main { |
| 284 | jni.srcDirs = [] |
| 285 | } |
| 286 |
| 287 | debug { |
| 288 | jniLibs.srcDir 'src/main/libs' |
| 289 | manifest.srcFile 'src/gservcies/AndroidManifest.xml' |
| 290 | } |
| 291 |
| 292 | releaseNoGcm { |
| 293 | jniLibs.srcDir 'src/main/libs' |
| 294 | } |
| 295 |
| 296 | release { |
| 297 | jniLibs.srcDir 'src/main/libs' |
| 298 | manifest.srcFile 'src/gservcies/AndroidManifest.xml' |
| 299 | } |
| 300 |
| 301 | foss { |
| 302 | jni.srcDirs = ['./jni/'] |
| 303 | } |
| 304 |
| 305 | } |
| 306 |
| 307 | splits.abi { |
| 308 |
| 309 | enable true |
| 310 | universalApk false |
| 311 |
| 312 | } |
| 313 |
| 314 | flavorDimensions "version" |
| 315 |
| 316 | productFlavors { |
| 317 | mini { |
| 318 | versionNameSuffix '-mini' |
| 319 | } |
| 320 | full { |
| 321 | isDefault true |
| 322 | } |
| 323 | fullPlay { |
| 324 | versionNameSuffix '-play' |
| 325 | versionCode verCode - 1 |
| 326 | } |
| 327 | } |
| 328 |
| 329 | sourceSets.all { set -> |
| 330 | if (set.name.startsWith("full")) { |
| 331 | set.dependencies { |
| 332 | implementation files('libs/libv2ray.aar', 'libs/ss-rust-release.aar', 'libs/ssr-libev-release.aar') |
| 333 | } |
| 334 | } |
| 335 | if (set.name.matches("(mini|full).*")) { |
| 336 | //if (set.name.contains("Apple")) { |
| 337 | set.assets.srcDirs = ["src/main/assets", "src/emojis/apple"] |
| 338 | /*} else if (set.name.contains("Twitter")) { |
| 339 | set.assets.srcDirs = ["src/main/assets", "src/emojis/twitter"] |
| 340 | } else { |
| 341 | set.assets.srcDirs = ["src/main/assets", "src/emojis/blob"] |
| 342 | }*/ |
| 343 | } |
| 344 | } |
| 345 |
| 346 | tasks.all { task -> |
| 347 | if (((task.name.endsWith('Ndk') || task.name.startsWith('generateJsonModel') || task.name.startsWith('externalNativeBuild'))) && !task.name.contains("Foss")) { |
| 348 | task.enabled = false |
| 349 | } |
| 350 | if (task.name.contains("uploadCrashlyticsMappingFile")) { |
| 351 | enabled = false |
| 352 | } |
| 353 | } |
| 354 |
| 355 | applicationVariants.all { variant -> |
| 356 | variant.outputs.all { output -> |
| 357 | outputFileName = outputFileName.replace("TMessagesProj", "NekoX") |
| 358 | } |
| 359 | } |
| 360 |
| 361 | } |
| 362 |
| 363 | apply plugin: 'com.google.gms.google-services' |
| 364 | apply plugin: 'com.google.firebase.crashlytics' |
| 365 |
| 366 | android { |
| 367 |
| 368 | tasks.all { task -> |
| 369 | if (task.name.startsWith('uploadCrashlyticsMappingFile')) { |
| 370 | task.enabled = false |
| 371 | } else if (((task.name.contains('Crashlytics'))) && task.name.contains("NoGcm")) { |
| 372 | task.enabled = false |
| 373 | } else if (((task.name.endsWith('GoogleServices'))) && task.name.contains("NoGcm")) { |
| 374 | task.enabled = false |
| 375 | } |
| 376 | } |
| 377 |
| 378 | } |
| 379 |