123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- apply plugin: 'com.android.library'
- apply plugin: 'maven-publish'
-
- android {
- compileSdkVersion rootProject.ext.compileSdkVersion
-
- defaultConfig {
- minSdkVersion rootProject.ext.minSdkVersion
- targetSdkVersion rootProject.ext.targetSdkVersion
- }
-
- buildTypes {
- debug {
- buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
- }
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- buildConfigField "boolean", "LIBRE_BUILD", "${rootProject.ext.libreBuild}"
- }
- }
-
- sourceSets {
- main {
- java {
- if (rootProject.ext.libreBuild) {
- srcDir "src"
- exclude "**/AmplitudeModule.java"
- }
- exclude "test/"
- }
- }
- }
- }
-
- dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
-
- implementation 'androidx.legacy:legacy-support-v4:1.0.0'
- implementation 'androidx.appcompat:appcompat:1.0.2'
- implementation 'androidx.fragment:fragment:1.0.0'
-
- api 'com.facebook.react:react-native:+'
- implementation 'org.webkit:android-jsc:+'
-
- implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
- implementation 'com.jakewharton.timber:timber:4.7.1'
-
- if (!rootProject.ext.libreBuild) {
- implementation 'com.amplitude:android-sdk:2.14.1'
- implementation(project(":react-native-google-signin")) {
- exclude group: 'com.google.android.gms'
- exclude group: 'androidx'
- }
- }
-
- implementation project(':react-native-background-timer')
- implementation project(':react-native-calendar-events')
- implementation project(':react-native-community-async-storage')
- implementation project(':react-native-community_netinfo')
- implementation project(':react-native-immersive')
- implementation project(':react-native-keep-awake')
- implementation project(':react-native-linear-gradient')
- implementation project(':react-native-sound')
- implementation project(':react-native-svg')
- implementation project(':react-native-webrtc')
- implementation project(':react-native-webview')
-
- testImplementation 'junit:junit:4.12'
- }
-
-
- // Here we bundle all assets, resources and React files. We cannot use the
- // react.gradle file provided by react-native because it's designed to be used
- // in an application (it taps into applicationVariants, but the SDK is a library
- // so we need libraryVariants instead).
- android.libraryVariants.all { def variant ->
- // Create variant and target names
- def targetName = variant.name.capitalize()
- def targetPath = variant.dirName
-
- // React js bundle directories
- def jsBundleDir = file("$buildDir/generated/assets/react/${targetPath}")
- def resourcesDir = file("$buildDir/generated/res/react/${targetPath}")
-
- def jsBundleFile = file("$jsBundleDir/index.android.bundle")
-
- def currentBundleTask = tasks.create(
- name: "bundle${targetName}JsAndAssets",
- type: Exec) {
- group = "react"
- description = "bundle JS and assets for ${targetName}."
-
- // Create dirs if they are not there (e.g. the "clean" task just ran)
- doFirst {
- jsBundleDir.deleteDir()
- jsBundleDir.mkdirs()
- resourcesDir.deleteDir()
- resourcesDir.mkdirs()
- }
-
- // Set up inputs and outputs so gradle can cache the result
- def reactRoot = file("${projectDir}/../../")
- inputs.files fileTree(dir: reactRoot, excludes: ["android/**", "ios/**"])
- outputs.dir jsBundleDir
- outputs.dir resourcesDir
-
- // Set up the call to the react-native cli
- workingDir reactRoot
-
- // Set up dev mode
- def devEnabled = !targetName.toLowerCase().contains("release")
-
- // Run the bundler
- commandLine(
- "node",
- "node_modules/react-native/local-cli/cli.js",
- "bundle",
- "--platform", "android",
- "--dev", "${devEnabled}",
- "--reset-cache",
- "--entry-file", "index.android.js",
- "--bundle-output", jsBundleFile,
- "--assets-dest", resourcesDir)
-
- // Disable bundling on dev builds
- enabled !devEnabled
- }
-
- currentBundleTask.ext.generatedResFolders = files(resourcesDir).builtBy(currentBundleTask)
- currentBundleTask.ext.generatedAssetsFolders = files(jsBundleDir).builtBy(currentBundleTask)
- variant.registerGeneratedResFolders(currentBundleTask.generatedResFolders)
-
- def mergeAssetsTask = variant.mergeAssetsProvider.get()
- def mergeResourcesTask = variant.mergeResourcesProvider.get()
-
- mergeAssetsTask.dependsOn(currentBundleTask)
- mergeResourcesTask.dependsOn(currentBundleTask)
-
- mergeAssetsTask.doLast {
- def assetsDir = mergeAssetsTask.outputDir
-
- // Bundle sounds
- //
- copy {
- from("${projectDir}/../../sounds/incomingMessage.wav")
- from("${projectDir}/../../sounds/joined.wav")
- from("${projectDir}/../../sounds/left.wav")
- from("${projectDir}/../../sounds/liveStreamingOn.mp3")
- from("${projectDir}/../../sounds/liveStreamingOff.mp3")
- from("${projectDir}/../../sounds/outgoingRinging.wav")
- from("${projectDir}/../../sounds/outgoingStart.wav")
- from("${projectDir}/../../sounds/recordingOn.mp3")
- from("${projectDir}/../../sounds/recordingOff.mp3")
- from("${projectDir}/../../sounds/rejected.wav")
- into("${assetsDir}/sounds")
- }
-
- // Copy React assets
- //
- if (currentBundleTask.enabled) {
- copy {
- from(jsBundleFile)
- into(assetsDir)
- }
- }
- }
-
- mergeResourcesTask.doLast {
- // Copy React resources
- //
- if (currentBundleTask.enabled) {
- copy {
- from(resourcesDir)
- into(mergeResourcesTask.outputDir)
- }
- }
- }
- }
-
-
- publishing {
- publications {
- aarArchive(MavenPublication) {
- groupId 'org.jitsi.react'
- artifactId 'jitsi-meet-sdk'
- version System.env.OVERRIDE_SDK_VERSION ?: project.sdkVersion
-
- artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
- extension "aar"
- }
- pom.withXml {
- def pomXml = asNode()
- pomXml.appendNode('name', 'jitsi-meet-sdk')
- pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
- def dependencies = pomXml.appendNode('dependencies')
- configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
- // The (third-party) React Native modules that we depend on
- // are in source code form and do not have groupId. That is
- // why we have a dedicated groupId for them. But the other
- // dependencies come through Maven and, consequently, have
- // groupId.
- def groupId = it.moduleGroup
- def artifactId = it.moduleName
-
- if (artifactId.startsWith('react-native-') && groupId.equals('jitsi-meet')) {
- groupId = rootProject.ext.moduleGroupId
- }
-
- def dependency = dependencies.appendNode('dependency')
- dependency.appendNode('groupId', groupId)
- dependency.appendNode('artifactId', artifactId)
- dependency.appendNode('version', it.moduleVersion)
- }
- }
- }
-
- }
- repositories {
- maven {
- url rootProject.ext.mavenRepo
- if (!rootProject.ext.mavenRepo.startsWith("file")) {
- credentials {
- username rootProject.ext.mavenUser
- password rootProject.ext.mavenPassword
- }
- }
- }
- }
- }
|