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

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