build.gradle 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. import java.text.SimpleDateFormat
  2. apply plugin: 'com.android.application'
  3. apply plugin: 'kotlin-android'
  4. apply plugin: 'kotlin-android-extensions'
  5. apply plugin: 'kotlin-kapt'
  6. if (file("custom.gradle").exists()) {
  7. apply from: "custom.gradle"
  8. }
  9. ext {
  10. // Git is needed in your system PATH for these commands to work.
  11. // If it's not installed, you can return a random value as a workaround
  12. getCommitCount = {
  13. return 'git rev-list --count HEAD'.execute().text.trim()
  14. // return "1"
  15. }
  16. getGitSha = {
  17. return 'git rev-parse --short HEAD'.execute().text.trim()
  18. // return "1"
  19. }
  20. getBuildTime = {
  21. def df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'")
  22. df.setTimeZone(TimeZone.getTimeZone("UTC"))
  23. return df.format(new Date())
  24. }
  25. }
  26. android {
  27. compileSdkVersion 26
  28. buildToolsVersion "26.0.1"
  29. publishNonDefault true
  30. defaultConfig {
  31. applicationId "eu.kanade.tachiyomi"
  32. minSdkVersion 16
  33. targetSdkVersion 26
  34. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  35. versionCode 26
  36. versionName "0.6.3"
  37. buildConfigField "String", "COMMIT_COUNT", "\"${getCommitCount()}\""
  38. buildConfigField "String", "COMMIT_SHA", "\"${getGitSha()}\""
  39. buildConfigField "String", "BUILD_TIME", "\"${getBuildTime()}\""
  40. buildConfigField "boolean", "INCLUDE_UPDATER", "false"
  41. vectorDrawables.useSupportLibrary = true
  42. ndk {
  43. abiFilters "armeabi-v7a", "arm64-v8a", "x86"
  44. }
  45. }
  46. buildTypes {
  47. debug {
  48. versionNameSuffix "-${getCommitCount()}"
  49. applicationIdSuffix ".debug"
  50. multiDexEnabled true
  51. }
  52. release {
  53. minifyEnabled true
  54. shrinkResources true
  55. multiDexEnabled false
  56. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  57. }
  58. }
  59. productFlavors {
  60. standard {
  61. buildConfigField "boolean", "INCLUDE_UPDATER", "true"
  62. }
  63. fdroid {
  64. }
  65. dev {
  66. minSdkVersion 21
  67. resConfigs "en", "xxhdpi"
  68. }
  69. }
  70. packagingOptions {
  71. exclude 'META-INF/DEPENDENCIES'
  72. exclude 'LICENSE.txt'
  73. exclude 'META-INF/LICENSE'
  74. exclude 'META-INF/LICENSE.txt'
  75. exclude 'META-INF/NOTICE'
  76. }
  77. lintOptions {
  78. abortOnError false
  79. checkReleaseBuilds false
  80. }
  81. }
  82. dependencies {
  83. // Modified dependencies
  84. compile 'com.github.inorichi:subsampling-scale-image-view:01e5385'
  85. compile 'com.github.inorichi:tachimage:68cd311'
  86. compile 'com.github.inorichi:junrar-android:634c1f5'
  87. // Android support library
  88. final support_library_version = '26.1.0'
  89. compile "com.android.support:support-v4:$support_library_version"
  90. compile "com.android.support:appcompat-v7:$support_library_version"
  91. compile "com.android.support:cardview-v7:$support_library_version"
  92. compile "com.android.support:design:$support_library_version"
  93. compile "com.android.support:recyclerview-v7:$support_library_version"
  94. compile "com.android.support:preference-v7:$support_library_version"
  95. compile "com.android.support:support-annotations:$support_library_version"
  96. compile "com.android.support:customtabs:$support_library_version"
  97. compile 'com.android.support.constraint:constraint-layout:1.0.2'
  98. compile 'com.android.support:multidex:1.0.1'
  99. // ReactiveX
  100. compile 'io.reactivex:rxandroid:1.2.1'
  101. compile 'io.reactivex:rxjava:1.3.2'
  102. compile 'com.jakewharton.rxrelay:rxrelay:1.2.0'
  103. compile 'com.f2prateek.rx.preferences:rx-preferences:1.0.2'
  104. compile 'com.github.pwittchen:reactivenetwork:0.7.0'
  105. // Network client
  106. compile "com.squareup.okhttp3:okhttp:3.9.0"
  107. compile 'com.squareup.okio:okio:1.13.0'
  108. // REST
  109. final retrofit_version = '2.3.0'
  110. compile "com.squareup.retrofit2:retrofit:$retrofit_version"
  111. compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
  112. compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
  113. // JSON
  114. compile 'com.google.code.gson:gson:2.8.2'
  115. compile 'com.github.salomonbrys.kotson:kotson:2.5.0'
  116. // YAML
  117. compile 'com.github.bmoliveira:snake-yaml:v1.18-android'
  118. // JavaScript engine
  119. compile 'com.squareup.duktape:duktape-android:1.2.0'
  120. // Disk
  121. compile 'com.jakewharton:disklrucache:2.0.2'
  122. compile 'com.github.seven332:unifile:1.0.0'
  123. // HTML parser
  124. compile 'org.jsoup:jsoup:1.10.2'
  125. // Job scheduling
  126. compile 'com.evernote:android-job:1.1.11'
  127. compile 'com.google.android.gms:play-services-gcm:11.4.0'
  128. // Changelog
  129. compile 'com.github.gabrielemariotti.changeloglib:changelog:2.1.0'
  130. // Database
  131. compile "com.pushtorefresh.storio:sqlite:1.13.0"
  132. // Model View Presenter
  133. final nucleus_version = '3.0.0'
  134. compile "info.android15.nucleus:nucleus:$nucleus_version"
  135. compile "info.android15.nucleus:nucleus-support-v7:$nucleus_version"
  136. // Dependency injection
  137. compile "uy.kohesive.injekt:injekt-core:1.16.1"
  138. // Image library
  139. final glide_version = '4.2.0'
  140. compile "com.github.bumptech.glide:glide:$glide_version"
  141. compile "com.github.bumptech.glide:okhttp3-integration:$glide_version"
  142. kapt "com.github.bumptech.glide:compiler:$glide_version"
  143. // Transformations
  144. compile 'jp.wasabeef:glide-transformations:3.0.1'
  145. // Logging
  146. compile 'com.jakewharton.timber:timber:4.5.1'
  147. // Crash reports
  148. compile 'ch.acra:acra:4.9.2'
  149. // Sort
  150. compile 'com.github.gpanther:java-nat-sort:natural-comparator-1.1'
  151. // UI
  152. compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
  153. compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
  154. compile 'eu.davidea:flexible-adapter:5.0.0-rc1'
  155. compile 'com.nononsenseapps:filepicker:2.5.2'
  156. compile 'com.github.amulyakhare:TextDrawable:558677e'
  157. compile('com.afollestad.material-dialogs:core:0.9.4.7') {
  158. exclude group: "com.android.support", module: "support-v13"
  159. }
  160. compile 'me.zhanghai.android.systemuihelper:library:1.0.0'
  161. compile 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.0.4'
  162. compile 'com.github.mthli:Slice:v1.2'
  163. // Conductor
  164. compile "com.bluelinelabs:conductor:2.1.4"
  165. compile 'com.github.inorichi:conductor-support-preference:26.0.2'
  166. // RxBindings
  167. final rxbindings_version = '1.0.1'
  168. compile "com.jakewharton.rxbinding:rxbinding-kotlin:$rxbindings_version"
  169. compile "com.jakewharton.rxbinding:rxbinding-appcompat-v7-kotlin:$rxbindings_version"
  170. compile "com.jakewharton.rxbinding:rxbinding-support-v4-kotlin:$rxbindings_version"
  171. compile "com.jakewharton.rxbinding:rxbinding-recyclerview-v7-kotlin:$rxbindings_version"
  172. // Tests
  173. testCompile 'junit:junit:4.12'
  174. testCompile 'org.assertj:assertj-core:1.7.1'
  175. testCompile 'org.mockito:mockito-core:1.10.19'
  176. final robolectric_version = '3.1.4'
  177. testCompile "org.robolectric:robolectric:$robolectric_version"
  178. testCompile "org.robolectric:shadows-multidex:$robolectric_version"
  179. testCompile "org.robolectric:shadows-play-services:$robolectric_version"
  180. compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  181. final coroutines_version = '0.19.1'
  182. compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
  183. compile "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
  184. }
  185. buildscript {
  186. ext.kotlin_version = '1.1.51'
  187. repositories {
  188. mavenCentral()
  189. }
  190. dependencies {
  191. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  192. }
  193. }
  194. repositories {
  195. mavenCentral()
  196. }
  197. kotlin {
  198. experimental {
  199. coroutines 'enable'
  200. }
  201. }
  202. // add support for placeholders in resource files
  203. //https://code.google.com/p/android/issues/detail?id=69224
  204. def replacePlaceholdersInFile(basePath, fileName, placeholders) {
  205. def file = new File(basePath, fileName);
  206. if (!file.exists()) {
  207. logger.quiet("Unable to replace placeholders in " + file.toString() + ". File cannot be found.")
  208. return;
  209. }
  210. logger.debug("Replacing placeholders in " + file.toString())
  211. logger.debug("Placeholders: " + placeholders.toString())
  212. def content = file.getText('UTF-8')
  213. placeholders.each { entry ->
  214. content = content.replaceAll("\\\$\\{${entry.key}\\}", entry.value)
  215. }
  216. file.write(content, 'UTF-8')
  217. }
  218. afterEvaluate {
  219. android.applicationVariants.all { variant ->
  220. variant.outputs.each { output ->
  221. output.processResources.doFirst {
  222. // prepare placeholder map from manifestPlaceholders including applicationId placeholder
  223. def placeholders = variant.mergedFlavor.manifestPlaceholders + [applicationId: variant.applicationId]
  224. replacePlaceholdersInFile(resDir, 'xml-v25/shortcuts.xml', placeholders)
  225. }
  226. }
  227. }
  228. }