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.

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