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.

253 lines
8.8 KiB

4 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
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 29
  20. versionCode 63
  21. versionName '19.2.2'
  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.13.3'
  132. implementation 'com.google.android.material:material:1.4.0-beta01'
  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.0"
  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 'com.google.guava:guava:27.0.1-android'
  145. def core_version = "1.6.0-beta01"
  146. implementation "androidx.core:core:$core_version"
  147. // Fragment
  148. implementation "androidx.fragment:fragment-ktx:1.3.4"
  149. // Lifecycle
  150. implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
  151. implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
  152. // Room
  153. def room_version = "2.3.0"
  154. implementation "androidx.room:room-runtime:$room_version"
  155. implementation "androidx.room:room-guava:$room_version"
  156. implementation "androidx.room:room-ktx:$room_version"
  157. kapt "androidx.room:room-compiler:$room_version"
  158. annotationProcessor "androidx.room:room-compiler:$room_version"
  159. // CameraX
  160. def camerax_version = "1.1.0-alpha04"
  161. implementation "androidx.camera:camera-camera2:$camerax_version"
  162. implementation "androidx.camera:camera-lifecycle:$camerax_version"
  163. implementation "androidx.camera:camera-view:1.0.0-alpha24"
  164. // EmojiCompat
  165. def emoji_compat_version = "1.1.0"
  166. implementation "androidx.emoji:emoji:$emoji_compat_version"
  167. implementation "androidx.emoji:emoji-appcompat:$emoji_compat_version"
  168. // Work
  169. def work_version = '2.5.0'
  170. implementation "androidx.work:work-runtime:$work_version"
  171. implementation "androidx.work:work-runtime-ktx:$work_version"
  172. implementation "ru.gildor.coroutines:kotlin-coroutines-okhttp:1.0"
  173. implementation 'com.facebook.fresco:fresco:2.3.0'
  174. implementation 'com.facebook.fresco:animated-webp:2.3.0'
  175. implementation 'com.facebook.fresco:webpsupport:2.3.0'
  176. implementation 'com.squareup.retrofit2:retrofit:2.9.0'
  177. implementation 'com.squareup.retrofit2:converter-scalars:2.9.0'
  178. implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
  179. implementation 'org.apache.commons:commons-imaging:1.0-alpha2'
  180. implementation 'com.github.skydoves:balloon:1.3.4'
  181. implementation 'com.github.ammargitham:AutoLinkTextViewV2:3.2.0'
  182. implementation 'com.github.ammargitham:uCrop:2.3-native-beta-2'
  183. implementation 'com.github.ammargitham:android-gpuimage:2.1.1-beta4'
  184. debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
  185. githubImplementation 'io.sentry:sentry-android:4.3.0'
  186. testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
  187. testImplementation "androidx.test.ext:junit-ktx:1.1.2"
  188. testImplementation "androidx.test:core-ktx:1.3.0"
  189. testImplementation "org.robolectric:robolectric:4.5.1"
  190. androidTestImplementation 'org.junit.jupiter:junit-jupiter:5.7.1'
  191. androidTestImplementation 'androidx.test:core:1.3.0'
  192. androidTestImplementation 'com.android.support:support-annotations:28.0.0'
  193. androidTestImplementation 'com.android.support.test:runner:1.0.2'
  194. androidTestImplementation "androidx.room:room-testing:2.3.0"
  195. }