build.gradle 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: 'kotlin-parcelize'
  4. apply plugin: 'kotlin-kapt'
  5. apply plugin: 'de.timfreiheit.resourceplaceholders'
  6. //apply plugin: 'com.google.gms.google-services'
  7. apply from: 'download.gradle'
  8. static def releaseTime() {
  9. return new Date().format("yy.MMddHH", TimeZone.getTimeZone("GMT+8"))
  10. }
  11. def name = "legado"
  12. def version = "3." + releaseTime()
  13. def gitCommits = Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
  14. android {
  15. compileSdkVersion 31
  16. buildToolsVersion '31.0.0'
  17. kotlinOptions {
  18. jvmTarget = "11"
  19. }
  20. signingConfigs {
  21. if (project.hasProperty("RELEASE_STORE_FILE")) {
  22. myConfig {
  23. storeFile file(RELEASE_STORE_FILE)
  24. storePassword RELEASE_STORE_PASSWORD
  25. keyAlias RELEASE_KEY_ALIAS
  26. keyPassword RELEASE_KEY_PASSWORD
  27. v1SigningEnabled true
  28. v2SigningEnabled true
  29. }
  30. }
  31. }
  32. defaultConfig {
  33. applicationId "io.legado.app"
  34. minSdkVersion 21
  35. targetSdkVersion 31
  36. versionCode 10000 + gitCommits
  37. versionName version
  38. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  39. project.ext.set("archivesBaseName", name + "_" + version)
  40. multiDexEnabled true
  41. javaCompileOptions {
  42. annotationProcessorOptions {
  43. arguments += [
  44. "room.incremental" : "true",
  45. "room.expandProjection": "true",
  46. "room.schemaLocation" : "$projectDir/schemas".toString()
  47. ]
  48. }
  49. }
  50. }
  51. buildFeatures {
  52. viewBinding true
  53. }
  54. buildTypes {
  55. release {
  56. buildConfigField "String", "Cronet_Version", "\"$CronetVersion\""
  57. if (project.hasProperty("RELEASE_STORE_FILE")) {
  58. signingConfig signingConfigs.myConfig
  59. }
  60. applicationIdSuffix '.release'
  61. minifyEnabled false
  62. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  63. }
  64. debug {
  65. buildConfigField "String", "Cronet_Version", "\"$CronetVersion\""
  66. if (project.hasProperty("RELEASE_STORE_FILE")) {
  67. signingConfig signingConfigs.myConfig
  68. }
  69. applicationIdSuffix '.debug'
  70. versionNameSuffix 'debug'
  71. minifyEnabled false
  72. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  73. }
  74. android.applicationVariants.all { variant ->
  75. variant.outputs.all {
  76. def flavor = variant.productFlavors[0].name
  77. outputFileName = "${name}_${flavor}_${defaultConfig.versionName}.apk"
  78. }
  79. }
  80. }
  81. flavorDimensions "mode"
  82. productFlavors {
  83. app {
  84. dimension "mode"
  85. manifestPlaceholders = [APP_CHANNEL_VALUE: "app"]
  86. }
  87. google {
  88. dimension "mode"
  89. applicationId "io.legado.play"
  90. manifestPlaceholders = [APP_CHANNEL_VALUE: "google"]
  91. }
  92. }
  93. compileOptions {
  94. // Flag to enable support for the new language APIs
  95. coreLibraryDesugaringEnabled true
  96. // Sets Java compatibility to Java 11
  97. sourceCompatibility JavaVersion.VERSION_11
  98. targetCompatibility JavaVersion.VERSION_11
  99. }
  100. sourceSets {
  101. // Adds exported schema location as test app assets.
  102. androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
  103. }
  104. tasks.withType(JavaCompile) {
  105. //options.compilerArgs << "-Xlint:unchecked"
  106. }
  107. }
  108. resourcePlaceholders {
  109. files = ['xml/shortcuts.xml']
  110. }
  111. kapt {
  112. arguments {
  113. arg("room.schemaLocation", "$projectDir/schemas")
  114. }
  115. }
  116. dependencies {
  117. coreLibraryDesugaring('com.android.tools:desugar_jdk_libs:1.1.5')
  118. testImplementation('junit:junit:4.13.2')
  119. androidTestImplementation('androidx.test:runner:1.4.0')
  120. androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0')
  121. implementation('androidx.multidex:multidex:2.0.1')
  122. //kotlin
  123. implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version")
  124. //Kotlin反射
  125. implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version")
  126. //协程
  127. def coroutines_version = '1.6.0'
  128. implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
  129. implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version")
  130. //androidX
  131. implementation('androidx.core:core-ktx:1.7.0')
  132. implementation('androidx.appcompat:appcompat:1.4.1')
  133. implementation('androidx.activity:activity-ktx:1.4.0')
  134. implementation('androidx.fragment:fragment-ktx:1.4.1')
  135. implementation('androidx.preference:preference-ktx:1.2.0')
  136. implementation('androidx.constraintlayout:constraintlayout:2.1.3')
  137. implementation('androidx.swiperefreshlayout:swiperefreshlayout:1.1.0')
  138. implementation('androidx.viewpager2:viewpager2:1.0.0')
  139. implementation('com.google.android.material:material:1.5.0')
  140. implementation('com.google.android.flexbox:flexbox:3.0.0')
  141. implementation('com.google.code.gson:gson:2.8.9')
  142. implementation('androidx.webkit:webkit:1.4.0')
  143. //firebase
  144. //implementation platform('com.google.firebase:firebase-bom:29.1.0')
  145. //implementation 'com.google.firebase:firebase-analytics-ktx'
  146. //media
  147. implementation("androidx.media:media:1.5.0")
  148. def exoplayer_version = '2.17.0'
  149. implementation("com.google.android.exoplayer:exoplayer-core:$exoplayer_version")
  150. implementation("com.google.android.exoplayer:extension-okhttp:$exoplayer_version")
  151. //Splitties
  152. def splitties_version = '3.0.0'
  153. implementation("com.louiscad.splitties:splitties-appctx:$splitties_version")
  154. implementation("com.louiscad.splitties:splitties-systemservices:$splitties_version")
  155. implementation("com.louiscad.splitties:splitties-views:$splitties_version")
  156. //lifecycle
  157. def lifecycle_version = '2.4.1'
  158. implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycle_version")
  159. //room
  160. def room_version = '2.4.2'
  161. implementation("androidx.room:room-runtime:$room_version")
  162. implementation("androidx.room:room-ktx:$room_version")
  163. kapt("androidx.room:room-compiler:$room_version")
  164. testImplementation("androidx.room:room-testing:$room_version")
  165. //liveEventBus
  166. implementation('io.github.jeremyliao:live-event-bus-x:1.8.0')
  167. //规则相关
  168. implementation('org.jsoup:jsoup:1.14.3')
  169. implementation('com.jayway.jsonpath:json-path:2.7.0')
  170. implementation('cn.wanghaomiao:JsoupXpath:2.5.1')
  171. implementation(project(path: ':epublib'))
  172. //JS rhino
  173. implementation('com.github.gedoor:rhino-android:1.8')
  174. //网络
  175. implementation('com.squareup.okhttp3:okhttp:4.9.3')
  176. implementation(fileTree(dir: 'cronetlib', include: ['*.jar', '*.aar']))
  177. //Glide
  178. def glideVersion = "4.13.0"
  179. implementation("com.github.bumptech.glide:glide:$glideVersion")
  180. kapt("com.github.bumptech.glide:compiler:$glideVersion")
  181. //webServer
  182. def nanoHttpdVersion = "2.3.1"
  183. implementation("org.nanohttpd:nanohttpd:$nanoHttpdVersion")
  184. implementation("org.nanohttpd:nanohttpd-websocket:$nanoHttpdVersion")
  185. //二维码
  186. implementation('com.github.jenly1314:zxing-lite:2.1.1')
  187. //颜色选择
  188. implementation('com.jaredrummler:colorpicker:1.1.0')
  189. //apache
  190. implementation('org.apache.commons:commons-text:1.9')
  191. //MarkDown
  192. def markwonVersion = "4.6.2"
  193. implementation("io.noties.markwon:core:$markwonVersion")
  194. implementation("io.noties.markwon:image-glide:$markwonVersion")
  195. implementation("io.noties.markwon:ext-tables:$markwonVersion")
  196. implementation("io.noties.markwon:html:$markwonVersion")
  197. //转换繁体
  198. implementation('com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.3')
  199. //加解密类库
  200. implementation('cn.hutool:hutool-crypto:5.7.20')
  201. //代码编辑com.github.AmrDeveloper:CodeView已集成到应用内
  202. //epubLib集成到应用内
  203. // LeakCanary
  204. //debugImplementation('com.squareup.leakcanary:leakcanary-android:2.7')
  205. }