build.gradle.kts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. plugins {
  2. id("com.android.application")
  3. id("kotlin-android")
  4. id("kotlin-android-extensions")
  5. }
  6. androidExtensions {
  7. isExperimental = true
  8. }
  9. android {
  10. compileSdkVersion(29)
  11. buildToolsVersion("29.0.3")
  12. defaultConfig {
  13. applicationId = "com.sirekanyan.knigopis"
  14. minSdkVersion(21)
  15. targetSdkVersion(29)
  16. versionCode = 25
  17. versionName = "0.2.3"
  18. setProperty("archivesBaseName", "$applicationId-$versionName-$versionCode")
  19. vectorDrawables.useSupportLibrary = true
  20. }
  21. buildTypes {
  22. getByName("release") {
  23. isMinifyEnabled = true
  24. isShrinkResources = true
  25. proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard")
  26. }
  27. getByName("debug") {
  28. applicationIdSuffix = ".debug"
  29. }
  30. }
  31. compileOptions {
  32. sourceCompatibility = JavaVersion.VERSION_1_8
  33. targetCompatibility = JavaVersion.VERSION_1_8
  34. }
  35. }
  36. dependencies {
  37. // kotlin standard library
  38. implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72")
  39. // androidx libraries
  40. implementation("androidx.appcompat:appcompat:1.1.0")
  41. implementation("androidx.constraintlayout:constraintlayout:1.1.3")
  42. implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
  43. implementation("androidx.browser:browser:1.2.0")
  44. // rxjava
  45. implementation("io.reactivex.rxjava2:rxjava:2.2.19")
  46. implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
  47. implementation("io.reactivex.rxjava2:rxandroid:2.1.1")
  48. // retrofit
  49. implementation("com.squareup.retrofit2:retrofit:2.8.1")
  50. implementation("com.squareup.retrofit2:adapter-rxjava2:2.8.1")
  51. implementation("com.squareup.retrofit2:converter-gson:2.8.1")
  52. // okhttp
  53. @Suppress("GradleDependency")
  54. implementation("com.squareup.okhttp3:logging-interceptor:3.14.7")
  55. // etc
  56. implementation("com.google.android.material:material:1.1.0")
  57. implementation("com.github.bumptech.glide:glide:4.11.0")
  58. }
  59. task("updateReadme") {
  60. dependsOn("assembleRelease")
  61. doLast {
  62. val releaseVariant = android.applicationVariants.first { it.name == "release" }
  63. val releaseFiles = releaseVariant.outputs.map { it.outputFile }
  64. val apkFile = releaseFiles.single { it.exists() && it.extension == "apk" }
  65. val apkSize = "%.2f".format(apkFile.length().toFloat() / 1024 / 1024)
  66. rootProject.file("README.md").printWriter().use { readme ->
  67. rootProject.file("readme.md").forEachLine { line ->
  68. readme.appendln(line.replace("{{apkSize}}", apkSize))
  69. }
  70. }
  71. }
  72. }