build.gradle 9.0 KB

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