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

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. }
  10. buildTypes {
  11. debug {
  12. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  13. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${rootProject.ext.googleServicesEnabled}"
  14. }
  15. release {
  16. minifyEnabled false
  17. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  18. buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
  19. buildConfigField "boolean", "GOOGLE_SERVICES_ENABLED", "${rootProject.ext.googleServicesEnabled}"
  20. }
  21. }
  22. sourceSets {
  23. main {
  24. java {
  25. exclude "test/"
  26. }
  27. }
  28. }
  29. }
  30. dependencies {
  31. implementation fileTree(dir: 'libs', include: ['*.jar'])
  32. implementation 'androidx.appcompat:appcompat:1.4.1'
  33. implementation 'androidx.fragment:fragment:1.4.1'
  34. implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
  35. implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
  36. //noinspection GradleDynamicVersion
  37. api 'com.facebook.react:react-native:+'
  38. //noinspection GradleDynamicVersion
  39. implementation 'org.webkit:android-jsc:+'
  40. implementation 'com.facebook.fresco:animated-gif:2.5.0'
  41. implementation 'com.dropbox.core:dropbox-core-sdk:4.0.1'
  42. implementation 'com.jakewharton.timber:timber:4.7.1'
  43. implementation 'com.squareup.duktape:duktape-android:1.3.0'
  44. implementation 'com.google.code.gson:gson:2.8.6'
  45. implementation "androidx.startup:startup-runtime:1.1.0"
  46. if (rootProject.ext.libreBuild) {
  47. implementation(project(':react-native-device-info')) {
  48. exclude group: 'com.google.firebase'
  49. exclude group: 'com.google.android.gms'
  50. exclude group: 'com.android.installreferrer'
  51. }
  52. } else {
  53. implementation project(':react-native-amplitude')
  54. implementation project(':react-native-device-info')
  55. implementation(project(":react-native-google-signin")) {
  56. exclude group: 'com.google.android.gms'
  57. exclude group: 'androidx'
  58. }
  59. }
  60. implementation project(':react-native-async-storage')
  61. implementation project(':react-native-background-timer')
  62. implementation project(':react-native-calendar-events')
  63. implementation project(':react-native-community_clipboard')
  64. implementation project(':react-native-community_netinfo')
  65. implementation project(':react-native-default-preference')
  66. implementation project(':react-native-gesture-handler')
  67. implementation project(':react-native-get-random-values')
  68. implementation project(':react-native-giphy')
  69. implementation project(':react-native-immersive')
  70. implementation project(':react-native-keep-awake')
  71. implementation project(':react-native-masked-view_masked-view')
  72. implementation project(':react-native-pager-view')
  73. implementation project(':react-native-performance')
  74. implementation project(':react-native-reanimated')
  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/local-cli/cli.js",
  123. "bundle",
  124. "--platform", "android",
  125. "--dev", "${devEnabled}",
  126. "--reset-cache",
  127. "--entry-file", "index.android.js",
  128. "--bundle-output", jsBundleFile,
  129. "--assets-dest", resourcesDir)
  130. // Disable bundling on dev builds
  131. enabled !devEnabled
  132. }
  133. currentBundleTask.ext.generatedResFolders = files(resourcesDir).builtBy(currentBundleTask)
  134. currentBundleTask.ext.generatedAssetsFolders = files(jsBundleDir).builtBy(currentBundleTask)
  135. variant.registerGeneratedResFolders(currentBundleTask.generatedResFolders)
  136. def mergeAssetsTask = variant.mergeAssetsProvider.get()
  137. def mergeResourcesTask = variant.mergeResourcesProvider.get()
  138. mergeAssetsTask.dependsOn(currentBundleTask)
  139. mergeResourcesTask.dependsOn(currentBundleTask)
  140. mergeAssetsTask.doLast {
  141. def assetsDir = mergeAssetsTask.outputDir.get()
  142. // Bundle sounds
  143. //
  144. copy {
  145. from("${projectDir}/../../sounds")
  146. include("*.wav")
  147. include("*.mp3")
  148. into("${assetsDir}/sounds")
  149. }
  150. // Copy React assets
  151. //
  152. if (currentBundleTask.enabled) {
  153. copy {
  154. from(jsBundleFile)
  155. into(assetsDir)
  156. }
  157. }
  158. }
  159. mergeResourcesTask.doLast {
  160. // Copy React resources
  161. //
  162. if (currentBundleTask.enabled) {
  163. copy {
  164. from(resourcesDir)
  165. into(mergeResourcesTask.outputDir.get())
  166. }
  167. }
  168. }
  169. }
  170. publishing {
  171. publications {
  172. aarArchive(MavenPublication) {
  173. groupId 'org.jitsi.react'
  174. artifactId 'jitsi-meet-sdk'
  175. version System.env.OVERRIDE_SDK_VERSION ?: project.sdkVersion
  176. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  177. extension "aar"
  178. }
  179. pom.withXml {
  180. def pomXml = asNode()
  181. pomXml.appendNode('name', 'jitsi-meet-sdk')
  182. pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
  183. def dependencies = pomXml.appendNode('dependencies')
  184. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  185. // The (third-party) React Native modules that we depend on
  186. // are in source code form and do not have groupId. That is
  187. // why we have a dedicated groupId for them. But the other
  188. // dependencies come through Maven and, consequently, have
  189. // groupId.
  190. def groupId = it.moduleGroup
  191. def artifactId = it.moduleName
  192. if (artifactId.startsWith('react-native-')) {
  193. groupId = rootProject.ext.moduleGroupId
  194. }
  195. def dependency = dependencies.appendNode('dependency')
  196. dependency.appendNode('groupId', groupId)
  197. dependency.appendNode('artifactId', artifactId)
  198. dependency.appendNode('version', it.moduleVersion)
  199. }
  200. }
  201. }
  202. }
  203. repositories {
  204. maven {
  205. url rootProject.ext.mavenRepo
  206. if (!rootProject.ext.mavenRepo.startsWith("file")) {
  207. credentials {
  208. username rootProject.ext.mavenUser
  209. password rootProject.ext.mavenPassword
  210. }
  211. }
  212. }
  213. }
  214. }