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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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.0.1'
  10. // NOTE: Do not place your application dependencies here; they belong
  11. // in the individual module build.gradle files.
  12. }
  13. }
  14. allprojects {
  15. repositories {
  16. google()
  17. jcenter()
  18. // React Native (JS, Obj-C sources, Android binaries) is installed from
  19. // npm.
  20. maven { url "$rootDir/../node_modules/react-native/android" }
  21. }
  22. // Third-party react-native modules which Jitsi Meet SDK for Android depends
  23. // on and which are not available in third-party Maven repositories need to
  24. // be deployed in a Maven repository of ours.
  25. //
  26. if (project.name.startsWith('react-native-')) {
  27. apply plugin: 'maven-publish'
  28. publishing {
  29. publications {}
  30. repositories {
  31. maven { url "file:${rootProject.projectDir}/../../../jitsi/jitsi-maven-repository/releases" }
  32. }
  33. }
  34. }
  35. afterEvaluate { project ->
  36. if (project.name.startsWith('react-native-')) {
  37. def npmManifest = project.file('../package.json')
  38. def json = new groovy.json.JsonSlurper().parseText(npmManifest.text)
  39. // React Native modules have an npm peer dependency on react-native,
  40. // they do not have an npm dependency on it. Further below though we
  41. // choose a react-native version (range) when we represent them as
  42. // Maven artifacts. Effectively, we are forking the projects by not
  43. // complying with the full range of their npm peer dependency and,
  44. // consequently, we should qualify their version.
  45. def versionQualifier = '-jitsi-1'
  46. if ('react-native-webrtc'.equals(project.name))
  47. versionQualifier = '-jitsi-1'
  48. project.version = "${json.version}${versionQualifier}"
  49. project.android {
  50. compileSdkVersion rootProject.ext.compileSdkVersion
  51. if (rootProject.ext.has('buildToolsVersion')) {
  52. buildToolsVersion rootProject.ext.buildToolsVersion
  53. }
  54. defaultConfig {
  55. minSdkVersion rootProject.ext.minSdkVersion
  56. targetSdkVersion rootProject.ext.targetSdkVersion
  57. }
  58. }
  59. task androidJavadocs(type: Javadoc) {
  60. source = android.sourceSets.main.java.source
  61. classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
  62. failOnError false
  63. }
  64. task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
  65. classifier = 'javadoc'
  66. from androidJavadocs.destinationDir
  67. }
  68. task androidSourcesJar(type: Jar) {
  69. classifier = 'sources'
  70. from android.sourceSets.main.java.source
  71. }
  72. publishing.publications {
  73. aarArchive(MavenPublication) {
  74. groupId rootProject.ext.moduleGroupId
  75. artifactId project.name
  76. version project.version
  77. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  78. extension "aar"
  79. }
  80. artifact(androidSourcesJar)
  81. artifact(androidJavadocsJar)
  82. pom.withXml {
  83. def pomXml = asNode()
  84. pomXml.appendNode('name', project.name)
  85. pomXml.appendNode('description', json.description)
  86. pomXml.appendNode('url', json.homepage)
  87. if (json.license) {
  88. def license = pomXml.appendNode('licenses').appendNode('license')
  89. license.appendNode('name', json.license)
  90. license.appendNode('distribution', 'repo')
  91. }
  92. def dependencies = pomXml.appendNode('dependencies')
  93. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  94. def artifactId = it.moduleName
  95. def version = it.moduleVersion
  96. // React Native signals breaking changes by
  97. // increasing the minor version number. So the
  98. // (third-party) React Native modules we utilize can
  99. // depend not on a specific react-native release but
  100. // a wider range.
  101. if (artifactId.equals('react-native')) {
  102. def versionNumber = VersionNumber.parse(version)
  103. version = "${versionNumber.major}.${versionNumber.minor}"
  104. }
  105. def dependency = dependencies.appendNode('dependency')
  106. dependency.appendNode('groupId', it.moduleGroup)
  107. dependency.appendNode('artifactId', artifactId)
  108. dependency.appendNode('version', version)
  109. }
  110. }
  111. }
  112. }
  113. }
  114. }
  115. }
  116. ext {
  117. buildToolsVersion = "26.0.2"
  118. compileSdkVersion = 26
  119. minSdkVersion = 16
  120. targetSdkVersion = 26
  121. // The Maven artifact groupdId of the third-party react-native modules which
  122. // Jitsi Meet SDK for Android depends on and which are not available in
  123. // third-party Maven repositories so we have to deploy to a Maven repository
  124. // of ours.
  125. moduleGroupId = 'com.facebook.react'
  126. }
  127. // Force the version of the Android build tools we have chosen on all
  128. // subprojects. The forcing was introduced for react-native and the third-party
  129. // modules that we utilize such as react-native-background-timer.
  130. subprojects { subproject ->
  131. afterEvaluate{
  132. if ((subproject.plugins.hasPlugin('android')
  133. || subproject.plugins.hasPlugin('android-library'))
  134. && rootProject.ext.has('buildToolsVersion')) {
  135. android {
  136. buildToolsVersion rootProject.ext.buildToolsVersion
  137. }
  138. }
  139. }
  140. }