build.gradle 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. plugins {
  2. alias(libs.plugins.android.application)
  3. alias(libs.plugins.google.ksp)
  4. alias(libs.plugins.kotlin.android)
  5. alias(libs.plugins.kotlin.kapt)
  6. alias(libs.plugins.kotlin.parcelize)
  7. }
  8. apply from: 'getGitSha.gradle'
  9. final def gitSha = ext.getGitSha()
  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 113
  29. versionName "23.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. }
  44. flavorDimensions += "color"
  45. productFlavors {
  46. blue {}
  47. green {
  48. resValue "string", "app_name", APP_NAME + " Test"
  49. applicationIdSuffix ".test"
  50. versionNameSuffix "-" + gitSha
  51. }
  52. }
  53. lint {
  54. lintConfig file("lint.xml")
  55. // Regenerate by deleting app/lint-baseline.xml, then run:
  56. // ./gradlew lintBlueDebug
  57. baseline = file("lint-baseline.xml")
  58. }
  59. buildFeatures {
  60. buildConfig true
  61. resValues true
  62. viewBinding true
  63. }
  64. testOptions {
  65. unitTests {
  66. returnDefaultValues = true
  67. includeAndroidResources = true
  68. }
  69. unitTests.all {
  70. systemProperty 'robolectric.logging.enabled', 'true'
  71. systemProperty 'robolectric.lazyload', 'ON'
  72. }
  73. }
  74. sourceSets {
  75. androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
  76. }
  77. // Exclude unneeded files added by libraries
  78. packagingOptions.resources.excludes += [
  79. 'LICENSE_OFL',
  80. 'LICENSE_UNICODE',
  81. ]
  82. bundle {
  83. language {
  84. // bundle all languages in every apk so the dynamic language switching works
  85. enableSplit = false
  86. }
  87. }
  88. dependenciesInfo {
  89. includeInApk false
  90. includeInBundle false
  91. }
  92. // Can remove this once https://issuetracker.google.com/issues/260059413 is fixed.
  93. // https://kotlinlang.org/docs/gradle-configure-project.html#gradle-java-toolchains-support
  94. compileOptions {
  95. sourceCompatibility JavaVersion.VERSION_11
  96. targetCompatibility JavaVersion.VERSION_11
  97. }
  98. applicationVariants.configureEach { variant ->
  99. variant.outputs.configureEach {
  100. outputFileName = "Tusky_${variant.versionName}_${variant.versionCode}_${gitSha}_" +
  101. "${variant.flavorName}_${buildType.name}.apk"
  102. }
  103. }
  104. }
  105. ksp {
  106. arg("room.schemaLocation", "$projectDir/schemas")
  107. arg("room.incremental", "true")
  108. }
  109. configurations {
  110. // JNI-only libraries don't play nicely with Robolectric
  111. // see https://github.com/tuskyapp/Tusky/pull/3367
  112. testImplementation.exclude group: "org.conscrypt", module: "conscrypt-android"
  113. testRuntime.exclude group: "org.conscrypt", module: "conscrypt-android"
  114. }
  115. // library versions are in PROJECT_ROOT/gradle/libs.versions.toml
  116. dependencies {
  117. implementation libs.kotlinx.coroutines.android
  118. implementation libs.kotlinx.coroutines.rx3
  119. implementation libs.bundles.androidx
  120. implementation libs.bundles.room
  121. ksp libs.androidx.room.compiler
  122. implementation libs.android.material
  123. implementation libs.gson
  124. implementation libs.bundles.retrofit
  125. implementation libs.networkresult.calladapter
  126. implementation libs.bundles.okhttp
  127. implementation libs.conscrypt.android
  128. implementation libs.bundles.glide
  129. kapt libs.glide.compiler
  130. implementation libs.bundles.rxjava3
  131. implementation libs.bundles.autodispose
  132. implementation libs.bundles.dagger
  133. kapt libs.bundles.dagger.processors
  134. implementation libs.sparkbutton
  135. implementation libs.photoview
  136. implementation libs.bundles.material.drawer
  137. implementation libs.material.typeface
  138. implementation libs.image.cropper
  139. implementation libs.bundles.filemojicompat
  140. implementation libs.bouncycastle
  141. implementation libs.unified.push
  142. implementation libs.bundles.xmldiff
  143. testImplementation libs.androidx.test.junit
  144. testImplementation libs.robolectric
  145. testImplementation libs.bundles.mockito
  146. testImplementation libs.mockwebserver
  147. testImplementation libs.androidx.core.testing
  148. testImplementation libs.kotlinx.coroutines.test
  149. testImplementation libs.androidx.work.testing
  150. testImplementation libs.truth
  151. testImplementation libs.turbine
  152. androidTestImplementation libs.espresso.core
  153. androidTestImplementation libs.androidx.room.testing
  154. androidTestImplementation libs.androidx.test.junit
  155. }