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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. signingConfigs {
  28. debug {
  29. storeFile file('debug.keystore')
  30. storePassword 'android'
  31. keyAlias 'androiddebugkey'
  32. keyPassword 'android'
  33. }
  34. }
  35. buildTypes {
  36. debug {
  37. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
  38. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  39. }
  40. release {
  41. // Uncomment the following line for singing a test release build.
  42. //signingConfig signingConfigs.debug
  43. minifyEnabled true
  44. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-release.pro'
  45. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${googleServicesEnabled}"
  46. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  47. }
  48. }
  49. sourceSets {
  50. main {
  51. java {
  52. if (rootProject.ext.libreBuild) {
  53. srcDir "src"
  54. exclude "**/GoogleServicesHelper.java"
  55. }
  56. }
  57. }
  58. }
  59. compileOptions {
  60. sourceCompatibility JavaVersion.VERSION_1_8
  61. targetCompatibility JavaVersion.VERSION_1_8
  62. }
  63. }
  64. repositories {
  65. maven { url 'https://maven.fabric.io/public' }
  66. }
  67. dependencies {
  68. implementation fileTree(dir: 'libs', include: ['*.jar'])
  69. implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  70. implementation 'androidx.appcompat:appcompat:1.1.0'
  71. debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-beta-5'
  72. if (!rootProject.ext.libreBuild) {
  73. implementation 'com.google.android.gms:play-services-auth:16.0.1'
  74. // Firebase
  75. // - Crashlytics
  76. // - Dynamic Links
  77. implementation 'com.google.firebase:firebase-core:16.0.6'
  78. implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
  79. implementation 'com.google.firebase:firebase-dynamic-links:16.1.5'
  80. }
  81. implementation project(':sdk')
  82. }
  83. gradle.projectsEvaluated {
  84. // Dropbox integration
  85. //
  86. def dropboxAppKey
  87. if (project.file('dropbox.key').exists()) {
  88. dropboxAppKey = project.file('dropbox.key').text.trim() - 'db-'
  89. }
  90. if (dropboxAppKey) {
  91. android.defaultConfig.resValue('string', 'dropbox_app_key', "${dropboxAppKey}")
  92. def dropboxActivity = """
  93. <activity
  94. android:configChanges="keyboard|orientation"
  95. android:launchMode="singleTask"
  96. android:name="com.dropbox.core.android.AuthActivity">
  97. <intent-filter>
  98. <action android:name="android.intent.action.VIEW" />
  99. <category android:name="android.intent.category.BROWSABLE" />
  100. <category android:name="android.intent.category.DEFAULT" />
  101. <data android:scheme="db-${dropboxAppKey}" />
  102. </intent-filter>
  103. </activity>"""
  104. android.applicationVariants.all { variant ->
  105. variant.outputs.each { output ->
  106. output.getProcessManifestProvider().get().doLast {
  107. def outputDir = manifestOutputDirectory.get().asFile
  108. def manifestPath = new File(outputDir, 'AndroidManifest.xml')
  109. def charset = 'UTF-8'
  110. def text
  111. text = manifestPath.getText(charset)
  112. text = text.replace('</application>', "${dropboxActivity}</application>")
  113. manifestPath.write(text, charset)
  114. }
  115. }
  116. }
  117. }
  118. // Run React packager
  119. android.applicationVariants.all { variant ->
  120. def targetName = variant.name.capitalize()
  121. def currentRunPackagerTask = tasks.create(
  122. name: "run${targetName}ReactPackager",
  123. type: Exec) {
  124. group = "react"
  125. description = "Run the React packager."
  126. doFirst {
  127. println "Starting the React packager..."
  128. def androidRoot = file("${projectDir}/../")
  129. // Set up the call to the script
  130. workingDir androidRoot
  131. // Run the packager
  132. commandLine("scripts/run-packager.sh")
  133. }
  134. // Set up dev mode
  135. def devEnabled = !targetName.toLowerCase().contains("release")
  136. // Only enable for dev builds
  137. enabled devEnabled
  138. }
  139. def packageTask = variant.packageApplicationProvider.get()
  140. packageTask.dependsOn(currentRunPackagerTask)
  141. }
  142. }
  143. if (googleServicesEnabled) {
  144. apply plugin: 'com.google.gms.google-services'
  145. }