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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. // Top-level build file where you can add configuration options common to all
  2. // sub-projects/modules.
  3. buildscript {
  4. repositories {
  5. google()
  6. jcenter()
  7. }
  8. dependencies {
  9. classpath 'com.android.tools.build:gradle:3.1.4'
  10. classpath 'com.google.gms:google-services:3.2.1'
  11. // NOTE: Do not place your application dependencies here; they belong
  12. // in the individual module build.gradle files.
  13. }
  14. }
  15. allprojects {
  16. repositories {
  17. maven { url "https://maven.google.com" }
  18. google()
  19. jcenter()
  20. maven { url "$rootDir/../node_modules/jsc-android/dist" }
  21. // React Native (JS, Obj-C sources, Android binaries) is installed from
  22. // npm.
  23. maven { url "$rootDir/../node_modules/react-native/android" }
  24. }
  25. // Make sure we use the react-native version in node_modules and not the one
  26. // published in jcenter / elsewhere.
  27. configurations.all {
  28. resolutionStrategy {
  29. eachDependency { DependencyResolveDetails details ->
  30. if (details.requested.group == 'com.facebook.react'
  31. && details.requested.name == 'react-native') {
  32. def file = new File("$rootDir/../node_modules/react-native/package.json")
  33. def version = new groovy.json.JsonSlurper().parseText(file.text).version
  34. details.useVersion version
  35. }
  36. if (details.requested.group == 'org.webkit'
  37. && details.requested.name == 'android-jsc') {
  38. def file = new File("$rootDir/../node_modules/jsc-android/package.json")
  39. def version = new groovy.json.JsonSlurper().parseText(file.text).version
  40. details.useVersion "r${version.tokenize('.')[0]}"
  41. }
  42. }
  43. }
  44. }
  45. // Third-party react-native modules which Jitsi Meet SDK for Android depends
  46. // on and which are not available in third-party Maven repositories need to
  47. // be deployed in a Maven repository of ours.
  48. //
  49. if (project.name.startsWith('react-native-')) {
  50. apply plugin: 'maven-publish'
  51. publishing {
  52. publications {}
  53. repositories {
  54. maven { url "file:${rootProject.projectDir}/../../jitsi-maven-repository/releases" }
  55. }
  56. }
  57. }
  58. afterEvaluate { project ->
  59. if (project.name.startsWith('react-native-')) {
  60. def npmManifest = project.file('../package.json')
  61. def json = new groovy.json.JsonSlurper().parseText(npmManifest.text)
  62. // React Native modules have an npm peer dependency on react-native,
  63. // they do not have an npm dependency on it. Further below though we
  64. // choose a react-native version (range) when we represent them as
  65. // Maven artifacts. Effectively, we are forking the projects by not
  66. // complying with the full range of their npm peer dependency and,
  67. // consequently, we should qualify their version.
  68. def versionQualifier = '-jitsi-1'
  69. if ('react-native-background-timer' == project.name)
  70. versionQualifier = '-jitsi-3' // 2.0.0 + react-native 0.57
  71. else if ('react-native-calendar-events' == project.name)
  72. versionQualifier = '-jitsi-1' // 056807286da610d884fb6b4c8ca187a767b261f7 + react-native 0.57
  73. else if ('react-native-fast-image' == project.name)
  74. versionQualifier = '-jitsi-1' // 1f8c93a5584869848d75cc9b946beb9688efe285 + react-native 0.57
  75. else if ('react-native-google-signin' == project.name)
  76. versionQualifier = '-jitsi-1' // 1.0.0-rc6 + react-native 0.57
  77. else if ('react-native-immersive' == project.name)
  78. versionQualifier = '-jitsi-4' // 1.1.0 + react-native 0.57
  79. else if ('react-native-keep-awake' == project.name)
  80. versionQualifier = '-jitsi-3' // 2.0.6 + react-native 0.57
  81. else if ('react-native-linear-gradient' == project.name)
  82. versionQualifier = '-jitsi-1' // 2.4.0 + react-native 0.57
  83. else if ('react-native-sound' == project.name)
  84. versionQualifier = '-jitsi-2' // 0.10.9 + react-native 0.57
  85. else if ('react-native-vector-icons' == project.name)
  86. versionQualifier = '-jitsi-3' // 6.0.2 + react-native 0.57
  87. else if ('react-native-webrtc' == project.name)
  88. versionQualifier = '-jitsi-9' // 6322a9b5a38ce590cfaea4041072ea87c8dbf558 + react-native 0.57
  89. project.version = "${json.version}${versionQualifier}"
  90. project.android {
  91. compileSdkVersion rootProject.ext.compileSdkVersion
  92. if (rootProject.ext.has('buildToolsVersion')) {
  93. buildToolsVersion rootProject.ext.buildToolsVersion
  94. }
  95. defaultConfig {
  96. minSdkVersion rootProject.ext.minSdkVersion
  97. targetSdkVersion rootProject.ext.targetSdkVersion
  98. }
  99. }
  100. task androidJavadocs(type: Javadoc) {
  101. source = android.sourceSets.main.java.source
  102. classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  103. failOnError false
  104. }
  105. task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
  106. classifier = 'javadoc'
  107. from androidJavadocs.destinationDir
  108. }
  109. task androidSourcesJar(type: Jar) {
  110. classifier = 'sources'
  111. from android.sourceSets.main.java.source
  112. }
  113. publishing.publications {
  114. aarArchive(MavenPublication) {
  115. groupId rootProject.ext.moduleGroupId
  116. artifactId project.name
  117. version project.version
  118. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  119. extension "aar"
  120. }
  121. artifact(androidSourcesJar)
  122. artifact(androidJavadocsJar)
  123. pom.withXml {
  124. def pomXml = asNode()
  125. pomXml.appendNode('name', project.name)
  126. pomXml.appendNode('description', json.description)
  127. pomXml.appendNode('url', json.homepage)
  128. if (json.license) {
  129. def license = pomXml.appendNode('licenses').appendNode('license')
  130. license.appendNode('name', json.license)
  131. license.appendNode('distribution', 'repo')
  132. }
  133. def dependencies = pomXml.appendNode('dependencies')
  134. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  135. def artifactId = it.moduleName
  136. def version = it.moduleVersion
  137. // React Native signals breaking changes by
  138. // increasing the minor version number. So the
  139. // (third-party) React Native modules we utilize can
  140. // depend not on a specific react-native release but
  141. // a wider range.
  142. if (artifactId == 'react-native') {
  143. def versionNumber = VersionNumber.parse(version)
  144. version = "${versionNumber.major}.${versionNumber.minor}"
  145. }
  146. def dependency = dependencies.appendNode('dependency')
  147. dependency.appendNode('groupId', it.moduleGroup)
  148. dependency.appendNode('artifactId', artifactId)
  149. dependency.appendNode('version', version)
  150. }
  151. }
  152. }
  153. }
  154. }
  155. }
  156. }
  157. ext {
  158. buildToolsVersion = "27.0.3"
  159. compileSdkVersion = 27
  160. minSdkVersion = 21
  161. targetSdkVersion = 26
  162. supportLibVersion = "27.1.1"
  163. // The Maven artifact groupdId of the third-party react-native modules which
  164. // Jitsi Meet SDK for Android depends on and which are not available in
  165. // third-party Maven repositories so we have to deploy to a Maven repository
  166. // of ours.
  167. moduleGroupId = 'com.facebook.react'
  168. }
  169. // Force the version of the Android build tools we have chosen on all
  170. // subprojects. The forcing was introduced for react-native and the third-party
  171. // modules that we utilize such as react-native-background-timer.
  172. subprojects { subproject ->
  173. afterEvaluate{
  174. if ((subproject.plugins.hasPlugin('android')
  175. || subproject.plugins.hasPlugin('android-library'))
  176. && rootProject.ext.has('buildToolsVersion')) {
  177. android {
  178. buildToolsVersion rootProject.ext.buildToolsVersion
  179. }
  180. }
  181. }
  182. }
  183. task wrapper(type: Wrapper) {
  184. gradleVersion = '4.4'
  185. distributionUrl = distributionUrl.replace("bin", "all")
  186. }