build.gradle.kts 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard")
  25. }
  26. getByName("debug") {
  27. applicationIdSuffix = ".debug"
  28. }
  29. }
  30. compileOptions {
  31. sourceCompatibility = JavaVersion.VERSION_1_8
  32. targetCompatibility = JavaVersion.VERSION_1_8
  33. }
  34. }
  35. dependencies {
  36. // kotlin standard library
  37. implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72")
  38. // androidx libraries
  39. implementation("androidx.appcompat:appcompat:1.1.0")
  40. implementation("androidx.constraintlayout:constraintlayout:1.1.3")
  41. implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
  42. implementation("androidx.browser:browser:1.2.0")
  43. // rxjava
  44. implementation("io.reactivex.rxjava2:rxjava:2.2.19")
  45. implementation("io.reactivex.rxjava2:rxkotlin:2.4.0")
  46. implementation("io.reactivex.rxjava2:rxandroid:2.1.1")
  47. // retrofit
  48. implementation("com.squareup.retrofit2:retrofit:2.8.1")
  49. implementation("com.squareup.retrofit2:adapter-rxjava2:2.8.1")
  50. implementation("com.squareup.retrofit2:converter-gson:2.8.1")
  51. // okhttp
  52. @Suppress("GradleDependency")
  53. implementation("com.squareup.okhttp3:logging-interceptor:3.14.7")
  54. // etc
  55. implementation("com.google.android.material:material:1.1.0")
  56. implementation("com.github.bumptech.glide:glide:4.11.0")
  57. }
  58. task("updateReadme") {
  59. dependsOn("assembleRelease")
  60. doLast {
  61. val releaseVariant = android.applicationVariants.first { it.name == "release" }
  62. val releaseFiles = releaseVariant.outputs.map { it.outputFile }
  63. val apkFile = releaseFiles.single { it.exists() && it.extension == "apk" }
  64. val apkSize = "%.2f".format(apkFile.length().toFloat() / 1024 / 1024)
  65. rootProject.file("README.md").printWriter().use { readme ->
  66. rootProject.file("readme.md").forEachLine { line ->
  67. readme.appendln(line.replace("{{apkSize}}", apkSize))
  68. }
  69. }
  70. }
  71. }