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 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'maven-publish'
  3. android {
  4. compileSdkVersion rootProject.ext.compileSdkVersion
  5. defaultConfig {
  6. minSdkVersion rootProject.ext.minSdkVersion
  7. targetSdkVersion rootProject.ext.targetSdkVersion
  8. }
  9. buildTypes {
  10. debug {}
  11. release {
  12. minifyEnabled false
  13. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  14. }
  15. }
  16. }
  17. dependencies {
  18. implementation fileTree(dir: 'libs', include: ['*.jar'])
  19. implementation "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
  20. implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
  21. implementation 'org.webkit:android-jsc:+'
  22. implementation 'com.amplitude:android-sdk:2.14.1'
  23. implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
  24. api 'com.facebook.react:react-native:+'
  25. implementation project(':react-native-background-timer')
  26. implementation project(':react-native-calendar-events')
  27. implementation(project(':react-native-fast-image')) {
  28. exclude group: 'com.android.support'
  29. }
  30. implementation(project(":react-native-google-signin")) {
  31. exclude group: 'com.google.android.gms'
  32. exclude group: 'com.android.support'
  33. }
  34. implementation project(':react-native-immersive')
  35. implementation project(':react-native-keep-awake')
  36. implementation project(':react-native-linear-gradient')
  37. implementation project(':react-native-sound')
  38. implementation project(':react-native-vector-icons')
  39. implementation project(':react-native-webrtc')
  40. testImplementation 'junit:junit:4.12'
  41. }
  42. // Here we bundle all assets, resources and React files. We cannot use the
  43. // react.gradle file provided by react-native because it's designed to be used
  44. // in an application (it taps into applicationVariants, but the SDK is a library
  45. // so we need libraryVariants instead).
  46. android.libraryVariants.all { def variant ->
  47. // Create variant and target names
  48. def targetName = variant.name.capitalize()
  49. def targetPath = variant.dirName
  50. // React js bundle directories
  51. def jsBundleDir = file("$buildDir/generated/assets/react/${targetPath}")
  52. def resourcesDir = file("$buildDir/generated/res/react/${targetPath}")
  53. def jsBundleFile = file("$jsBundleDir/index.android.bundle")
  54. def currentBundleTask = tasks.create(
  55. name: "bundle${targetName}JsAndAssets",
  56. type: Exec) {
  57. group = "react"
  58. description = "bundle JS and assets for ${targetName}."
  59. // Create dirs if they are not there (e.g. the "clean" task just ran)
  60. doFirst {
  61. jsBundleDir.deleteDir()
  62. jsBundleDir.mkdirs()
  63. resourcesDir.deleteDir()
  64. resourcesDir.mkdirs()
  65. }
  66. // Set up inputs and outputs so gradle can cache the result
  67. def reactRoot = file("${projectDir}/../../")
  68. inputs.files fileTree(dir: reactRoot, excludes: ["android/**", "ios/**"])
  69. outputs.dir jsBundleDir
  70. outputs.dir resourcesDir
  71. // Set up the call to the react-native cli
  72. workingDir reactRoot
  73. // Set up dev mode
  74. def devEnabled = !targetName.toLowerCase().contains("release")
  75. // Run the bundler
  76. commandLine(
  77. "node",
  78. "node_modules/react-native/local-cli/cli.js",
  79. "bundle",
  80. "--platform", "android",
  81. "--dev", "${devEnabled}",
  82. "--reset-cache",
  83. "--entry-file", "index.android.js",
  84. "--bundle-output", jsBundleFile,
  85. "--assets-dest", resourcesDir)
  86. // Disable bundling on dev builds
  87. enabled !devEnabled
  88. }
  89. currentBundleTask.ext.generatedResFolders = files(resourcesDir).builtBy(currentBundleTask)
  90. currentBundleTask.ext.generatedAssetsFolders = files(jsBundleDir).builtBy(currentBundleTask)
  91. variant.registerGeneratedResFolders(currentBundleTask.generatedResFolders)
  92. def mergeAssetsTask = variant.mergeAssetsProvider.get()
  93. def mergeResourcesTask = variant.mergeResourcesProvider.get()
  94. mergeAssetsTask.dependsOn(currentBundleTask)
  95. mergeResourcesTask.dependsOn(currentBundleTask)
  96. mergeAssetsTask.doLast {
  97. def assetsDir = mergeAssetsTask.outputDir
  98. // Bundle fonts
  99. //
  100. copy {
  101. from("${projectDir}/../../fonts/jitsi.ttf")
  102. into("${assetsDir}/fonts")
  103. }
  104. // Bundle sounds
  105. //
  106. copy {
  107. from("${projectDir}/../../sounds/incomingMessage.wav")
  108. from("${projectDir}/../../sounds/joined.wav")
  109. from("${projectDir}/../../sounds/left.wav")
  110. from("${projectDir}/../../sounds/outgoingRinging.wav")
  111. from("${projectDir}/../../sounds/outgoingStart.wav")
  112. from("${projectDir}/../../sounds/recordingOn.mp3")
  113. from("${projectDir}/../../sounds/recordingOff.mp3")
  114. from("${projectDir}/../../sounds/rejected.wav")
  115. into("${assetsDir}/sounds")
  116. }
  117. // Copy React assets
  118. //
  119. if (currentBundleTask.enabled) {
  120. copy {
  121. from(jsBundleFile)
  122. into(assetsDir)
  123. }
  124. }
  125. }
  126. mergeResourcesTask.doLast {
  127. // Copy React resources
  128. //
  129. if (currentBundleTask.enabled) {
  130. copy {
  131. from(resourcesDir)
  132. into(mergeResourcesTask.outputDir)
  133. }
  134. }
  135. }
  136. }
  137. publishing {
  138. publications {
  139. aarArchive(MavenPublication) {
  140. groupId 'org.jitsi.react'
  141. artifactId 'jitsi-meet-sdk'
  142. version project.sdkVersion
  143. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  144. extension "aar"
  145. }
  146. pom.withXml {
  147. def pomXml = asNode()
  148. pomXml.appendNode('name', 'jitsi-meet-sdk')
  149. pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
  150. def dependencies = pomXml.appendNode('dependencies')
  151. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  152. // The (third-party) React Native modules that we depend on
  153. // are in source code form and do not have groupId. That is
  154. // why we have a dedicated groupId for them. But the other
  155. // dependencies come through Maven and, consequently, have
  156. // groupId.
  157. def groupId = it.moduleGroup
  158. def artifactId = it.moduleName
  159. if (artifactId.startsWith('react-native-')
  160. && groupId.equals('jitsi-meet')) {
  161. groupId = rootProject.ext.moduleGroupId
  162. }
  163. def dependency = dependencies.appendNode('dependency')
  164. dependency.appendNode('groupId', groupId)
  165. dependency.appendNode('artifactId', artifactId)
  166. dependency.appendNode('version', it.moduleVersion)
  167. }
  168. }
  169. }
  170. }
  171. repositories {
  172. maven { url "file:${rootProject.projectDir}/../../jitsi-maven-repository/releases" }
  173. }
  174. }