build.gradle 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. plugins {
  2. alias(libs.plugins.android.application)
  3. alias(libs.plugins.kotlin.android)
  4. alias(libs.plugins.kotlin.kapt)
  5. alias(libs.plugins.kotlin.parcelize)
  6. }
  7. final def gitSha = providers.exec {
  8. commandLine('git', 'rev-parse', '--short=7', 'HEAD')
  9. }.standardOutput.asText.get().trim()
  10. // The app name
  11. final def APP_NAME = "Tusky"
  12. // The application id. Must be unique, e.g. based on your domain
  13. final def APP_ID = "com.keylesspalace.tusky"
  14. // url of a custom app logo. Recommended size at least 600x600. Keep empty to use the Tusky elephant friend.
  15. final def CUSTOM_LOGO_URL = ""
  16. // e.g. mastodon.social. Keep empty to not suggest any instance on the signup screen
  17. final def CUSTOM_INSTANCE = ""
  18. // link to your support account. Will be linked on the about page when not empty.
  19. final def SUPPORT_ACCOUNT_URL = "https://mastodon.social/@Tusky"
  20. android {
  21. compileSdk 33
  22. namespace "com.keylesspalace.tusky"
  23. defaultConfig {
  24. applicationId APP_ID
  25. namespace "com.keylesspalace.tusky"
  26. minSdk 23
  27. targetSdk 33
  28. versionCode 100
  29. versionName "21.0"
  30. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  31. vectorDrawables.useSupportLibrary = true
  32. resValue "string", "app_name", APP_NAME
  33. buildConfigField("String", "CUSTOM_LOGO_URL", "\"$CUSTOM_LOGO_URL\"")
  34. buildConfigField("String", "CUSTOM_INSTANCE", "\"$CUSTOM_INSTANCE\"")
  35. buildConfigField("String", "SUPPORT_ACCOUNT_URL", "\"$SUPPORT_ACCOUNT_URL\"")
  36. }
  37. buildTypes {
  38. release {
  39. minifyEnabled true
  40. shrinkResources true
  41. proguardFiles 'proguard-rules.pro'
  42. }
  43. debug {}
  44. }
  45. flavorDimensions += "color"
  46. productFlavors {
  47. blue {}
  48. green {
  49. resValue "string", "app_name", APP_NAME + " Test"
  50. applicationIdSuffix ".test"
  51. versionNameSuffix "-" + gitSha
  52. }
  53. }
  54. lint {
  55. disable 'MissingTranslation'
  56. }
  57. buildFeatures {
  58. buildConfig true
  59. resValues true
  60. viewBinding true
  61. }
  62. testOptions {
  63. unitTests {
  64. returnDefaultValues = true
  65. includeAndroidResources = true
  66. }
  67. unitTests.all {
  68. systemProperty 'robolectric.logging.enabled', 'true'
  69. }
  70. }
  71. sourceSets {
  72. androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
  73. }
  74. // Exclude unneeded files added by libraries
  75. packagingOptions.resources.excludes += [
  76. 'LICENSE_OFL',
  77. 'LICENSE_UNICODE',
  78. ]
  79. bundle {
  80. language {
  81. // bundle all languages in every apk so the dynamic language switching works
  82. enableSplit = false
  83. }
  84. }
  85. dependenciesInfo {
  86. includeInApk false
  87. includeInBundle false
  88. }
  89. compileOptions {
  90. sourceCompatibility JavaVersion.VERSION_11
  91. targetCompatibility JavaVersion.VERSION_11
  92. }
  93. kotlinOptions {
  94. jvmTarget = JavaVersion.VERSION_11
  95. }
  96. applicationVariants.configureEach { variant ->
  97. variant.outputs.configureEach {
  98. outputFileName = "Tusky_${variant.versionName}_${variant.versionCode}_${gitSha}_" +
  99. "${variant.flavorName}_${buildType.name}.apk"
  100. }
  101. }
  102. }
  103. kapt {
  104. arguments {
  105. arg("room.schemaLocation", "$projectDir/schemas")
  106. arg("room.incremental", "true")
  107. }
  108. }
  109. // library versions are in PROJECT_ROOT/gradle/libs.versions.toml
  110. dependencies {
  111. implementation libs.kotlinx.coroutines.android
  112. implementation libs.kotlinx.coroutines.rx3
  113. implementation libs.bundles.androidx
  114. implementation libs.bundles.room
  115. kapt libs.androidx.room.compiler
  116. implementation libs.android.material
  117. implementation libs.gson
  118. implementation libs.bundles.retrofit
  119. implementation libs.networkresult.calladapter
  120. implementation libs.bundles.okhttp
  121. implementation libs.conscrypt.android
  122. implementation libs.bundles.glide
  123. kapt libs.glide.compiler
  124. implementation libs.bundles.rxjava3
  125. implementation libs.bundles.autodispose
  126. implementation libs.bundles.dagger
  127. kapt libs.bundles.dagger.processors
  128. implementation libs.sparkbutton
  129. implementation libs.photoview
  130. implementation libs.bundles.material.drawer
  131. implementation libs.material.typeface
  132. implementation libs.image.cropper
  133. implementation libs.bundles.filemojicompat
  134. implementation libs.bouncycastle
  135. implementation libs.unified.push
  136. testImplementation libs.androidx.test.junit
  137. testImplementation libs.robolectric
  138. testImplementation libs.bundles.mockito
  139. testImplementation libs.mockwebserver
  140. testImplementation libs.androidx.core.testing
  141. testImplementation libs.kotlinx.coroutines.test
  142. testImplementation libs.androidx.work.testing
  143. androidTestImplementation libs.espresso.core
  144. androidTestImplementation libs.androidx.room.testing
  145. androidTestImplementation libs.androidx.test.junit
  146. }