build.gradle 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
  2. import java.text.SimpleDateFormat
  3. apply plugin: 'com.android.application'
  4. apply plugin: 'com.mikepenz.aboutlibraries.plugin'
  5. apply plugin: 'kotlin-android'
  6. apply plugin: 'kotlin-android-extensions'
  7. apply plugin: 'kotlin-kapt'
  8. apply plugin: 'kotlinx-serialization'
  9. apply plugin: 'com.github.zellius.shortcut-helper'
  10. shortcutHelper.filePath = './shortcuts.xml'
  11. ext {
  12. // Git is needed in your system PATH for these commands to work.
  13. // If it's not installed, you can return a random value as a workaround
  14. getCommitCount = {
  15. return 'git rev-list --count HEAD'.execute().text.trim()
  16. // return "1"
  17. }
  18. getGitSha = {
  19. return 'git rev-parse --short HEAD'.execute().text.trim()
  20. // return "1"
  21. }
  22. getBuildTime = {
  23. def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
  24. df.setTimeZone(TimeZone.getTimeZone("UTC"))
  25. return df.format(new Date())
  26. }
  27. }
  28. android {
  29. compileSdkVersion AndroidConfig.compileSdk
  30. buildToolsVersion AndroidConfig.buildTools
  31. ndkVersion AndroidConfig.ndk
  32. defaultConfig {
  33. applicationId "eu.kanade.tachiyomi"
  34. minSdkVersion AndroidConfig.minSdk
  35. targetSdkVersion AndroidConfig.targetSdk
  36. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  37. versionCode 51
  38. versionName "0.10.5"
  39. buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
  40. buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
  41. buildConfigField "String", "BUILD_TIME", "\"${getBuildTime()}\""
  42. buildConfigField "boolean", "INCLUDE_UPDATER", "false"
  43. multiDexEnabled true
  44. ndk {
  45. abiFilters "armeabi-v7a", "arm64-v8a", "x86"
  46. }
  47. }
  48. buildFeatures {
  49. viewBinding = true
  50. }
  51. buildTypes {
  52. debug {
  53. versionNameSuffix "-${getCommitCount()}"
  54. applicationIdSuffix ".debug"
  55. }
  56. release {
  57. postprocessing {
  58. obfuscate false
  59. optimizeCode true
  60. removeUnusedCode false
  61. removeUnusedResources true
  62. proguardFiles 'proguard-rules.pro'
  63. }
  64. }
  65. }
  66. flavorDimensions "default"
  67. productFlavors {
  68. standard {
  69. buildConfigField "boolean", "INCLUDE_UPDATER", "true"
  70. dimension "default"
  71. }
  72. fdroid {
  73. dimension "default"
  74. }
  75. dev {
  76. resConfigs "en", "xxhdpi"
  77. dimension "default"
  78. }
  79. }
  80. packagingOptions {
  81. exclude 'META-INF/DEPENDENCIES'
  82. exclude 'LICENSE.txt'
  83. exclude 'META-INF/LICENSE'
  84. exclude 'META-INF/LICENSE.txt'
  85. exclude 'META-INF/NOTICE'
  86. }
  87. dependenciesInfo {
  88. includeInApk = false
  89. }
  90. lintOptions {
  91. disable 'MissingTranslation'
  92. disable 'ExtraTranslation'
  93. abortOnError false
  94. checkReleaseBuilds false
  95. }
  96. compileOptions {
  97. sourceCompatibility = JavaVersion.VERSION_1_8
  98. targetCompatibility = JavaVersion.VERSION_1_8
  99. }
  100. kotlinOptions {
  101. jvmTarget = JavaVersion.VERSION_1_8.toString()
  102. }
  103. }
  104. androidExtensions {
  105. experimental = true
  106. }
  107. dependencies {
  108. // Source models and interfaces from Tachiyomi 1.x
  109. implementation 'tachiyomi.sourceapi:source-api:1.1'
  110. // AndroidX libraries
  111. implementation 'androidx.annotation:annotation:1.2.0-alpha01'
  112. implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
  113. implementation 'androidx.biometric:biometric:1.1.0-rc01'
  114. implementation 'androidx.browser:browser:1.3.0-rc01'
  115. implementation 'androidx.cardview:cardview:1.0.0'
  116. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
  117. implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
  118. implementation 'androidx.core:core-ktx:1.4.0-alpha01'
  119. implementation 'androidx.multidex:multidex:2.0.1'
  120. implementation 'androidx.preference:preference-ktx:1.1.1'
  121. implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha06'
  122. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01'
  123. final lifecycle_version = '2.3.0-beta01'
  124. implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
  125. implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
  126. implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
  127. // Job scheduling
  128. final work_version = '2.5.0-beta01'
  129. implementation "androidx.work:work-runtime:$work_version"
  130. implementation "androidx.work:work-runtime-ktx:$work_version"
  131. // UI library
  132. implementation 'com.google.android.material:material:1.3.0-alpha03'
  133. standardImplementation 'com.google.firebase:firebase-core:18.0.0'
  134. // ReactiveX
  135. implementation 'io.reactivex:rxandroid:1.2.1'
  136. implementation 'io.reactivex:rxjava:1.3.8'
  137. implementation 'com.jakewharton.rxrelay:rxrelay:1.2.0'
  138. implementation 'com.github.pwittchen:reactivenetwork:0.13.0'
  139. // Network client
  140. final okhttp_version = '4.10.0-RC1'
  141. implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
  142. implementation "com.squareup.okhttp3:logging-interceptor:$okhttp_version"
  143. implementation "com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttp_version"
  144. implementation 'com.squareup.okio:okio:2.9.0'
  145. // TLS 1.3 support for Android < 10
  146. implementation 'org.conscrypt:conscrypt-android:2.5.1'
  147. // REST
  148. final retrofit_version = '2.9.0'
  149. implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
  150. implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
  151. implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
  152. implementation "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
  153. // JSON
  154. final kotlin_serialization_version = '1.0.1'
  155. implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialization_version"
  156. implementation "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$kotlin_serialization_version"
  157. implementation 'com.google.code.gson:gson:2.8.6'
  158. implementation 'com.github.salomonbrys.kotson:kotson:2.5.0'
  159. // JavaScript engine
  160. implementation 'com.squareup.duktape:duktape-android:1.3.0'
  161. // Disk
  162. implementation 'com.jakewharton:disklrucache:2.0.2'
  163. implementation 'com.github.inorichi:unifile:e9ee588'
  164. implementation 'com.github.inorichi:junrar-android:634c1f5'
  165. // HTML parser
  166. implementation 'org.jsoup:jsoup:1.13.1'
  167. // Database
  168. implementation 'androidx.sqlite:sqlite-ktx:2.1.0'
  169. implementation 'com.github.inorichi.storio:storio-common:8be19de@aar'
  170. implementation 'com.github.inorichi.storio:storio-sqlite:8be19de@aar'
  171. implementation 'io.requery:sqlite-android:3.33.0'
  172. // Preferences
  173. implementation 'com.github.tfcporciuncula.flow-preferences:flow-preferences:1.3.3'
  174. // Model View Presenter
  175. final nucleus_version = '3.0.0'
  176. implementation "info.android15.nucleus:nucleus:$nucleus_version"
  177. implementation "info.android15.nucleus:nucleus-support-v7:$nucleus_version"
  178. // Dependency injection
  179. implementation "com.github.inorichi.injekt:injekt-core:65b0440"
  180. // Image library
  181. final glide_version = '4.11.0'
  182. implementation "com.github.bumptech.glide:glide:$glide_version"
  183. implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version"
  184. kapt "com.github.bumptech.glide:compiler:$glide_version"
  185. implementation 'com.github.tachiyomiorg:subsampling-scale-image-view:6caf219'
  186. // Logging
  187. implementation 'com.jakewharton.timber:timber:4.7.1'
  188. // Crash reports
  189. implementation 'ch.acra:acra-http:5.7.0'
  190. // Sort
  191. implementation 'com.github.gpanther:java-nat-sort:natural-comparator-1.1'
  192. // UI
  193. implementation 'com.dmitrymalkovich.android:material-design-dimens:1.4'
  194. implementation 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
  195. implementation 'eu.davidea:flexible-adapter:5.1.0'
  196. implementation 'eu.davidea:flexible-adapter-ui:1.0.0'
  197. implementation 'com.nononsenseapps:filepicker:2.5.2'
  198. implementation 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0'
  199. implementation 'com.github.chrisbanes:PhotoView:2.3.0'
  200. implementation 'com.github.carlosesco:DirectionalViewPager:a844dbca0a'
  201. // 3.2.0+ introduces weird UI blinking or cut off issues on some devices
  202. final material_dialogs_version = '3.1.1'
  203. implementation "com.afollestad.material-dialogs:core:$material_dialogs_version"
  204. implementation "com.afollestad.material-dialogs:input:$material_dialogs_version"
  205. implementation "com.afollestad.material-dialogs:datetime:$material_dialogs_version"
  206. // Conductor
  207. implementation 'com.bluelinelabs:conductor:2.1.5'
  208. implementation("com.bluelinelabs:conductor-support:2.1.5") {
  209. exclude group: "com.android.support"
  210. }
  211. implementation 'com.github.tachiyomiorg:conductor-support-preference:1.1.1'
  212. // FlowBinding
  213. final flowbinding_version = '0.12.0'
  214. implementation "io.github.reactivecircus.flowbinding:flowbinding-android:$flowbinding_version"
  215. implementation "io.github.reactivecircus.flowbinding:flowbinding-appcompat:$flowbinding_version"
  216. implementation "io.github.reactivecircus.flowbinding:flowbinding-recyclerview:$flowbinding_version"
  217. implementation "io.github.reactivecircus.flowbinding:flowbinding-swiperefreshlayout:$flowbinding_version"
  218. implementation "io.github.reactivecircus.flowbinding:flowbinding-viewpager:$flowbinding_version"
  219. // Licenses
  220. // NOTE: REMEMBER TO UPDATE GRADLE PLUGIN
  221. implementation 'com.mikepenz:aboutlibraries:8.4.2'
  222. // Tests
  223. testImplementation 'junit:junit:4.13'
  224. testImplementation 'org.assertj:assertj-core:3.16.1'
  225. testImplementation 'org.mockito:mockito-core:1.10.19'
  226. final robolectric_version = '3.1.4'
  227. testImplementation "org.robolectric:robolectric:$robolectric_version"
  228. testImplementation "org.robolectric:shadows-multidex:$robolectric_version"
  229. testImplementation "org.robolectric:shadows-play-services:$robolectric_version"
  230. implementation "org.jetbrains.kotlin:kotlin-reflect:$BuildPluginsVersion.KOTLIN"
  231. final coroutines_version = '1.4.1'
  232. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
  233. implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
  234. // For detecting memory leaks; see https://square.github.io/leakcanary/
  235. // debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4'
  236. }
  237. buildscript {
  238. repositories {
  239. mavenCentral()
  240. }
  241. dependencies {
  242. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$BuildPluginsVersion.KOTLIN"
  243. }
  244. }
  245. repositories {
  246. mavenCentral()
  247. maven {
  248. url "https://dl.bintray.com/tachiyomiorg/maven"
  249. }
  250. }
  251. // See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api-markers
  252. tasks.withType(AbstractKotlinCompile).all {
  253. kotlinOptions.freeCompilerArgs += [
  254. "-Xopt-in=kotlin.Experimental",
  255. "-Xopt-in=kotlin.RequiresOptIn",
  256. "-Xuse-experimental=kotlin.ExperimentalStdlibApi",
  257. "-Xuse-experimental=kotlinx.coroutines.FlowPreview",
  258. "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
  259. "-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi",
  260. ]
  261. }
  262. // Duplicating Hebrew string assets due to some locale code issues on different devices
  263. task copyHebrewStrings(type: Copy) {
  264. from './src/main/res/values-he'
  265. into './src/main/res/values-iw'
  266. include '**/*'
  267. }
  268. preBuild.dependsOn(formatKotlin, copyHebrewStrings)
  269. if (getGradle().getStartParameter().getTaskRequests().toString().contains("Standard")) {
  270. apply plugin: 'com.google.gms.google-services'
  271. }