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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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. release {
  12. minifyEnabled false
  13. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  14. }
  15. }
  16. }
  17. dependencies {
  18. compile fileTree(dir: 'libs', include: ['*.jar'])
  19. compile 'com.android.support:appcompat-v7:27.0.2'
  20. compile 'com.dropbox.core:dropbox-core-sdk:3.0.8'
  21. compile 'com.facebook.react:react-native:+'
  22. compile project(':react-native-background-timer')
  23. compile project(':react-native-fast-image')
  24. compile(project(":react-native-google-signin")) {
  25. exclude group: 'com.google.android.gms'
  26. }
  27. compile project(':react-native-immersive')
  28. compile project(':react-native-keep-awake')
  29. compile project(':react-native-linear-gradient')
  30. compile project(':react-native-locale-detector')
  31. compile project(':react-native-sound')
  32. compile project(':react-native-vector-icons')
  33. compile project(':react-native-webrtc')
  34. compile project(':react-native-calendar-events')
  35. testCompile 'junit:junit:4.12'
  36. }
  37. // Build process helpers
  38. //
  39. void runBefore(String dependentTaskName, Task task) {
  40. Task dependentTask = tasks.findByPath(dependentTaskName);
  41. if (dependentTask != null) {
  42. dependentTask.dependsOn task
  43. }
  44. }
  45. gradle.projectsEvaluated {
  46. android.buildTypes.all { buildType ->
  47. def buildNameCapitalized = "${buildType.name.capitalize()}"
  48. def bundlePath = "${buildDir}/intermediates/bundles/${buildType.name}"
  49. // Bundle fonts in react-native-vector-icons.
  50. //
  51. def currentFontTask = tasks.create(
  52. name: "copy${buildNameCapitalized}Fonts",
  53. type: Copy) {
  54. from("${projectDir}/../../fonts/jitsi.ttf")
  55. from("${projectDir}/../../node_modules/react-native-vector-icons/Fonts/")
  56. into("${bundlePath}/assets/fonts")
  57. }
  58. currentFontTask.dependsOn("merge${buildNameCapitalized}Resources")
  59. currentFontTask.dependsOn("merge${buildNameCapitalized}Assets")
  60. runBefore("processArmeabi-v7a${buildNameCapitalized}Resources", currentFontTask)
  61. runBefore("processX86${buildNameCapitalized}Resources", currentFontTask)
  62. runBefore("processUniversal${buildNameCapitalized}Resources", currentFontTask)
  63. runBefore("process${buildNameCapitalized}Resources", currentFontTask)
  64. def currentSoundsTask = tasks.create(
  65. name: "copy${buildNameCapitalized}Sounds",
  66. type: Copy) {
  67. from("${projectDir}/../../sounds/joined.wav")
  68. from("${projectDir}/../../sounds/left.wav")
  69. from("${projectDir}/../../sounds/outgoingRinging.wav")
  70. from("${projectDir}/../../sounds/outgoingStart.wav")
  71. from("${projectDir}/../../sounds/recordingOn.mp3")
  72. from("${projectDir}/../../sounds/recordingOff.mp3")
  73. from("${projectDir}/../../sounds/rejected.wav")
  74. into("${bundlePath}/assets/sounds")
  75. }
  76. currentSoundsTask.dependsOn("merge${buildNameCapitalized}Resources")
  77. currentSoundsTask.dependsOn("merge${buildNameCapitalized}Assets")
  78. runBefore("processArmeabi-v7a${buildNameCapitalized}Resources", currentSoundsTask)
  79. runBefore("processX86${buildNameCapitalized}Resources", currentSoundsTask)
  80. runBefore("processUniversal${buildNameCapitalized}Resources", currentSoundsTask)
  81. runBefore("process${buildNameCapitalized}Resources", currentSoundsTask)
  82. // Bundle JavaScript and React resources.
  83. // (adapted from react-native/react.gradle)
  84. //
  85. // React JS bundle directories
  86. def jsBundleDir = file("${bundlePath}/assets")
  87. def resourcesDir = file("${bundlePath}/res/merged")
  88. def jsBundleFile = file("${jsBundleDir}/index.android.bundle")
  89. // Bundle task name for variant.
  90. def bundleJsAndAssetsTaskName = "bundle${buildNameCapitalized}JsAndAssets"
  91. def currentBundleTask = tasks.create(
  92. name: bundleJsAndAssetsTaskName,
  93. type: Exec) {
  94. // Set up inputs and outputs so gradle can cache the result.
  95. def reactRoot = file("${projectDir}/../../")
  96. inputs.files fileTree(dir: reactRoot, excludes: ['android/**', 'ios/**'])
  97. outputs.dir jsBundleDir
  98. outputs.dir resourcesDir
  99. // Set up the call to the react-native cli.
  100. workingDir reactRoot
  101. // Create JS bundle
  102. def devEnabled = !buildNameCapitalized.toLowerCase().contains('release')
  103. commandLine(
  104. 'node',
  105. 'node_modules/react-native/local-cli/cli.js',
  106. 'bundle',
  107. '--assets-dest', resourcesDir,
  108. '--bundle-output', jsBundleFile,
  109. '--dev', "${devEnabled}",
  110. '--entry-file', 'index.android.js',
  111. '--platform', 'android',
  112. '--reset-cache')
  113. // Disable bundling on dev builds
  114. enabled !devEnabled
  115. }
  116. // Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
  117. currentBundleTask.dependsOn("merge${buildNameCapitalized}Resources")
  118. currentBundleTask.dependsOn("merge${buildNameCapitalized}Assets")
  119. runBefore("processArmeabi-v7a${buildNameCapitalized}Resources", currentBundleTask)
  120. runBefore("processX86${buildNameCapitalized}Resources", currentBundleTask)
  121. runBefore("processUniversal${buildNameCapitalized}Resources", currentBundleTask)
  122. runBefore("process${buildNameCapitalized}Resources", currentBundleTask)
  123. }
  124. }
  125. publishing {
  126. publications {
  127. aarArchive(MavenPublication) {
  128. groupId 'org.jitsi.react'
  129. artifactId 'jitsi-meet-sdk'
  130. version '1.9.0'
  131. artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
  132. extension "aar"
  133. }
  134. pom.withXml {
  135. def pomXml = asNode()
  136. pomXml.appendNode('name', 'jitsi-meet-sdk')
  137. pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
  138. def dependencies = pomXml.appendNode('dependencies')
  139. configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
  140. // The (third-party) React Native modules that we depend on
  141. // are in source code form and do not have groupId. That is
  142. // why we have a dedicated groupId for them. But the other
  143. // dependencies come through Maven and, consequently, have
  144. // groupId.
  145. def groupId = it.moduleGroup
  146. def artifactId = it.moduleName
  147. if (artifactId.startsWith('react-native-')
  148. && groupId.equals('jitsi-meet')) {
  149. groupId = rootProject.ext.moduleGroupId
  150. }
  151. def dependency = dependencies.appendNode('dependency')
  152. dependency.appendNode('groupId', groupId)
  153. dependency.appendNode('artifactId', artifactId)
  154. dependency.appendNode('version', it.moduleVersion)
  155. }
  156. }
  157. }
  158. }
  159. repositories {
  160. maven { url "file:${rootProject.projectDir}/../../../jitsi/jitsi-maven-repository/releases" }
  161. }
  162. }