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.

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