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.

262 lines
9.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
5 years ago
5 years ago
3 years ago
3 years ago
5 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 65
  21. versionName '19.2.4'
  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. exclude 'META-INF/AL2.0'
  121. exclude 'META-INF/LGPL2.1'
  122. }
  123. testOptions.unitTests {
  124. includeAndroidResources = true
  125. }
  126. }
  127. configurations.all {
  128. resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
  129. }
  130. dependencies {
  131. coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
  132. def exoplayer_version = '2.14.1'
  133. implementation 'com.google.android.material:material:1.4.0'
  134. implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
  135. implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayer_version"
  136. implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayer_version"
  137. implementation "androidx.recyclerview:recyclerview:1.2.1"
  138. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  139. implementation "androidx.viewpager2:viewpager2:1.0.0"
  140. implementation "androidx.constraintlayout:constraintlayout:2.0.4"
  141. implementation "androidx.preference:preference:1.1.1"
  142. implementation 'androidx.palette:palette:1.0.0'
  143. implementation 'androidx.documentfile:documentfile:1.0.1'
  144. implementation 'com.google.guava:guava:27.0.1-android'
  145. def core_version = "1.6.0"
  146. implementation "androidx.core:core:$core_version"
  147. // Fragment
  148. implementation "androidx.fragment:fragment-ktx:1.3.5"
  149. // Lifecycle
  150. implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
  151. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
  152. implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.3.1"
  153. // Navigation
  154. implementation "androidx.navigation:navigation-fragment-ktx:$rootProject.nav_version"
  155. implementation "androidx.navigation:navigation-ui-ktx:$rootProject.nav_version"
  156. // Room
  157. def room_version = "2.3.0"
  158. implementation "androidx.room:room-runtime:$room_version"
  159. implementation "androidx.room:room-guava:$room_version"
  160. implementation "androidx.room:room-ktx:$room_version"
  161. kapt "androidx.room:room-compiler:$room_version"
  162. annotationProcessor "androidx.room:room-compiler:$room_version"
  163. // CameraX
  164. def camerax_version = "1.1.0-alpha06"
  165. implementation "androidx.camera:camera-camera2:$camerax_version"
  166. implementation "androidx.camera:camera-lifecycle:$camerax_version"
  167. implementation "androidx.camera:camera-view:1.0.0-alpha26"
  168. // EmojiCompat
  169. def emoji_compat_version = "1.1.0"
  170. implementation "androidx.emoji:emoji:$emoji_compat_version"
  171. implementation "androidx.emoji:emoji-appcompat:$emoji_compat_version"
  172. // Work
  173. def work_version = '2.5.0'
  174. implementation "androidx.work:work-runtime:$work_version"
  175. implementation "androidx.work:work-runtime-ktx:$work_version"
  176. implementation "ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0"
  177. implementation 'com.facebook.fresco:fresco:2.5.0'
  178. implementation 'com.facebook.fresco:animated-webp:2.5.0'
  179. implementation 'com.facebook.fresco:webpsupport:2.5.0'
  180. implementation 'com.squareup.retrofit2:retrofit:2.9.0'
  181. implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
  182. implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
  183. implementation 'org.apache.commons:commons-imaging:1.0-alpha2'
  184. implementation 'com.github.skydoves:balloon:1.3.5'
  185. implementation 'com.github.ammargitham:AutoLinkTextViewV2:3.2.0'
  186. implementation 'com.github.ammargitham:uCrop:2.3-non-native'
  187. implementation 'com.github.ammargitham:android-gpuimage:2.1.1-beta4'
  188. debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
  189. githubImplementation 'io.sentry:sentry-android:5.0.1'
  190. testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
  191. testImplementation "androidx.test.ext:junit-ktx:1.1.3"
  192. testImplementation "androidx.test:core-ktx:1.4.0"
  193. testImplementation "androidx.arch.core:core-testing:2.1.0"
  194. testImplementation "org.robolectric:robolectric:4.5.1"
  195. testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0'
  196. androidTestImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
  197. androidTestImplementation 'androidx.test:core:1.4.0'
  198. androidTestImplementation 'com.android.support:support-annotations:28.0.0'
  199. androidTestImplementation 'com.android.support.test:runner:1.0.2'
  200. androidTestImplementation "androidx.room:room-testing:2.3.0"
  201. androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
  202. androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.0'
  203. }