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.

build.gradle 5.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. apply plugin: 'com.android.application'
  2. boolean googleServicesEnabled \
  3. = project.file('google-services.json').exists() && !rootProject.ext.libreBuild
  4. // Crashlytics integration is done as part of Firebase now, so it gets
  5. // automagically activated with google-services.json
  6. if (googleServicesEnabled) {
  7. apply plugin: 'io.fabric'
  8. }
  9. // Use the number of seconds/10 since Jan 1 2019 as the versionCode.
  10. // This lets us upload a new build at most every 10 seconds for the
  11. // next ~680 years.
  12. // https://stackoverflow.com/a/38643838
  13. def vcode = (int)(((new Date().getTime()/1000) - 1546297200) / 10)
  14. android {
  15. compileSdkVersion rootProject.ext.compileSdkVersion
  16. buildToolsVersion rootProject.ext.buildToolsVersion
  17. defaultConfig {
  18. applicationId 'org.jitsi.meet'
  19. versionCode vcode
  20. versionName project.appVersion
  21. minSdkVersion rootProject.ext.minSdkVersion
  22. targetSdkVersion rootProject.ext.targetSdkVersion
  23. ndk {
  24. abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
  25. }
  26. }
  27. buildTypes {
  28. debug {
  29. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
  30. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  31. }
  32. release {
  33. minifyEnabled true
  34. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-release.pro'
  35. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
  36. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  37. }
  38. }
  39. sourceSets {
  40. main {
  41. java {
  42. if (rootProject.ext.libreBuild) {
  43. srcDir "src"
  44. exclude "**/GoogleServicesHelper.java"
  45. }
  46. }
  47. }
  48. }
  49. compileOptions {
  50. sourceCompatibility JavaVersion.VERSION_1_8
  51. targetCompatibility JavaVersion.VERSION_1_8
  52. }
  53. }
  54. repositories {
  55. maven { url 'https://maven.fabric.io/public' }
  56. }
  57. dependencies {
  58. implementation fileTree(dir: 'libs', include: ['*.jar'])
  59. implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  60. implementation 'androidx.appcompat:appcompat:1.0.2'
  61. if (!rootProject.ext.libreBuild) {
  62. implementation 'com.google.android.gms:play-services-auth:16.0.1'
  63. // Firebase
  64. // - Crashlytics
  65. // - Dynamic Links
  66. implementation 'com.google.firebase:firebase-core:16.0.6'
  67. implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
  68. implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
  69. }
  70. implementation project(':sdk')
  71. debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.6.1'
  72. releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.1'
  73. }
  74. gradle.projectsEvaluated {
  75. // Dropbox integration
  76. //
  77. def dropboxAppKey
  78. if (project.file('dropbox.key').exists()) {
  79. dropboxAppKey = project.file('dropbox.key').text.trim() - 'db-'
  80. }
  81. if (dropboxAppKey) {
  82. android.defaultConfig.resValue('string', 'dropbox_app_key', "${dropboxAppKey}")
  83. def dropboxActivity = """
  84. <activity
  85. android:configChanges="keyboard|orientation"
  86. android:launchMode="singleTask"
  87. android:name="com.dropbox.core.android.AuthActivity">
  88. <intent-filter>
  89. <action android:name="android.intent.action.VIEW" />
  90. <category android:name="android.intent.category.BROWSABLE" />
  91. <category android:name="android.intent.category.DEFAULT" />
  92. <data android:scheme="db-${dropboxAppKey}" />
  93. </intent-filter>
  94. </activity>"""
  95. android.applicationVariants.all { variant ->
  96. variant.outputs.each { output ->
  97. output.getProcessManifestProvider().get().doLast {
  98. def outputDir = manifestOutputDirectory.get().asFile
  99. def manifestPath = new File(outputDir, 'AndroidManifest.xml')
  100. def charset = 'UTF-8'
  101. def text
  102. text = manifestPath.getText(charset)
  103. text = text.replace('</application>', "${dropboxActivity}</application>")
  104. manifestPath.write(text, charset)
  105. }
  106. }
  107. }
  108. }
  109. // Run React packager
  110. android.applicationVariants.all { variant ->
  111. def targetName = variant.name.capitalize()
  112. def currentRunPackagerTask = tasks.create(
  113. name: "run${targetName}ReactPackager",
  114. type: Exec) {
  115. group = "react"
  116. description = "Run the React packager."
  117. doFirst {
  118. println "Starting the React packager..."
  119. def androidRoot = file("${projectDir}/../")
  120. // Set up the call to the script
  121. workingDir androidRoot
  122. // Run the packager
  123. commandLine("scripts/run-packager.sh")
  124. }
  125. // Set up dev mode
  126. def devEnabled = !targetName.toLowerCase().contains("release")
  127. // Only enable for dev builds
  128. enabled devEnabled
  129. }
  130. def packageTask = variant.packageApplicationProvider.get()
  131. packageTask.dependsOn(currentRunPackagerTask)
  132. }
  133. }
  134. if (googleServicesEnabled) {
  135. apply plugin: 'com.google.gms.google-services'
  136. }