build.gradle 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. plugins {
  2. id 'com.android.application'
  3. id 'org.jetbrains.kotlin.android'
  4. id 'com.google.gms.google-services'
  5. id 'com.google.firebase.crashlytics'
  6. id 'org.jetbrains.kotlin.kapt'
  7. id 'com.tencent.vasdolly'
  8. id 'kotlin-parcelize'
  9. }
  10. def isOfficial = project.OFFICIAL == "true"
  11. if (!isOfficial) {
  12. apply from: "proguard-log.gradle"
  13. }
  14. println("isOfficial:" + isOfficial)
  15. println("IS_RELEASE:" + project.IS_RELEASE)
  16. //apply from: "aab_res_guard.gradle"
  17. apply from: "zip-audio-to-assets.gradle"
  18. def hookConfigByLocalProperties(String localKey, String defaultValue) {
  19. String config = readLocalProperties(localKey)
  20. if (config != null) {
  21. System.out.println("hookConfigByLocalProperties($localKey) ==> $config")
  22. return config
  23. }
  24. return defaultValue
  25. }
  26. def readLocalProperties(String key) {
  27. File file = rootProject.file('local.properties')
  28. if (file.exists()) {
  29. //加载资源
  30. InputStream inputStream = rootProject.file('local.properties').newDataInputStream();
  31. Properties properties = new Properties()
  32. properties.load(inputStream)
  33. if (properties.containsKey(key)) {
  34. return properties.getProperty(key)
  35. }
  36. }
  37. return null
  38. }
  39. android {
  40. namespace 'com.adealink.weparty'
  41. compileSdk libs.versions.compileSdk.get().toInteger()
  42. defaultConfig {
  43. applicationId "com.wenext.wayak"
  44. minSdk libs.versions.minSdk.get().toInteger()
  45. targetSdk libs.versions.targetSdk.get().toInteger()
  46. multiDexEnabled true
  47. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  48. resConfigs "zh", "zh_TW", "en", "ar", "hi", "tr", "th", "bn", "vi", "ur", "id", "ms", "tl", "pt", "es", "ru", "kk", "ky", "tk", "tg", "uz"
  49. buildConfigField("boolean", "OFFICIAL", project.OFFICIAL)
  50. buildConfigField("boolean", "IS_RELEASE", hookConfigByLocalProperties("IS_RELEASE", IS_RELEASE))
  51. buildConfigField("String", "HTTPS_WEB_HOST", '"https://web.wenext.chat"')
  52. buildConfigField("String", "AUTH_APPLE_PATH", '"/web/wyak-auth/apple"')
  53. ndk {
  54. abiFilters "armeabi-v7a"
  55. abiFilters "arm64-v8a"
  56. debugSymbolLevel 'FULL'
  57. }
  58. //指定room.schemaLocation生成的文件路径 处理Room 警告 Schema export Error
  59. javaCompileOptions {
  60. annotationProcessorOptions {
  61. arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
  62. }
  63. }
  64. }
  65. signingConfigs {
  66. debug {
  67. storeFile file('../keystore/debug/debug.keystore')
  68. }
  69. release {
  70. keyAlias "wayak-upload"
  71. keyPassword "wayak654321"
  72. storeFile file("../keystore/wayak/upload-keystore.jks")
  73. storePassword "wayak654321"
  74. }
  75. }
  76. flavorDimensions "product"
  77. productFlavors {
  78. def jvc = project.hasProperty('JKS_VERSION_CODE') ? project.JKS_VERSION_CODE : ""
  79. def jvn = project.hasProperty('JKS_VERSION_NAME') ? project.JKS_VERSION_NAME : ""
  80. def localVC = hookConfigByLocalProperties("VERSION_CODE", VERSION_CODE)
  81. def localVN = hookConfigByLocalProperties("VERSION_NAME", VERSION_NAME)
  82. def vc = jvc != "" ? project.JKS_VERSION_CODE.toInteger() : localVC.toInteger()
  83. def vn = jvn != "" ? project.JKS_VERSION_NAME : localVN
  84. def jvcl = project.hasProperty('JKS_VERSION_CODE_LITE') ? project.JKS_VERSION_CODE_LITE : ""
  85. def jvnl = project.hasProperty('JKS_VERSION_NAME_LITE') ? project.JKS_VERSION_NAME_LITE : ""
  86. def localVCL = hookConfigByLocalProperties("VERSION_CODE_LITE", VERSION_CODE_LITE)
  87. def localVNL = hookConfigByLocalProperties("VERSION_NAME_LITE", VERSION_NAME_LITE)
  88. def vcl = jvcl != "" ? project.JKS_VERSION_CODE_LITE.toInteger() : localVCL.toInteger()
  89. def vnl = jvnl != "" ? project.JKS_VERSION_NAME_LITE : localVNL
  90. println("version_code = " + vc)
  91. println("version_name = " + vn)
  92. println("version_code_lite = " + vcl)
  93. println("version_name_lite = " + vnl)
  94. lite {
  95. dimension "product"
  96. applicationId "com.wenext.wyaklite"
  97. versionCode vcl
  98. versionName vnl
  99. manifestPlaceholders = [
  100. fbAppId : "262361153408130",
  101. fbClientToken : "ad9cf0683a5d9f56b765f6687e013adf",
  102. deepLinkHost : "wayak",
  103. httpDeepLinkHost : "wayak.wenext.chat",
  104. httpWebPathAuthApple: "web/wyak-auth/apple"
  105. ]
  106. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', (isOfficial ? 'proguard-log-empty.pro' : 'proguard-log.pro')
  107. signingConfig signingConfigs.release
  108. buildConfigField("String", "AGORA_APP_ID", '"59ac267560ad4b14b8b3d5b109050d9c"')
  109. buildConfigField("String", "QTT_APP_KEY", '"baa9f1307e2e8ee02742d960828b5c50"')
  110. buildConfigField("String", "HTTP_DEEP_LINK_HOST", '"wayak.wenext.chat"')
  111. buildConfigField("Integer", "TRTC_APP_ID", "1400748842")
  112. buildConfigField("String", "DEEP_LINK_HOST", '"wayak"')
  113. buildConfigField("String", "UTM_FACEBOOK_KEY", '"33475e59ef700534f8f23685d7699eceb89a707fbdb91ca23c2e7f6f5b32a54f"')
  114. }
  115. wyak {
  116. dimension "product"
  117. applicationId "com.wenext.wayak"
  118. versionCode vc
  119. versionName vn
  120. manifestPlaceholders = [
  121. fbAppId : "857800288719942",
  122. fbClientToken : "79b45901eb91e5ebafd12a17fd257fd4",
  123. deepLinkHost : "wayak",
  124. httpDeepLinkHost: "wayak.wenext.chat",
  125. httpWebPathAuthApple: "web/wyak-auth/apple"
  126. ]
  127. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', (isOfficial ? 'proguard-log-empty.pro' : 'proguard-log.pro')
  128. signingConfig signingConfigs.release
  129. buildConfigField("String", "AGORA_APP_ID", '"59ac267560ad4b14b8b3d5b109050d9c"')
  130. buildConfigField("String", "QTT_APP_KEY", '"baa9f1307e2e8ee02742d960828b5c50"')
  131. buildConfigField("String", "HTTP_DEEP_LINK_HOST", '"wayak.wenext.chat"')
  132. buildConfigField("Integer", "TRTC_APP_ID", "1400748842")
  133. buildConfigField("String", "DEEP_LINK_HOST", '"wayak"')
  134. buildConfigField("String", "UTM_FACEBOOK_KEY", '"c4ea5534613d8b3cdcd5b80097989f9eb2414138aa8e49ddfbc458cd5e50f1a6"')
  135. }
  136. }
  137. buildTypes {
  138. debug {
  139. minifyEnabled false
  140. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  141. signingConfig signingConfigs.debug
  142. firebaseCrashlytics {
  143. mappingFileUploadEnabled false
  144. }
  145. }
  146. release {
  147. debuggable false
  148. minifyEnabled true
  149. firebaseCrashlytics {
  150. mappingFileUploadEnabled !isOfficial
  151. nativeSymbolUploadEnabled !isOfficial
  152. // strippedNativeLibsDir 'build/intermediates/stripped_native_libs/release/out/lib'
  153. // unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
  154. }
  155. }
  156. }
  157. compileOptions {
  158. sourceCompatibility JavaVersion.VERSION_17
  159. targetCompatibility JavaVersion.VERSION_17
  160. }
  161. compileOptions {
  162. sourceCompatibility JavaVersion.VERSION_17
  163. targetCompatibility JavaVersion.VERSION_17
  164. }
  165. kotlinOptions {
  166. jvmTarget = JavaVersion.VERSION_17.majorVersion
  167. }
  168. bundle {
  169. language {
  170. enableSplit = false
  171. }
  172. density {
  173. enableSplit = false
  174. }
  175. abi {
  176. enableSplit = true
  177. }
  178. }
  179. sourceSets {
  180. main {
  181. jniLibs {
  182. srcDir 'libs'
  183. }
  184. }
  185. }
  186. packagingOptions {
  187. exclude '**/*.kotlin_*'
  188. }
  189. dynamicFeatures = [':module:account',
  190. ':module:room',
  191. ':module:follow',
  192. ':module:profile',
  193. ':module:setting',
  194. ':module:gift',
  195. ':module:wallet',
  196. ':module:webview',
  197. ':module:emotion',
  198. ':module:message',
  199. ':module:rank',
  200. ':module:game',
  201. ':module:music',
  202. ':module:theme',
  203. ':module:level',
  204. ':module:operation',
  205. ':module:entereffect',
  206. ':module:store',
  207. ':module:headline',
  208. ':module:search',
  209. ':module:share',
  210. ':module:image',
  211. ':module:call',
  212. ':module:anchor',
  213. ':module:party',
  214. ':module:excel',
  215. ':module:email',
  216. ':module:superadmin',
  217. ':module:backpack',
  218. ':module:pk',
  219. ':module:skin',
  220. ':module:couple',
  221. ':module:family',
  222. ':module:attribution',
  223. ':module:roomtask',
  224. ':module:userprotect',
  225. ':module:medal',
  226. ':module:guardtreasure',
  227. ':module:bettingpk',
  228. ':module:micgrab',
  229. ':module:moment',
  230. ':module:youtube',
  231. ':module:visitors',
  232. ':module:youtube',
  233. ':module:gamehub:uno',
  234. ':module:gamehub:carrom',
  235. ':module:gamehub:domino',
  236. ':module:gamehub:ludo',
  237. ]
  238. buildFeatures {
  239. viewBinding true
  240. buildConfig true
  241. }
  242. configurations.configureEach {
  243. exclude group: 'com.facebook.fresco', module: 'drawee'
  244. }
  245. }
  246. gradle.taskGraph.addTaskExecutionListener(new TaskExecutionListener() {
  247. @Override
  248. void beforeExecute(Task task) {
  249. }
  250. @Override
  251. void afterExecute(Task task, TaskState taskState) {
  252. if (task.name.equalsIgnoreCase("bundleWyak")
  253. || task.name.equalsIgnoreCase("bundleLite")
  254. || task.name.equalsIgnoreCase("bundleRelease")
  255. || task.name.equalsIgnoreCase("liteRelease")
  256. || task.name.equalsIgnoreCase("wyakRelease")
  257. || task.name.equalsIgnoreCase("bundleDebug")
  258. || task.name.equalsIgnoreCase("bundleLiteDebug")
  259. || task.name.equalsIgnoreCase("bundleWyakDebug")) {
  260. copy {
  261. from 'build/intermediates/intermediary_bundle/'
  262. into 'build/outputs/bundle/'
  263. duplicatesStrategy DuplicatesStrategy.FAIL
  264. }
  265. println("afterExecute " + task.name)
  266. def aabDir = project.getBuildDir().absolutePath + '/outputs/bundle'
  267. fileTree(dir: aabDir, include: '*/*.aab').each { File file ->
  268. println(file.absolutePath)
  269. def cmd = []
  270. cmd << "java"
  271. cmd << "-jar"
  272. cmd << "${project.rootDir}/tool/bundletool.jar"
  273. cmd << "build-apks"
  274. cmd << "--bundle=" + file.absolutePath
  275. cmd << "--output=" + file.parent + File.separator + file.name.replace(".aab", "-split.apks")
  276. cmd << "--overwrite"
  277. cmd << "--mode=universal"
  278. if (task.name.equalsIgnoreCase("bundleDebug")) {
  279. cmd << "--ks=" + android.signingConfigs.debug.storeFile
  280. cmd << "--ks-pass=pass:" + android.signingConfigs.debug.storePassword
  281. cmd << "--ks-key-alias=" + android.signingConfigs.debug.keyAlias
  282. cmd << "--key-pass=pass:" + android.signingConfigs.debug.keyPassword
  283. } else {
  284. def keystoreProperties = new Properties()
  285. keystoreProperties.load(new FileInputStream(rootProject.file('keystore.properties')))
  286. cmd << "--ks=" + keystoreProperties.storeFile
  287. cmd << "--ks-pass=pass:" + keystoreProperties.storePassword
  288. cmd << "--ks-key-alias=" + keystoreProperties.keyAlias
  289. cmd << "--key-pass=pass:" + keystoreProperties.keyPassword
  290. }
  291. exec {
  292. commandLine cmd
  293. }
  294. }
  295. println("after build apks")
  296. }
  297. }
  298. })
  299. dependencies {
  300. api fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
  301. //kotlin
  302. implementation libs.kotlin.stdlib
  303. //androidx
  304. api libs.androidx.core.ktx
  305. api libs.androidx.appcompat
  306. api libs.androidx.constraint.layout
  307. api libs.androidx.activity
  308. api libs.androidx.fragment.ktx
  309. api libs.androidx.viewpager2
  310. api libs.androidx.lifecycle.livedata.ktx
  311. api libs.androidx.lifecycle.viewmodel.ktx
  312. api libs.androidx.exifinterface
  313. implementation libs.androidx.multidex
  314. implementation libs.androidx.vectordrawable
  315. implementation libs.androidx.work.manager
  316. api libs.androidx.room.runtime
  317. api libs.androidx.room.ktx
  318. kapt libs.androidx.room.compiler
  319. //android
  320. implementation libs.android.material
  321. implementation libs.android.install.referrer
  322. //google play core
  323. implementation libs.play.feature.delivery
  324. implementation libs.play.feature.delivery.ktx
  325. implementation libs.play.app.update
  326. implementation libs.play.app.update.ktx
  327. //facebook
  328. implementation libs.facebook.android.sdk
  329. //appsflyer
  330. implementation libs.appsflyer
  331. //reflect
  332. implementation libs.free.reflection
  333. //java
  334. implementation libs.rxjava
  335. //channel
  336. implementation libs.tencent.vasdolly.helper
  337. //firebase
  338. implementation platform(libs.firebase.bom)
  339. implementation libs.firebase.analytics
  340. implementation libs.firebase.crashlytics
  341. implementation libs.firebase.crashlytics.ndk
  342. implementation libs.firebase.dynamic.link
  343. implementation libs.firebase.messaging
  344. //gson
  345. implementation libs.gson
  346. //other
  347. api libs.smart.refresh.layout.kernel
  348. api libs.smart.refresh.header.material
  349. api libs.smart.refresh.footer.classics
  350. api libs.media3.exoplayer
  351. api libs.media3.exoplayer.dash
  352. api libs.media3.ui
  353. // media3 v1.4.1 guava 单独设置, 待media3更新后移除
  354. implementation libs.guava
  355. api libs.video.processor
  356. api libs.payermax
  357. api libs.rxjava
  358. //frame
  359. api platform(libs.frame.bom)
  360. api libs.frame.animplayer
  361. api libs.frame.drawee
  362. api libs.frame.image
  363. api libs.frame.mvvm
  364. api libs.frame.util
  365. api libs.frame.zero
  366. api libs.frame.base
  367. api libs.frame.network
  368. api libs.frame.retrofit
  369. api libs.frame.oss
  370. api libs.frame.download
  371. api libs.frame.sound
  372. api libs.frame.game
  373. api libs.frame.autosize
  374. api libs.frame.spi
  375. api libs.frame.data
  376. api libs.frame.aab
  377. api libs.frame.coroutine
  378. api libs.frame.storage
  379. api libs.frame.log
  380. api libs.frame.statistics
  381. api libs.frame.googleservice
  382. api libs.frame.deviceid
  383. api libs.frame.security
  384. api libs.frame.guide
  385. api libs.frame.effect
  386. api libs.frame.svga
  387. api libs.frame.debug
  388. api project(":frame:room")
  389. api libs.frame.locale
  390. api libs.frame.push
  391. api libs.frame.media
  392. api libs.frame.share
  393. api libs.frame.dot
  394. api libs.frame.crash
  395. api libs.frame.apm
  396. api libs.frame.audio
  397. api libs.frame.tceffect
  398. api libs.frame.router.annotation
  399. api libs.frame.router.api
  400. kapt libs.frame.router.compiler
  401. implementation libs.toolargetool
  402. // debugApi "com.tuzhenlei:crashhandler:1.0.1"
  403. // debugApi 'cat.ereza:customactivityoncrash:2.3.0'
  404. // debugImplementation "io.github.yvescheung:Uinspector:2.0.20"
  405. // debugImplementation "io.github.yvescheung:Uinspector-optional-viewmodel:2.0.20"
  406. // debugImplementation "io.github.yvescheung:Uinspector-optional-fresco:2.0.20"
  407. // debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
  408. //test
  409. testImplementation libs.junit
  410. androidTestImplementation libs.androidx.junit
  411. androidTestImplementation libs.androidx.espresso.core
  412. }