2018-12-19 12:05:24 +00:00
|
|
|
import groovy.json.JsonSlurper
|
2020-10-07 09:44:57 +00:00
|
|
|
import org.gradle.util.VersionNumber
|
2018-12-19 12:05:24 +00:00
|
|
|
|
2017-06-07 20:15:36 +00:00
|
|
|
// Top-level build file where you can add configuration options common to all
|
|
|
|
// sub-projects/modules.
|
2016-10-05 14:36:59 +00:00
|
|
|
|
|
|
|
buildscript {
|
|
|
|
repositories {
|
2017-12-14 08:56:23 +00:00
|
|
|
google()
|
2022-01-14 10:44:02 +00:00
|
|
|
mavenCentral()
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
dependencies {
|
2022-04-28 12:25:07 +00:00
|
|
|
classpath 'com.android.tools.build:gradle:7.0.4'
|
2022-11-22 09:46:31 +00:00
|
|
|
classpath 'com.google.gms:google-services:4.3.14'
|
|
|
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-24 06:19:57 +00:00
|
|
|
ext {
|
2022-04-28 12:25:07 +00:00
|
|
|
buildToolsVersion = "31.0.0"
|
2022-11-22 09:46:54 +00:00
|
|
|
compileSdkVersion = 32
|
2020-09-24 06:19:57 +00:00
|
|
|
minSdkVersion = 23
|
2022-11-22 09:46:54 +00:00
|
|
|
targetSdkVersion = 32
|
2020-09-24 06:19:57 +00:00
|
|
|
supportLibVersion = "28.0.0"
|
2022-04-28 12:25:07 +00:00
|
|
|
|
|
|
|
if (System.properties['os.arch'] == "aarch64") {
|
|
|
|
// For M1 Users we need to use the NDK 24 which added support for aarch64
|
|
|
|
ndkVersion = "24.0.8215888"
|
|
|
|
} else {
|
|
|
|
// Otherwise we default to the side-by-side NDK version from AGP.
|
|
|
|
ndkVersion = "21.4.7075529"
|
|
|
|
}
|
2020-09-24 06:19:57 +00:00
|
|
|
|
|
|
|
// The Maven artifact groupdId of the third-party react-native modules which
|
|
|
|
// Jitsi Meet SDK for Android depends on and which are not available in
|
|
|
|
// third-party Maven repositories so we have to deploy to a Maven repository
|
|
|
|
// of ours.
|
|
|
|
moduleGroupId = 'com.facebook.react'
|
|
|
|
|
|
|
|
// Maven repo where artifacts will be published
|
|
|
|
mavenRepo = System.env.MVN_REPO ?: ""
|
|
|
|
mavenUser = System.env.MVN_USER ?: ""
|
|
|
|
mavenPassword = System.env.MVN_PASSWORD ?: ""
|
|
|
|
|
|
|
|
// Libre build
|
|
|
|
libreBuild = (System.env.LIBRE_BUILD ?: "false").toBoolean()
|
|
|
|
|
|
|
|
googleServicesEnabled = project.file('app/google-services.json').exists() && !libreBuild
|
|
|
|
}
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
allprojects {
|
|
|
|
repositories {
|
2019-08-15 14:54:31 +00:00
|
|
|
// React Native (JS, Obj-C sources, Android binaries) is installed from npm.
|
2017-09-12 01:12:11 +00:00
|
|
|
maven { url "$rootDir/../node_modules/react-native/android" }
|
2020-09-28 13:27:56 +00:00
|
|
|
// Android JSC is installed from npm.
|
|
|
|
maven { url("$rootDir/../node_modules/jsc-android/dist") }
|
2022-01-21 09:14:07 +00:00
|
|
|
mavenCentral {
|
|
|
|
// We don't want to fetch react-native from Maven Central as there are
|
|
|
|
// older versions over there.
|
2022-01-14 10:44:02 +00:00
|
|
|
content {
|
2022-01-21 09:14:07 +00:00
|
|
|
excludeGroup "com.facebook.react"
|
2022-01-14 10:44:02 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-21 09:14:07 +00:00
|
|
|
google()
|
|
|
|
maven { url 'https://www.jitpack.io' }
|
2017-09-12 01:12:11 +00:00
|
|
|
}
|
|
|
|
|
2018-05-15 10:56:42 +00:00
|
|
|
// Make sure we use the react-native version in node_modules and not the one
|
|
|
|
// published in jcenter / elsewhere.
|
|
|
|
configurations.all {
|
|
|
|
resolutionStrategy {
|
|
|
|
eachDependency { DependencyResolveDetails details ->
|
|
|
|
if (details.requested.group == 'com.facebook.react'
|
|
|
|
&& details.requested.name == 'react-native') {
|
|
|
|
def file = new File("$rootDir/../node_modules/react-native/package.json")
|
2018-12-19 12:05:24 +00:00
|
|
|
def version = new JsonSlurper().parseText(file.text).version
|
2018-05-15 10:56:42 +00:00
|
|
|
details.useVersion version
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-12 01:12:11 +00:00
|
|
|
// Third-party react-native modules which Jitsi Meet SDK for Android depends
|
|
|
|
// on and which are not available in third-party Maven repositories need to
|
|
|
|
// be deployed in a Maven repository of ours.
|
|
|
|
//
|
|
|
|
|
|
|
|
if (project.name.startsWith('react-native-')) {
|
|
|
|
apply plugin: 'maven-publish'
|
|
|
|
publishing {
|
|
|
|
publications {}
|
|
|
|
repositories {
|
2019-04-11 12:01:52 +00:00
|
|
|
maven {
|
|
|
|
url rootProject.ext.mavenRepo
|
|
|
|
if (!rootProject.ext.mavenRepo.startsWith("file")) {
|
|
|
|
credentials {
|
|
|
|
username rootProject.ext.mavenUser
|
|
|
|
password rootProject.ext.mavenPassword
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-09-12 01:12:11 +00:00
|
|
|
}
|
2017-08-03 15:40:08 +00:00
|
|
|
}
|
2017-09-12 01:12:11 +00:00
|
|
|
}
|
|
|
|
|
2019-04-03 10:00:25 +00:00
|
|
|
// Use the number of seconds/10 since Jan 1 2019 as the version qualifier number.
|
|
|
|
// This will last for the next ~680 years.
|
|
|
|
// https://stackoverflow.com/a/38643838
|
|
|
|
def versionQualifierNumber = (int)(((new Date().getTime()/1000) - 1546297200) / 10)
|
|
|
|
|
2017-09-12 01:12:11 +00:00
|
|
|
afterEvaluate { project ->
|
2019-08-15 14:54:31 +00:00
|
|
|
if (project.plugins.hasPlugin('android') || project.plugins.hasPlugin('android-library')) {
|
|
|
|
project.android {
|
|
|
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
|
|
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-09-12 01:12:11 +00:00
|
|
|
if (project.name.startsWith('react-native-')) {
|
|
|
|
def npmManifest = project.file('../package.json')
|
2018-12-19 12:05:24 +00:00
|
|
|
def json = new JsonSlurper().parseText(npmManifest.text)
|
2017-09-12 01:12:11 +00:00
|
|
|
|
2019-04-03 10:00:25 +00:00
|
|
|
// Release every dependency the SDK has with a -jitsi-XXX qualified version. This allows
|
|
|
|
// us to pin the dependencies and make sure they are always updated, no matter what.
|
2017-09-12 01:12:11 +00:00
|
|
|
|
2019-04-03 10:00:25 +00:00
|
|
|
project.version = "${json.version}-jitsi-${versionQualifierNumber}"
|
2017-09-12 01:12:11 +00:00
|
|
|
|
2021-10-20 19:29:21 +00:00
|
|
|
task jitsiAndroidSourcesJar(type: Jar) {
|
2017-09-12 01:12:11 +00:00
|
|
|
classifier = 'sources'
|
|
|
|
from android.sourceSets.main.java.source
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing.publications {
|
|
|
|
aarArchive(MavenPublication) {
|
|
|
|
groupId rootProject.ext.moduleGroupId
|
|
|
|
artifactId project.name
|
|
|
|
version project.version
|
|
|
|
|
|
|
|
artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
|
|
|
|
extension "aar"
|
|
|
|
}
|
2021-10-20 19:29:21 +00:00
|
|
|
artifact(jitsiAndroidSourcesJar)
|
2017-09-12 01:12:11 +00:00
|
|
|
pom.withXml {
|
|
|
|
def pomXml = asNode()
|
|
|
|
pomXml.appendNode('name', project.name)
|
|
|
|
pomXml.appendNode('description', json.description)
|
|
|
|
pomXml.appendNode('url', json.homepage)
|
|
|
|
if (json.license) {
|
|
|
|
def license = pomXml.appendNode('licenses').appendNode('license')
|
|
|
|
license.appendNode('name', json.license)
|
|
|
|
license.appendNode('distribution', 'repo')
|
|
|
|
}
|
|
|
|
|
|
|
|
def dependencies = pomXml.appendNode('dependencies')
|
|
|
|
configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
|
|
|
|
def artifactId = it.moduleName
|
|
|
|
def version = it.moduleVersion
|
|
|
|
// React Native signals breaking changes by
|
|
|
|
// increasing the minor version number. So the
|
|
|
|
// (third-party) React Native modules we utilize can
|
|
|
|
// depend not on a specific react-native release but
|
|
|
|
// a wider range.
|
2018-11-30 15:36:46 +00:00
|
|
|
if (artifactId == 'react-native') {
|
2017-09-12 01:12:11 +00:00
|
|
|
def versionNumber = VersionNumber.parse(version)
|
|
|
|
version = "${versionNumber.major}.${versionNumber.minor}"
|
|
|
|
}
|
|
|
|
|
|
|
|
def dependency = dependencies.appendNode('dependency')
|
|
|
|
dependency.appendNode('groupId', it.moduleGroup)
|
|
|
|
dependency.appendNode('artifactId', artifactId)
|
|
|
|
dependency.appendNode('version', version)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
[RN] Add initial Jitsi Meet SDK for Android
Dames en heren, welcome to Jitsi Meet SDK for Android, the Jitsi Meet library
for Android.
The Jitsi Meet SDK encapsulates React Native and all the dependencies Jitsi
Meet has so other aopplications can integrate it easily.
Unlike iOS, creating "fat" libraries is not allways (if at all) possible on
Android, however, effort was put into making the integration as easy as
possible.
While React Native can be embedded in native applications, I don't think it was
designed to be embedded as part of an Android library, hidden away from the
application using it. This surfaced as a number of issues which had to be
addressed specifically due to our use-case:
- Activity lifecycle methods must be linked with the React Native engine, so the
library provides wrapper methods.
- Custom fonts have to be manually added as assets, since the provided gradle
script doesn't work properly in a library target.
- The RN packager has to be manually triggered since the gradle script will no
longer do it for us.
At this stage, the Jitsi Meet application is just a small single activity
application which uses the Jitsi Meet SDK to create a single activity which
represents the entire application. Events and external conference handling are
forthcoming.
PS: Yours truly would like to add that it was a lot more fun to work on the iOS
side of things.
2017-05-22 13:33:42 +00:00
|
|
|
|
2017-06-20 15:32:44 +00:00
|
|
|
// Force the version of the Android build tools we have chosen on all
|
|
|
|
// subprojects. The forcing was introduced for react-native and the third-party
|
|
|
|
// modules that we utilize such as react-native-background-timer.
|
|
|
|
subprojects { subproject ->
|
|
|
|
afterEvaluate{
|
2017-10-04 01:44:49 +00:00
|
|
|
if ((subproject.plugins.hasPlugin('android')
|
|
|
|
|| subproject.plugins.hasPlugin('android-library'))
|
|
|
|
&& rootProject.ext.has('buildToolsVersion')) {
|
2017-06-20 15:32:44 +00:00
|
|
|
android {
|
|
|
|
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|