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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. apply plugin: 'com.android.library'
  2. apply plugin: 'maven-publish'
  3. android {
  4. compileSdkVersion rootProject.ext.compileSdkVersion
  5. ndkVersion rootProject.ext.ndkVersion
  6. defaultConfig {
  7. minSdkVersion rootProject.ext.minSdkVersion
  8. targetSdkVersion rootProject.ext.targetSdkVersion
  9. buildConfigField "String", "SDK_VERSION", "\"$sdkVersion\""
  10. }
  11. buildTypes {
  12. debug {
  13. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  14. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${rootProject.ext.googleServicesEnabled}"
  15. }
  16. release {
  17. minifyEnabled false
  18. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  19. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  20. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${rootProject.ext.googleServicesEnabled}"
  21. }
  22. }
  23. sourceSets {
  24. main {
  25. java {
  26. exclude "test/"
  27. }
  28. }
  29. }
  30. namespace 'org.jitsi.meet.sdk'
  31. }
  32. dependencies {
  33. implementation fileTree(dir: 'libs', include: ['*.jar'])
  34. implementation 'androidx.appcompat:appcompat:1.4.1'
  35. implementation 'androidx.fragment:fragment:1.4.1'
  36. implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
  37. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  38. api "com.facebook.react:react-android:$rootProject.ext.rnVersion"
  39. api "com.facebook.react:hermes-android:$rootProject.ext.hermesVersion"
  40. //noinspection GradleDynamicVersion
  41. implementation 'org.webkit:android-jsc:+'
  42. implementation 'com.facebook.fresco:animated-gif:2.5.0'
  43. implementation 'com.dropbox.core:dropbox-core-sdk:4.0.1'
  44. implementation 'com.jakewharton.timber:timber:5.0.1'
  45. implementation 'com.squareup.duktape:duktape-android:1.3.0'
  46. implementation 'com.google.code.gson:gson:2.8.6'
  47. implementation 'androidx.startup:startup-runtime:1.1.0'
  48. // Only add these packages if we are NOT doing a LIBRE_BUILD
  49. if (!rootProject.ext.libreBuild) {
  50. implementation project(':react-native-amplitude')
  51. implementation project(':react-native-giphy')
  52. implementation(project(':react-native-google-signin')) {
  53. exclude group: 'com.google.android.gms'
  54. exclude group: 'androidx'
  55. }
  56. }
  57. implementation project(':react-native-async-storage')
  58. implementation project(':react-native-background-timer')
  59. implementation project(':react-native-calendar-events')
  60. implementation project(':react-native-community_clipboard')
  61. implementation project(':react-native-community_netinfo')
  62. implementation project(':react-native-default-preference')
  63. implementation(project(':react-native-device-info')) {
  64. exclude group: 'com.google.firebase'
  65. exclude group: 'com.google.android.gms'
  66. exclude group: 'com.android.installreferrer'
  67. }
  68. implementation project(':react-native-gesture-handler')
  69. implementation project(':react-native-get-random-values')
  70. implementation project(':react-native-immersive-mode')
  71. implementation project(':react-native-keep-awake')
  72. implementation project(':react-native-orientation-locker')
  73. implementation project(':react-native-pager-view')
  74. implementation project(':react-native-performance')
  75. implementation project(':react-native-safe-area-context')
  76. implementation project(':react-native-screens')
  77. implementation project(':react-native-slider')
  78. implementation project(':react-native-sound')
  79. implementation project(':react-native-splash-screen')
  80. implementation project(':react-native-svg')
  81. implementation project(':react-native-video')
  82. implementation project(':react-native-webrtc')
  83. implementation project(':react-native-webview')
  84. testImplementation 'junit:junit:4.12'
  85. }
  86. // Here we bundle all assets, resources and React files. We cannot use the
  87. // react.gradle file provided by react-native because it's designed to be used
  88. // in an application (it taps into applicationVariants, but the SDK is a library
  89. // so we need libraryVariants instead).
  90. android.libraryVariants.all { def variant ->
  91. // Create variant and target names
  92. def targetName = variant.name.capitalize()
  93. def targetPath = variant.dirName
  94. // React js bundle directories
  95. def jsBundleDir = file("$buildDir/generated/assets/react/${targetPath}")
  96. def resourcesDir = file("$buildDir/generated/res/react/${targetPath}")
  97. def jsBundleFile = file("$jsBundleDir/index.android.bundle")
  98. def currentBundleTask = tasks.create(
  99. name: "bundle${targetName}JsAndAssets",
  100. type: Exec) {
  101. group = "react"
  102. description = "bundle JS and assets for ${targetName}."
  103. // Create dirs if they are not there (e.g. the "clean" task just ran)
  104. doFirst {
  105. jsBundleDir.deleteDir()
  106. jsBundleDir.mkdirs()
  107. resourcesDir.deleteDir()
  108. resourcesDir.mkdirs()
  109. }
  110. // Set up inputs and outputs so gradle can cache the result
  111. def reactRoot = file("${projectDir}/../../")
  112. inputs.files fileTree(dir: reactRoot, excludes: ["android/**", "ios/**"])
  113. outputs.dir jsBundleDir
  114. outputs.dir resourcesDir
  115. // Set up the call to the react-native cli
  116. workingDir reactRoot
  117. // Set up dev mode
  118. def devEnabled = !targetName.toLowerCase().contains("release")
  119. // Run the bundler
  120. commandLine(
  121. "node",
  122. "node_modules/react-native/scripts/bundle.js",
  123. "--platform", "android",
  124. "--dev", "${devEnabled}",
  125. "--reset-cache",
  126. "--entry-file", "index.android.js",
  127. "--bundle-output", jsBundleFile,
  128. "--assets-dest", resourcesDir)
  129. // Disable bundling on dev builds
  130. enabled !devEnabled
  131. }
  132. currentBundleTask.ext.generatedResFolders = files(resourcesDir).builtBy(currentBundleTask)
  133. currentBundleTask.ext.generatedAssetsFolders = files(jsBundleDir).builtBy(currentBundleTask)
  134. variant.registerGeneratedResFolders(currentBundleTask.generatedResFolders)
  135. def mergeAssetsTask = variant.mergeAssetsProvider.get()
  136. def mergeResourcesTask = variant.mergeResourcesProvider.get()
  137. mergeAssetsTask.dependsOn(currentBundleTask)
  138. mergeResourcesTask.dependsOn(currentBundleTask)
  139. mergeAssetsTask.doLast {
  140. def assetsDir = mergeAssetsTask.outputDir.get()
  141. // Bundle sounds
  142. //
  143. copy {
  144. from("${projectDir}/../../sounds")
  145. include("*.wav")
  146. include("*.mp3")
  147. into("${assetsDir}/sounds")
  148. }
  149. // Copy React assets
  150. //
  151. if (currentBundleTask.enabled) {
  152. copy {
  153. from(jsBundleFile)
  154. into(assetsDir)
  155. }
  156. }
  157. }
  158. mergeResourcesTask.doLast {
  159. // Copy React resources
  160. //
  161. if (currentBundleTask.enabled) {
  162. copy {
  163. from(resourcesDir)
  164. into(mergeResourcesTask.outputDir.get())
  165. }
  166. }
  167. }
  168. }
  169. publishing {
  170. publications {
  171. aarArchive(MavenPublication) {
  172. groupId 'org.jitsi.react'
  173. artifactId 'jitsi-meet-sdk'
  174. version System.env.OVERRIDE_SDK_VERSION ?: project.sdkVersion
  175. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  176. extension "aar"
  177. }
  178. pom.withXml {
  179. def pomXml = asNode()
  180. pomXml.appendNode('name', 'jitsi-meet-sdk')
  181. pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
  182. def dependencies = pomXml.appendNode('dependencies')
  183. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  184. // The (third-party) React Native modules that we depend on
  185. // are in source code form and do not have groupId. That is
  186. // why we have a dedicated groupId for them. But the other
  187. // dependencies come through Maven and, consequently, have
  188. // groupId.
  189. def groupId = it.moduleGroup
  190. def artifactId = it.moduleName
  191. if (artifactId.startsWith('react-native-')) {
  192. groupId = rootProject.ext.moduleGroupId
  193. }
  194. def dependency = dependencies.appendNode('dependency')
  195. dependency.appendNode('groupId', groupId)
  196. dependency.appendNode('artifactId', artifactId)
  197. dependency.appendNode('version', it.moduleVersion)
  198. }
  199. }
  200. }
  201. }
  202. repositories {
  203. maven {
  204. url rootProject.ext.mavenRepo
  205. if (!rootProject.ext.mavenRepo.startsWith("file")) {
  206. credentials {
  207. username rootProject.ext.mavenUser
  208. password rootProject.ext.mavenPassword
  209. }
  210. }
  211. }
  212. }
  213. }