Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

build.gradle 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  12. }
  13. release {
  14. minifyEnabled false
  15. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  16. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  17. }
  18. }
  19. sourceSets {
  20. main {
  21. java {
  22. if (rootProject.ext.libreBuild) {
  23. srcDir "src"
  24. exclude "**/AmplitudeModule.java"
  25. }
  26. exclude "test/"
  27. }
  28. }
  29. }
  30. }
  31. dependencies {
  32. implementation fileTree(dir: 'libs', include: ['*.jar'])
  33. implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  34. implementation 'androidx.appcompat:appcompat:1.1.0'
  35. implementation 'androidx.fragment:fragment:1.1.0'
  36. //noinspection GradleDynamicVersion
  37. api 'com.facebook.react:react-native:+'
  38. // Hermes JS engine
  39. def hermesPath = "../../node_modules/hermes-engine/android/"
  40. debugImplementation files(hermesPath + "hermes-debug.aar")
  41. releaseImplementation files(hermesPath + "hermes-release.aar")
  42. implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
  43. implementation 'com.jakewharton.timber:timber:4.7.1'
  44. implementation 'com.squareup.duktape:duktape-android:1.3.0'
  45. if (!rootProject.ext.libreBuild) {
  46. implementation 'com.amplitude:android-sdk:2.14.1'
  47. implementation(project(":react-native-google-signin")) {
  48. exclude group: 'com.google.android.gms'
  49. exclude group: 'androidx'
  50. }
  51. }
  52. implementation project(':react-native-background-timer')
  53. implementation project(':react-native-calendar-events')
  54. implementation project(':react-native-community-async-storage')
  55. implementation project(':react-native-community_netinfo')
  56. implementation project(':react-native-immersive')
  57. implementation project(':react-native-keep-awake')
  58. implementation project(':react-native-linear-gradient')
  59. implementation project(':react-native-sound')
  60. implementation project(':react-native-svg')
  61. implementation project(':react-native-webrtc')
  62. implementation project(':react-native-webview')
  63. testImplementation 'junit:junit:4.12'
  64. }
  65. // Here we bundle all assets, resources and React files. We cannot use the
  66. // react.gradle file provided by react-native because it's designed to be used
  67. // in an application (it taps into applicationVariants, but the SDK is a library
  68. // so we need libraryVariants instead).
  69. android.libraryVariants.all { def variant ->
  70. // Create variant and target names
  71. def targetName = variant.name.capitalize()
  72. def targetPath = variant.dirName
  73. // React js bundle directories
  74. def jsBundleDir = file("$buildDir/generated/assets/react/${targetPath}")
  75. def resourcesDir = file("$buildDir/generated/res/react/${targetPath}")
  76. def jsBundleFile = file("$jsBundleDir/index.android.bundle")
  77. def currentBundleTask = tasks.create(
  78. name: "bundle${targetName}JsAndAssets",
  79. type: Exec) {
  80. group = "react"
  81. description = "bundle JS and assets for ${targetName}."
  82. // Create dirs if they are not there (e.g. the "clean" task just ran)
  83. doFirst {
  84. jsBundleDir.deleteDir()
  85. jsBundleDir.mkdirs()
  86. resourcesDir.deleteDir()
  87. resourcesDir.mkdirs()
  88. }
  89. // Set up inputs and outputs so gradle can cache the result
  90. def reactRoot = file("${projectDir}/../../")
  91. inputs.files fileTree(dir: reactRoot, excludes: ["android/**", "ios/**"])
  92. outputs.dir jsBundleDir
  93. outputs.dir resourcesDir
  94. // Set up the call to the react-native cli
  95. workingDir reactRoot
  96. // Set up dev mode
  97. def devEnabled = !targetName.toLowerCase().contains("release")
  98. // Run the bundler
  99. commandLine(
  100. "node",
  101. "node_modules/react-native/local-cli/cli.js",
  102. "bundle",
  103. "--platform", "android",
  104. "--dev", "${devEnabled}",
  105. "--reset-cache",
  106. "--entry-file", "index.android.js",
  107. "--bundle-output", jsBundleFile,
  108. "--assets-dest", resourcesDir)
  109. // Disable bundling on dev builds
  110. enabled !devEnabled
  111. }
  112. currentBundleTask.ext.generatedResFolders = files(resourcesDir).builtBy(currentBundleTask)
  113. currentBundleTask.ext.generatedAssetsFolders = files(jsBundleDir).builtBy(currentBundleTask)
  114. variant.registerGeneratedResFolders(currentBundleTask.generatedResFolders)
  115. def mergeAssetsTask = variant.mergeAssetsProvider.get()
  116. def mergeResourcesTask = variant.mergeResourcesProvider.get()
  117. mergeAssetsTask.dependsOn(currentBundleTask)
  118. mergeResourcesTask.dependsOn(currentBundleTask)
  119. mergeAssetsTask.doLast {
  120. def assetsDir = mergeAssetsTask.outputDir
  121. // Bundle sounds
  122. //
  123. copy {
  124. from("${projectDir}/../../sounds/incomingMessage.wav")
  125. from("${projectDir}/../../sounds/joined.wav")
  126. from("${projectDir}/../../sounds/left.wav")
  127. from("${projectDir}/../../sounds/liveStreamingOn.mp3")
  128. from("${projectDir}/../../sounds/liveStreamingOff.mp3")
  129. from("${projectDir}/../../sounds/outgoingRinging.wav")
  130. from("${projectDir}/../../sounds/outgoingStart.wav")
  131. from("${projectDir}/../../sounds/recordingOn.mp3")
  132. from("${projectDir}/../../sounds/recordingOff.mp3")
  133. from("${projectDir}/../../sounds/rejected.wav")
  134. into("${assetsDir}/sounds")
  135. }
  136. // Copy React assets
  137. //
  138. if (currentBundleTask.enabled) {
  139. copy {
  140. from(jsBundleFile)
  141. into(assetsDir)
  142. }
  143. }
  144. }
  145. mergeResourcesTask.doLast {
  146. // Copy React resources
  147. //
  148. if (currentBundleTask.enabled) {
  149. copy {
  150. from(resourcesDir)
  151. into(mergeResourcesTask.outputDir)
  152. }
  153. }
  154. }
  155. }
  156. publishing {
  157. publications {
  158. aarArchive(MavenPublication) {
  159. groupId 'org.jitsi.react'
  160. artifactId 'jitsi-meet-sdk'
  161. version System.env.OVERRIDE_SDK_VERSION ?: project.sdkVersion
  162. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  163. extension "aar"
  164. }
  165. pom.withXml {
  166. def pomXml = asNode()
  167. pomXml.appendNode('name', 'jitsi-meet-sdk')
  168. pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
  169. def dependencies = pomXml.appendNode('dependencies')
  170. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  171. // The (third-party) React Native modules that we depend on
  172. // are in source code form and do not have groupId. That is
  173. // why we have a dedicated groupId for them. But the other
  174. // dependencies come through Maven and, consequently, have
  175. // groupId.
  176. def groupId = it.moduleGroup
  177. def artifactId = it.moduleName
  178. if (artifactId.startsWith('react-native-') && groupId.equals('jitsi-meet')) {
  179. groupId = rootProject.ext.moduleGroupId
  180. }
  181. def dependency = dependencies.appendNode('dependency')
  182. dependency.appendNode('groupId', groupId)
  183. dependency.appendNode('artifactId', artifactId)
  184. dependency.appendNode('version', it.moduleVersion)
  185. }
  186. }
  187. }
  188. }
  189. repositories {
  190. maven {
  191. url rootProject.ext.mavenRepo
  192. if (!rootProject.ext.mavenRepo.startsWith("file")) {
  193. credentials {
  194. username rootProject.ext.mavenUser
  195. password rootProject.ext.mavenPassword
  196. }
  197. }
  198. }
  199. }
  200. }