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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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.dropbox.core:dropbox-core-sdk:3.0.8'
  23. api 'com.facebook.react:react-native:+'
  24. implementation project(':react-native-background-timer')
  25. implementation project(':react-native-calendar-events')
  26. implementation(project(':react-native-fast-image')) {
  27. exclude group: 'com.android.support'
  28. }
  29. implementation(project(":react-native-google-signin")) {
  30. exclude group: 'com.google.android.gms'
  31. exclude group: 'com.android.support'
  32. }
  33. implementation project(':react-native-immersive')
  34. implementation project(':react-native-keep-awake')
  35. implementation project(':react-native-linear-gradient')
  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
  95. //
  96. copy {
  97. from("${projectDir}/../../fonts/jitsi.ttf")
  98. into("${assetsDir}/fonts")
  99. }
  100. // Bundle sounds
  101. //
  102. copy {
  103. from("${projectDir}/../../sounds/joined.wav")
  104. from("${projectDir}/../../sounds/left.wav")
  105. from("${projectDir}/../../sounds/outgoingRinging.wav")
  106. from("${projectDir}/../../sounds/outgoingStart.wav")
  107. from("${projectDir}/../../sounds/recordingOn.mp3")
  108. from("${projectDir}/../../sounds/recordingOff.mp3")
  109. from("${projectDir}/../../sounds/rejected.wav")
  110. into("${assetsDir}/sounds")
  111. }
  112. // Copy React assets
  113. //
  114. if (currentBundleTask.enabled) {
  115. copy {
  116. from(jsBundleDir)
  117. into(assetsDir)
  118. }
  119. }
  120. }
  121. variant.mergeResources.doLast {
  122. // Copy React resources
  123. //
  124. if (currentBundleTask.enabled) {
  125. copy {
  126. from(resourcesDir)
  127. into(variant.mergeResources.outputDir)
  128. }
  129. }
  130. }
  131. }
  132. publishing {
  133. publications {
  134. aarArchive(MavenPublication) {
  135. groupId 'org.jitsi.react'
  136. artifactId 'jitsi-meet-sdk'
  137. version project.sdkVersion
  138. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  139. extension "aar"
  140. }
  141. pom.withXml {
  142. def pomXml = asNode()
  143. pomXml.appendNode('name', 'jitsi-meet-sdk')
  144. pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
  145. def dependencies = pomXml.appendNode('dependencies')
  146. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  147. // The (third-party) React Native modules that we depend on
  148. // are in source code form and do not have groupId. That is
  149. // why we have a dedicated groupId for them. But the other
  150. // dependencies come through Maven and, consequently, have
  151. // groupId.
  152. def groupId = it.moduleGroup
  153. def artifactId = it.moduleName
  154. if (artifactId.startsWith('react-native-')
  155. && groupId.equals('jitsi-meet')) {
  156. groupId = rootProject.ext.moduleGroupId
  157. }
  158. def dependency = dependencies.appendNode('dependency')
  159. dependency.appendNode('groupId', groupId)
  160. dependency.appendNode('artifactId', artifactId)
  161. dependency.appendNode('version', it.moduleVersion)
  162. }
  163. }
  164. }
  165. }
  166. repositories {
  167. maven { url "file:${rootProject.projectDir}/../../jitsi-maven-repository/releases" }
  168. }
  169. }