Open-source alternative Instagram client on Android. More maintainers needed!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

257 lines
9.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. apply plugin: 'com.android.application'
  2. apply plugin: 'kotlin-android'
  3. apply plugin: "androidx.navigation.safeargs"
  4. apply plugin: 'kotlin-kapt'
  5. apply from: 'sentry.gradle'
  6. def getGitHash = { ->
  7. def stdout = new ByteArrayOutputStream()
  8. exec {
  9. commandLine 'git', 'rev-parse', '--short', 'HEAD'
  10. standardOutput = stdout
  11. }
  12. return stdout.toString().trim()
  13. }
  14. android {
  15. compileSdkVersion 30
  16. defaultConfig {
  17. applicationId 'me.austinhuang.instagrabber'
  18. minSdkVersion 21
  19. targetSdkVersion 30
  20. versionCode 64
  21. versionName '19.2.3'
  22. multiDexEnabled true
  23. vectorDrawables.useSupportLibrary = true
  24. vectorDrawables.generatedDensities = []
  25. javaCompileOptions {
  26. annotationProcessorOptions {
  27. arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
  28. }
  29. }
  30. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  31. }
  32. sourceSets {
  33. androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
  34. }
  35. compileOptions {
  36. // Flag to enable support for the new language APIs
  37. coreLibraryDesugaringEnabled true
  38. targetCompatibility JavaVersion.VERSION_1_8
  39. sourceCompatibility JavaVersion.VERSION_1_8
  40. }
  41. buildFeatures { viewBinding true }
  42. aaptOptions { additionalParameters '--no-version-vectors' }
  43. buildTypes {
  44. debug {
  45. minifyEnabled true
  46. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  47. }
  48. release {
  49. minifyEnabled true
  50. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
  51. }
  52. }
  53. flavorDimensions "repo"
  54. productFlavors {
  55. github {
  56. dimension "repo"
  57. // versionNameSuffix "-github" // appended in assemble task
  58. buildConfigField("String", "dsn", SENTRY_DSN)
  59. buildConfigField("boolean", "isPre", "false")
  60. }
  61. fdroid {
  62. dimension "repo"
  63. versionNameSuffix "-fdroid"
  64. buildConfigField("boolean", "isPre", "false")
  65. }
  66. }
  67. splits {
  68. // Configures multiple APKs based on ABI.
  69. abi {
  70. // Enables building multiple APKs per ABI.
  71. enable project.hasProperty("split") && !gradle.startParameter.taskNames.isEmpty() && gradle.startParameter.taskNames.get(0).contains('Release')
  72. // By default all ABIs are included, so use reset() and include to specify that we only
  73. // want APKs for x86 and x86_64.
  74. // Resets the list of ABIs that Gradle should create APKs for to none.
  75. reset()
  76. // Specifies a list of ABIs that Gradle should create APKs for.
  77. include "x86", "x86_64", "arm64-v8a", "armeabi-v7a"
  78. // Specifies that we want to also generate a universal APK that includes all ABIs.
  79. universalApk true
  80. }
  81. }
  82. android.applicationVariants.all { variant ->
  83. if (variant.flavorName != "github") return
  84. variant.outputs.all { output ->
  85. def builtType = variant.buildType.name
  86. def versionName = variant.versionName
  87. // def versionCode = variant.versionCode
  88. def flavor = variant.flavorName
  89. def flavorBuiltType = "${flavor}_${builtType}"
  90. def suffix
  91. // For x86 and x86_64, the versionNames are already overridden
  92. if (versionName.contains(flavorBuiltType)) {
  93. suffix = "${versionName}"
  94. } else {
  95. suffix = "${versionName}-${flavorBuiltType}" // eg. 19.1.0-github_debug or release
  96. }
  97. if (builtType.toString() == 'release' && project.hasProperty("pre")) {
  98. buildConfigField("boolean", "isPre", "true")
  99. flavorBuiltType = "${getGitHash()}-${flavor}"
  100. // For x86 and x86_64, the versionNames are already overridden
  101. if (versionName.contains(flavorBuiltType)) {
  102. suffix = "${versionName}"
  103. } else {
  104. // append latest commit short hash for pre-release
  105. suffix = "${versionName}.${flavorBuiltType}" // eg. 19.1.0.b123456-github
  106. }
  107. }
  108. output.versionNameOverride = suffix
  109. def abi = output.getFilter(com.android.build.OutputFile.ABI)
  110. // println(abi + ", " + versionName + ", " + flavor + ", " + builtType + ", " + suffix)
  111. outputFileName = abi == null ? "barinsta_${suffix}.apk" : "barinsta_${suffix}_${abi}.apk"
  112. }
  113. }
  114. packagingOptions {
  115. // Exclude file to avoid
  116. // Error: Duplicate files during packaging of APK
  117. exclude 'META-INF/LICENSE.md'
  118. exclude 'META-INF/LICENSE-notice.md'
  119. exclude 'META-INF/atomicfu.kotlin_module'
  120. }
  121. testOptions.unitTests {
  122. includeAndroidResources = true
  123. }
  124. }
  125. configurations.all {
  126. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  127. }
  128. dependencies {
  129. coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
  130. def nav_version = '2.3.5'
  131. def exoplayer_version = '2.14.1'
  132. implementation 'com.google.android.material:material:1.4.0-rc01'
  133. implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
  134. implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayer_version"
  135. implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayer_version"
  136. implementation "androidx.recyclerview:recyclerview:1.2.1"
  137. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  138. implementation "androidx.viewpager2:viewpager2:1.0.0"
  139. implementation "androidx.navigation:navigation-fragment:$nav_version"
  140. implementation "androidx.navigation:navigation-ui:$nav_version"
  141. implementation "androidx.constraintlayout:constraintlayout:2.0.4"
  142. implementation "androidx.preference:preference:1.1.1"
  143. implementation 'androidx.palette:palette:1.0.0'
  144. implementation 'androidx.documentfile:documentfile:1.0.1'
  145. implementation 'com.google.guava:guava:27.0.1-android'
  146. def core_version = "1.6.0-rc01"
  147. implementation "androidx.core:core:$core_version"
  148. // Fragment
  149. implementation "androidx.fragment:fragment-ktx:1.3.5"
  150. // Lifecycle
  151. implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
  152. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
  153. implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
  154. // Room
  155. def room_version = "2.3.0"
  156. implementation "androidx.room:room-runtime:$room_version"
  157. implementation "androidx.room:room-guava:$room_version"
  158. implementation "androidx.room:room-ktx:$room_version"
  159. kapt "androidx.room:room-compiler:$room_version"
  160. annotationProcessor "androidx.room:room-compiler:$room_version"
  161. // CameraX
  162. def camerax_version = "1.1.0-alpha05"
  163. implementation "androidx.camera:camera-camera2:$camerax_version"
  164. implementation "androidx.camera:camera-lifecycle:$camerax_version"
  165. implementation "androidx.camera:camera-view:1.0.0-alpha25"
  166. // EmojiCompat
  167. def emoji_compat_version = "1.1.0"
  168. implementation "androidx.emoji:emoji:$emoji_compat_version"
  169. implementation "androidx.emoji:emoji-appcompat:$emoji_compat_version"
  170. // Work
  171. def work_version = '2.5.0'
  172. implementation "androidx.work:work-runtime:$work_version"
  173. implementation "androidx.work:work-runtime-ktx:$work_version"
  174. implementation "ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0"
  175. implementation 'com.facebook.fresco:fresco:2.5.0'
  176. implementation 'com.facebook.fresco:animated-webp:2.5.0'
  177. implementation 'com.facebook.fresco:webpsupport:2.5.0'
  178. implementation 'com.squareup.retrofit2:retrofit:2.9.0'
  179. implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
  180. implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
  181. implementation 'org.apache.commons:commons-imaging:1.0-alpha2'
  182. implementation 'com.github.skydoves:balloon:1.3.4'
  183. implementation 'com.github.ammargitham:AutoLinkTextViewV2:3.2.0'
  184. implementation 'com.github.ammargitham:uCrop:2.3-native-beta-2'
  185. implementation 'com.github.ammargitham:android-gpuimage:2.1.1-beta4'
  186. debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
  187. githubImplementation 'io.sentry:sentry-android:5.0.1'
  188. testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
  189. testImplementation "androidx.test.ext:junit-ktx:1.1.2"
  190. testImplementation "androidx.test:core-ktx:1.4.0"
  191. testImplementation "androidx.arch.core:core-testing:2.1.0"
  192. testImplementation "org.robolectric:robolectric:4.5.1"
  193. testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0'
  194. androidTestImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
  195. androidTestImplementation 'androidx.test:core:1.3.0'
  196. androidTestImplementation 'com.android.support:support-annotations:28.0.0'
  197. androidTestImplementation 'com.android.support.test:runner:1.0.2'
  198. androidTestImplementation "androidx.room:room-testing:2.3.0"
  199. }