build.gradle 8.3 KB

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