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

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