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

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