build.gradle 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  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. compile 'com.github.bumptech.glide:glide:4.1.1'
  140. compile 'com.github.bumptech.glide:okhttp3-integration:4.1.1'
  141. kapt 'com.github.bumptech.glide:compiler:4.1.1'
  142. // Transformations
  143. compile 'jp.wasabeef:glide-transformations:3.0.1'
  144. // Logging
  145. compile 'com.jakewharton.timber:timber:4.5.1'
  146. // Crash reports
  147. compile 'ch.acra:acra:4.9.2'
  148. // Sort
  149. compile 'com.github.gpanther:java-nat-sort:natural-comparator-1.1'
  150. // UI
  151. compile 'com.dmitrymalkovich.android:material-design-dimens:1.4'
  152. compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
  153. compile 'eu.davidea:flexible-adapter:5.0.0-rc1'
  154. compile 'com.nononsenseapps:filepicker:2.5.2'
  155. compile 'com.github.amulyakhare:TextDrawable:558677e'
  156. compile('com.afollestad.material-dialogs:core:0.9.4.7') {
  157. exclude group: "com.android.support", module: "support-v13"
  158. }
  159. compile 'me.zhanghai.android.systemuihelper:library:1.0.0'
  160. compile 'com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.0.4'
  161. compile 'com.github.mthli:Slice:v1.2'
  162. // Conductor
  163. compile "com.bluelinelabs:conductor:2.1.4"
  164. compile 'com.github.inorichi:conductor-support-preference:26.0.2'
  165. // RxBindings
  166. final rxbindings_version = '1.0.1'
  167. compile "com.jakewharton.rxbinding:rxbinding-kotlin:$rxbindings_version"
  168. compile "com.jakewharton.rxbinding:rxbinding-appcompat-v7-kotlin:$rxbindings_version"
  169. compile "com.jakewharton.rxbinding:rxbinding-support-v4-kotlin:$rxbindings_version"
  170. compile "com.jakewharton.rxbinding:rxbinding-recyclerview-v7-kotlin:$rxbindings_version"
  171. // Tests
  172. testCompile 'junit:junit:4.12'
  173. testCompile 'org.assertj:assertj-core:1.7.1'
  174. testCompile 'org.mockito:mockito-core:1.10.19'
  175. final robolectric_version = '3.1.4'
  176. testCompile "org.robolectric:robolectric:$robolectric_version"
  177. testCompile "org.robolectric:shadows-multidex:$robolectric_version"
  178. testCompile "org.robolectric:shadows-play-services:$robolectric_version"
  179. compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  180. final coroutines_version = '0.19.1'
  181. compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
  182. compile "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
  183. }
  184. buildscript {
  185. ext.kotlin_version = '1.1.51'
  186. repositories {
  187. mavenCentral()
  188. }
  189. dependencies {
  190. classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  191. }
  192. }
  193. repositories {
  194. mavenCentral()
  195. }
  196. kotlin {
  197. experimental {
  198. coroutines 'enable'
  199. }
  200. }
  201. // add support for placeholders in resource files
  202. //https://code.google.com/p/android/issues/detail?id=69224
  203. def replacePlaceholdersInFile(basePath, fileName, placeholders) {
  204. def file = new File(basePath, fileName);
  205. if (!file.exists()) {
  206. logger.quiet("Unable to replace placeholders in " + file.toString() + ". File cannot be found.")
  207. return;
  208. }
  209. logger.debug("Replacing placeholders in " + file.toString())
  210. logger.debug("Placeholders: " + placeholders.toString())
  211. def content = file.getText('UTF-8')
  212. placeholders.each { entry ->
  213. content = content.replaceAll("\\\$\\{${entry.key}\\}", entry.value)
  214. }
  215. file.write(content, 'UTF-8')
  216. }
  217. afterEvaluate {
  218. android.applicationVariants.all { variant ->
  219. variant.outputs.each { output ->
  220. output.processResources.doFirst {
  221. // prepare placeholder map from manifestPlaceholders including applicationId placeholder
  222. def placeholders = variant.mergedFlavor.manifestPlaceholders + [applicationId: variant.applicationId]
  223. replacePlaceholdersInFile(resDir, 'xml-v25/shortcuts.xml', placeholders)
  224. }
  225. }
  226. }
  227. }