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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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.1.0'
  61. debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-5'
  62. if (!rootProject.ext.libreBuild) {
  63. implementation 'com.google.android.gms:play-services-auth:16.0.1'
  64. // Firebase
  65. // - Crashlytics
  66. // - Dynamic Links
  67. implementation 'com.google.firebase:firebase-core:16.0.6'
  68. implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
  69. implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
  70. }
  71. implementation project(':sdk')
  72. }
  73. gradle.projectsEvaluated {
  74. // Dropbox integration
  75. //
  76. def dropboxAppKey
  77. if (project.file('dropbox.key').exists()) {
  78. dropboxAppKey = project.file('dropbox.key').text.trim() - 'db-'
  79. }
  80. if (dropboxAppKey) {
  81. android.defaultConfig.resValue('string', 'dropbox_app_key', "${dropboxAppKey}")
  82. def dropboxActivity = """
  83. <activity
  84. android:configChanges="keyboard|orientation"
  85. android:launchMode="singleTask"
  86. android:name="com.dropbox.core.android.AuthActivity">
  87. <intent-filter>
  88. <action android:name="android.intent.action.VIEW" />
  89. <category android:name="android.intent.category.BROWSABLE" />
  90. <category android:name="android.intent.category.DEFAULT" />
  91. <data android:scheme="db-${dropboxAppKey}" />
  92. </intent-filter>
  93. </activity>"""
  94. android.applicationVariants.all { variant ->
  95. variant.outputs.each { output ->
  96. output.getProcessManifestProvider().get().doLast {
  97. def outputDir = manifestOutputDirectory.get().asFile
  98. def manifestPath = new File(outputDir, 'AndroidManifest.xml')
  99. def charset = 'UTF-8'
  100. def text
  101. text = manifestPath.getText(charset)
  102. text = text.replace('</application>', "${dropboxActivity}</application>")
  103. manifestPath.write(text, charset)
  104. }
  105. }
  106. }
  107. }
  108. // Run React packager
  109. android.applicationVariants.all { variant ->
  110. def targetName = variant.name.capitalize()
  111. def currentRunPackagerTask = tasks.create(
  112. name: "run${targetName}ReactPackager",
  113. type: Exec) {
  114. group = "react"
  115. description = "Run the React packager."
  116. doFirst {
  117. println "Starting the React packager..."
  118. def androidRoot = file("${projectDir}/../")
  119. // Set up the call to the script
  120. workingDir androidRoot
  121. // Run the packager
  122. commandLine("scripts/run-packager.sh")
  123. }
  124. // Set up dev mode
  125. def devEnabled = !targetName.toLowerCase().contains("release")
  126. // Only enable for dev builds
  127. enabled devEnabled
  128. }
  129. def packageTask = variant.packageApplicationProvider.get()
  130. packageTask.dependsOn(currentRunPackagerTask)
  131. }
  132. }
  133. if (googleServicesEnabled) {
  134. apply plugin: 'com.google.gms.google-services'
  135. }