Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

build.gradle 8.7KB

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