2018-12-19 12:05:24 +00:00
|
|
|
import groovy.json.JsonSlurper
|
|
|
|
|
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()
|
2016-10-05 14:36:59 +00:00
|
|
|
jcenter()
|
|
|
|
}
|
|
|
|
dependencies {
|
2018-12-19 12:08:59 +00:00
|
|
|
classpath 'com.android.tools.build:gradle:3.2.1'
|
2018-08-10 10:30:00 +00:00
|
|
|
classpath 'com.google.gms:google-services:3.2.1'
|
2016-10-05 14:36:59 +00:00
|
|
|
|
|
|
|
// NOTE: Do not place your application dependencies here; they belong
|
2017-06-07 20:15:36 +00:00
|
|
|
// in the individual module build.gradle files.
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
allprojects {
|
|
|
|
repositories {
|
2017-12-14 08:56:23 +00:00
|
|
|
google()
|
2016-10-05 14:36:59 +00:00
|
|
|
jcenter()
|
2018-07-18 09:12:26 +00:00
|
|
|
maven { url "$rootDir/../node_modules/jsc-android/dist" }
|
2017-09-12 01:12:11 +00:00
|
|
|
// React Native (JS, Obj-C sources, Android binaries) is installed from
|
|
|
|
// npm.
|
|
|
|
maven { url "$rootDir/../node_modules/react-native/android" }
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|
2018-07-18 09:12:26 +00:00
|
|
|
if (details.requested.group == 'org.webkit'
|
|
|
|
&& details.requested.name == 'android-jsc') {
|
|
|
|
def file = new File("$rootDir/../node_modules/jsc-android/package.json")
|
2018-12-19 12:05:24 +00:00
|
|
|
def version = new JsonSlurper().parseText(file.text).version
|
2018-07-18 09:12:26 +00:00
|
|
|
details.useVersion "r${version.tokenize('.')[0]}"
|
|
|
|
}
|
2018-05-15 10:56:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 {
|
2018-11-30 16:20:14 +00:00
|
|
|
maven { url "file:${rootProject.projectDir}/../../jitsi-maven-repository/releases" }
|
2017-09-12 01:12:11 +00:00
|
|
|
}
|
2017-08-03 15:40:08 +00:00
|
|
|
}
|
2017-09-12 01:12:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
afterEvaluate { project ->
|
|
|
|
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
|
|
|
|
|
|
|
// React Native modules have an npm peer dependency on react-native,
|
|
|
|
// they do not have an npm dependency on it. Further below though we
|
|
|
|
// choose a react-native version (range) when we represent them as
|
|
|
|
// Maven artifacts. Effectively, we are forking the projects by not
|
|
|
|
// complying with the full range of their npm peer dependency and,
|
|
|
|
// consequently, we should qualify their version.
|
|
|
|
def versionQualifier = '-jitsi-1'
|
2018-11-30 15:36:46 +00:00
|
|
|
if ('react-native-background-timer' == project.name)
|
|
|
|
versionQualifier = '-jitsi-3' // 2.0.0 + react-native 0.57
|
|
|
|
else if ('react-native-calendar-events' == project.name)
|
2018-12-19 09:43:50 +00:00
|
|
|
versionQualifier = '-jitsi-2' // 1.6.4 + react-native 0.57
|
2018-11-30 15:36:46 +00:00
|
|
|
else if ('react-native-fast-image' == project.name)
|
2018-12-06 11:16:54 +00:00
|
|
|
versionQualifier = '-jitsi-2' // 5.1.1 + react-native 0.57
|
2018-11-30 15:36:46 +00:00
|
|
|
else if ('react-native-google-signin' == project.name)
|
2018-12-19 10:34:47 +00:00
|
|
|
versionQualifier = '-jitsi-2' // 1.0.2 + react-native 0.57
|
2018-11-30 15:36:46 +00:00
|
|
|
else if ('react-native-immersive' == project.name)
|
2018-12-19 12:54:08 +00:00
|
|
|
versionQualifier = '-jitsi-5' // 2.0.0 + react-native 0.57
|
2018-11-30 15:36:46 +00:00
|
|
|
else if ('react-native-keep-awake' == project.name)
|
2018-12-19 13:27:12 +00:00
|
|
|
versionQualifier = '-jitsi-4' // 4.0.0 + react-native 0.57
|
2018-11-30 15:36:46 +00:00
|
|
|
else if ('react-native-linear-gradient' == project.name)
|
|
|
|
versionQualifier = '-jitsi-1' // 2.4.0 + react-native 0.57
|
|
|
|
else if ('react-native-sound' == project.name)
|
|
|
|
versionQualifier = '-jitsi-2' // 0.10.9 + react-native 0.57
|
|
|
|
else if ('react-native-vector-icons' == project.name)
|
|
|
|
versionQualifier = '-jitsi-3' // 6.0.2 + react-native 0.57
|
|
|
|
else if ('react-native-webrtc' == project.name)
|
|
|
|
versionQualifier = '-jitsi-9' // 6322a9b5a38ce590cfaea4041072ea87c8dbf558 + react-native 0.57
|
2017-09-12 01:12:11 +00:00
|
|
|
|
|
|
|
project.version = "${json.version}${versionQualifier}"
|
|
|
|
|
|
|
|
project.android {
|
|
|
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
2017-10-04 01:44:49 +00:00
|
|
|
if (rootProject.ext.has('buildToolsVersion')) {
|
|
|
|
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
|
|
}
|
2017-09-12 01:12:11 +00:00
|
|
|
defaultConfig {
|
|
|
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
|
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task androidJavadocs(type: Javadoc) {
|
|
|
|
source = android.sourceSets.main.java.source
|
|
|
|
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
|
|
|
|
failOnError false
|
|
|
|
}
|
|
|
|
task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
|
|
|
|
classifier = 'javadoc'
|
|
|
|
from androidJavadocs.destinationDir
|
|
|
|
}
|
|
|
|
task androidSourcesJar(type: Jar) {
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
artifact(androidSourcesJar)
|
|
|
|
artifact(androidJavadocsJar)
|
|
|
|
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
|
|
|
|
|
|
|
ext {
|
2018-12-19 12:08:59 +00:00
|
|
|
buildToolsVersion = "28.0.3"
|
|
|
|
compileSdkVersion = 28
|
2018-07-18 09:12:26 +00:00
|
|
|
minSdkVersion = 21
|
2018-12-19 12:08:59 +00:00
|
|
|
targetSdkVersion = 28
|
|
|
|
supportLibVersion = "28.0.0"
|
2017-09-12 01:12:11 +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'
|
2018-12-06 17:22:59 +00:00
|
|
|
|
|
|
|
// Glide
|
|
|
|
excludeAppGlideModule = true
|
|
|
|
glideVersion = "4.7.1" // keep in sync with react-native-fast-image
|
[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
|
|
|
|
2017-10-23 21:21:11 +00:00
|
|
|
// If Android SDK is not installed, accept its license so that it
|
|
|
|
// is automatically downloaded.
|
|
|
|
afterEvaluate { project ->
|
|
|
|
// Either the environment variable ANDROID_HOME or the property sdk.dir in
|
|
|
|
// local.properties identifies where Android SDK is installed.
|
|
|
|
def androidHome = System.env.ANDROID_HOME
|
|
|
|
if (!androidHome) {
|
|
|
|
// ANDROID_HOME is not set. Is sdk.dir set?
|
|
|
|
def file = file("${project.rootDir}/local.properties")
|
|
|
|
def props = new Properties()
|
|
|
|
if (file.canRead()) {
|
|
|
|
file.withInputStream {
|
|
|
|
props.load(it)
|
|
|
|
androidHome = props.'sdk.dir'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!androidHome && (!file.exists() || file.canWrite())) {
|
|
|
|
// Neither ANDROID_HOME nor sdk.dir is set. Set sdk.dir (because
|
|
|
|
// environment variables cannot be set).
|
|
|
|
props.'sdk.dir' = "${project.buildDir}/android-sdk".toString()
|
|
|
|
file.withOutputStream {
|
|
|
|
props.store(it, null)
|
|
|
|
androidHome = props.'sdk.dir'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// If the license is not accepted, accept it so that automatic downloading
|
|
|
|
// kicks in.
|
2017-10-24 15:14:35 +00:00
|
|
|
// The license hash can be taken from the accepted licenses, by doing this
|
|
|
|
// on your local machine the file is
|
|
|
|
// ${androidHome}/licenses/android-sdk-license
|
2017-10-23 21:21:11 +00:00
|
|
|
if (androidHome) {
|
|
|
|
def dir = file("${androidHome}/licenses")
|
|
|
|
dir.mkdirs()
|
|
|
|
def file = file("${dir.path}/android-sdk-license")
|
|
|
|
if (!file.exists()) {
|
|
|
|
file.withWriter {
|
|
|
|
def hash = 'd56f5187479451eabf01fb78af6dfcb131a6481e'
|
|
|
|
it.write(hash, 0, hash.length())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|