Przeglądaj źródła

[RN] SDK building, installing, and publishing

Based on work authored by Shuai Li <sli@atlassian.com>, Daniel Ornelas
<dornelas@atlassian.com>, and Lyubo Marinov <lmarinov@atlassian.com>.
master
Lyubo Marinov 7 lat temu
rodzic
commit
72c9933e73

+ 2
- 2
README.md Wyświetl plik

@@ -99,8 +99,8 @@ see our [guidelines for contributing](CONTRIBUTING.md).
99 99
 Jitsi Meet provides a very flexible way of embedding it in external applications by using the [Jitsi Meet API](doc/api.md).
100 100
 
101 101
 ## Mobile app
102
-Jitsi Meet is also available as a React Native application for Android and iOS.
103
-Instructions on how to build it can be  found [here](doc/mobile.md).
102
+Jitsi Meet is also available as a React Native app for Android and iOS.
103
+Instructions on how to build it can be found [here](doc/mobile.md).
104 104
 
105 105
 ## Acknowledgements
106 106
 

+ 20
- 3
android/README.md Wyświetl plik

@@ -1,9 +1,26 @@
1 1
 # Jitsi Meet SDK for Android
2 2
 
3
-This directory contains the source code of the Jitsi Meet app and the Jitsi Meet
4
-SDK for Android.
3
+## Build
5 4
 
6
-## Jitsi Meet SDK
5
+1. Install all required [dependencies](https://github.com/jitsi/jitsi-meet/blob/master/doc/mobile.md).
6
+
7
+2. ```bash
8
+   cd android/
9
+   ./gradlew :sdk:assembleRelease
10
+   ```
11
+
12
+3. ```bash
13
+   ./gradlew :sdk:publish
14
+   cd ../
15
+   ```
16
+
17
+## Install
18
+
19
+Add the Maven repository
20
+`https://github.com/jitsi/jitsi-maven-repository/raw/master/releases` and the
21
+dependency `org.jitsi.react:jitsi-meet-sdk:1.9.0` into your `build.gradle`.
22
+
23
+## API
7 24
 
8 25
 Jitsi Meet SDK is an Android library which embodies the whole Jitsi Meet
9 26
 experience and makes it reusable by third-party apps.

+ 1
- 1
android/app/build.gradle Wyświetl plik

@@ -7,7 +7,7 @@ android {
7 7
     defaultConfig {
8 8
         applicationId 'org.jitsi.meet'
9 9
         versionCode Integer.parseInt("${version}")
10
-        versionName "1.4.${version}"
10
+        versionName "1.9.${version}"
11 11
 
12 12
         minSdkVersion rootProject.ext.minSdkVersion
13 13
         targetSdkVersion rootProject.ext.targetSdkVersion

+ 110
- 7
android/build.gradle Wyświetl plik

@@ -18,14 +18,111 @@ allprojects {
18 18
     repositories {
19 19
         mavenLocal()
20 20
         jcenter()
21
-        maven {
22
-            // Google's maven repository, required for AppCompat
23
-            url "https://maven.google.com"
21
+        maven { url "https://maven.google.com" } // Required for appcompat.
22
+        // React Native (JS, Obj-C sources, Android binaries) is installed from
23
+        // npm.
24
+        maven { url "$rootDir/../node_modules/react-native/android" }
25
+    }
26
+
27
+    // Third-party react-native modules which Jitsi Meet SDK for Android depends
28
+    // on and which are not available in third-party Maven repositories need to
29
+    // be deployed in a Maven repository of ours.
30
+    //
31
+
32
+    if (project.name.startsWith('react-native-')) {
33
+        apply plugin: 'maven-publish'
34
+        publishing {
35
+            publications {}
36
+            repositories {
37
+                maven { url "file:${rootProject.projectDir}/../../../jitsi/jitsi-maven-repository/releases" }
38
+            }
24 39
         }
25
-        maven {
26
-            // All of React Native (JS, Obj-C sources, Android binaries) is
27
-            // installed from npm.
28
-            url "$rootDir/../node_modules/react-native/android"
40
+    }
41
+
42
+    afterEvaluate { project ->
43
+        if (project.name.startsWith('react-native-')) {
44
+            def npmManifest = project.file('../package.json')
45
+            def json = new groovy.json.JsonSlurper().parseText(npmManifest.text)
46
+
47
+            // React Native modules have an npm peer dependency on react-native,
48
+            // they do not have an npm dependency on it. Further below though we
49
+            // choose a react-native version (range) when we represent them as
50
+            // Maven artifacts. Effectively, we are forking the projects by not
51
+            // complying with the full range of their npm peer dependency and,
52
+            // consequently, we should qualify their version.
53
+            def versionQualifier = '-jitsi-1'
54
+            if ('react-native-webrtc'.equals(project.name))
55
+                versionQualifier = '-jitsi-1'
56
+
57
+            project.version = "${json.version}${versionQualifier}"
58
+
59
+            project.android {
60
+                compileSdkVersion rootProject.ext.compileSdkVersion
61
+                buildToolsVersion rootProject.ext.buildToolsVersion
62
+                defaultConfig {
63
+                    minSdkVersion rootProject.ext.minSdkVersion
64
+                    targetSdkVersion rootProject.ext.targetSdkVersion
65
+                }
66
+            }
67
+
68
+            task androidJavadocs(type: Javadoc) {
69
+                source = android.sourceSets.main.java.source
70
+                classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
71
+                failOnError false
72
+            }
73
+            task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
74
+                classifier = 'javadoc'
75
+                from androidJavadocs.destinationDir
76
+            }
77
+            task androidSourcesJar(type: Jar) {
78
+                classifier = 'sources'
79
+                from android.sourceSets.main.java.source
80
+            }
81
+
82
+            publishing.publications {
83
+                aarArchive(MavenPublication) {
84
+                    groupId rootProject.ext.moduleGroupId
85
+                    artifactId project.name
86
+                    version project.version
87
+
88
+                    artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
89
+                        extension "aar"
90
+                    }
91
+                    artifact(androidSourcesJar)
92
+                    artifact(androidJavadocsJar)
93
+                    pom.withXml {
94
+                        def pomXml = asNode()
95
+                        pomXml.appendNode('name', project.name)
96
+                        pomXml.appendNode('description', json.description)
97
+                        pomXml.appendNode('url', json.homepage)
98
+                        if (json.license) {
99
+                            def license = pomXml.appendNode('licenses').appendNode('license')
100
+                            license.appendNode('name', json.license)
101
+                            license.appendNode('distribution', 'repo')
102
+                        }
103
+
104
+                        def dependencies = pomXml.appendNode('dependencies')
105
+                        configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
106
+                            def artifactId = it.moduleName
107
+                            def version = it.moduleVersion
108
+                            // React Native signals breaking changes by
109
+                            // increasing the minor version number. So the
110
+                            // (third-party) React Native modules we utilize can
111
+                            // depend not on a specific react-native release but
112
+                            // a wider range.
113
+                            if (artifactId.equals('react-native')) {
114
+                                def versionNumber = VersionNumber.parse(version)
115
+                                version = "${versionNumber.major}.${versionNumber.minor}"
116
+                            }
117
+
118
+                            def dependency = dependencies.appendNode('dependency')
119
+                            dependency.appendNode('groupId', it.moduleGroup)
120
+                            dependency.appendNode('artifactId', artifactId)
121
+                            dependency.appendNode('version', version)
122
+                        }
123
+                    }
124
+                }
125
+            }
29 126
         }
30 127
     }
31 128
 }
@@ -35,6 +132,12 @@ ext {
35 132
     buildToolsVersion = "25.0.3"
36 133
     minSdkVersion    = 16
37 134
     targetSdkVersion = 25
135
+
136
+    // The Maven artifact groupdId of the third-party react-native modules which
137
+    // Jitsi Meet SDK for Android depends on and which are not available in
138
+    // third-party Maven repositories so we have to deploy to a Maven repository
139
+    // of ours.
140
+    moduleGroupId = 'com.facebook.react'
38 141
 }
39 142
 
40 143
 // Force the version of the Android build tools we have chosen on all

+ 44
- 2
android/sdk/build.gradle Wyświetl plik

@@ -1,4 +1,5 @@
1 1
 apply plugin: 'com.android.library'
2
+apply plugin: 'maven-publish'
2 3
 
3 4
 android {
4 5
     compileSdkVersion rootProject.ext.compileSdkVersion
@@ -53,7 +54,6 @@ gradle.projectsEvaluated {
53 54
         def currentFontTask = tasks.create(
54 55
                 name: "copy${buildNameCapitalized}Fonts",
55 56
                 type: Copy) {
56
-
57 57
             from("${projectDir}/../../fonts/jitsi.ttf")
58 58
             from("${projectDir}/../../node_modules/react-native-vector-icons/Fonts/")
59 59
             into("${bundlePath}/assets/fonts")
@@ -82,7 +82,6 @@ gradle.projectsEvaluated {
82 82
         def currentBundleTask = tasks.create(
83 83
                 name: bundleJsAndAssetsTaskName,
84 84
                 type: Exec) {
85
-
86 85
             // Set up inputs and outputs so gradle can cache the result.
87 86
             def reactRoot = file("${projectDir}/../../")
88 87
             inputs.files fileTree(dir: reactRoot, excludes: ['android/**', 'ios/**'])
@@ -119,3 +118,46 @@ gradle.projectsEvaluated {
119 118
         runBefore("process${buildNameCapitalized}Resources", currentBundleTask)
120 119
     }
121 120
 }
121
+
122
+publishing {
123
+    publications {
124
+        aarArchive(MavenPublication) {
125
+            groupId 'org.jitsi.react'
126
+            artifactId 'jitsi-meet-sdk'
127
+            version '1.9.0'
128
+
129
+            artifact("${project.buildDir}/outputs/aar/${project.name}-release.aar") {
130
+                extension "aar"
131
+            }
132
+            pom.withXml {
133
+                def pomXml = asNode()
134
+                pomXml.appendNode('name', 'jitsi-meet-sdk')
135
+                pomXml.appendNode('description', 'Jitsi Meet SDK for Android')
136
+                def dependencies = pomXml.appendNode('dependencies')
137
+                configurations.getByName('releaseCompileClasspath').getResolvedConfiguration().getFirstLevelModuleDependencies().each {
138
+                    // The (third-party) React Native modules that we depend on
139
+                    // are in source code form and do not have groupId. That is
140
+                    // why we have a dedicated groupId for them. But the other
141
+                    // dependencies come through Maven and, consequently, have
142
+                    // groupId.
143
+                    def groupId = it.moduleGroup
144
+                    def artifactId = it.moduleName
145
+
146
+                    if (artifactId.startsWith('react-native-')
147
+                            && groupId.equals('jitsi-meet')) {
148
+                        groupId = rootProject.ext.moduleGroupId
149
+                    }
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
+    }
160
+    repositories {
161
+        maven { url "file:${rootProject.projectDir}/../../../jitsi/jitsi-maven-repository/releases" }
162
+    }
163
+}

+ 9
- 14
doc/mobile.md Wyświetl plik

@@ -1,14 +1,11 @@
1
-# Jitsi Meet mobile apps
1
+# Jitsi Meet apps for Android and iOS
2 2
 
3
-Jitsi Meet can also be built as a standalone mobile application for
4
-iOS and Android.  It uses the [React Native] framework.
3
+Jitsi Meet can also be built as a standalone app for Android or iOS. It uses the
4
+[React Native] framework.
5 5
 
6 6
 First make sure the [React Native dependencies] are installed.
7 7
 
8
-**NOTE**:  This document assumes the app is being built on a macOS system.
9
-
10
-**NOTE**:  The app must be built for an actual device since the simulators don't
11
-work properly with the native plugins we require.
8
+**NOTE**: This document assumes the app is being built on a macOS system.
12 9
 
13 10
 **NOTE**: Node 6.X and npm 3.X are recommended for building.
14 11
 
@@ -95,17 +92,15 @@ build environment.  Make sure you follow it closely.
95 92
 
96 93
     It will be launched on the connected Android device.
97 94
 
98
-
99 95
 ## Debugging
100 96
 
101
-The official documentation on [debugging] is quite extensive, it is the
97
+The official documentation on [debugging] is quite extensive and specifies the
102 98
 preferred method for debugging.
103 99
 
104
-**NOTE**: When using Chrome Developer Tools for debugging the JavaScript code
105
-is being interpreted by Chrome's V8 engine, instead of JSCore which
106
-React Native uses.  It's important to keep this in mind due to potential
107
-differences in supported JavaScript features.
108
-
100
+**NOTE**: When using Chrome Developer Tools for debugging the JavaScript source
101
+code is being interpreted by Chrome's V8 engine, instead of JSCore which React
102
+Native uses. It's important to keep this in mind due to potential differences in
103
+supported JavaScript features.
109 104
 
110 105
 [Android Studio]: https://developer.android.com/studio/index.html
111 106
 [debugging]: https://facebook.github.io/react-native/docs/debugging.html

+ 13
- 3
ios/README.md Wyświetl plik

@@ -1,9 +1,19 @@
1 1
 # Jitsi Meet SDK for iOS
2 2
 
3
-This directory contains the source code of the Jitsi Meet app and the Jitsi Meet
4
-SDK for iOS.
3
+## Build
5 4
 
6
-## Jitsi Meet SDK
5
+1. Install all required [dependencies](https://github.com/jitsi/jitsi-meet/blob/master/doc/mobile.md).
6
+
7
+2. `xcodebuild -workspace ios/jitsi-meet.xcworkspace -scheme JitsiMeet -destination='generic/platform=iOS' -configuration Release archive`
8
+
9
+## Install
10
+
11
+After successfully building Jitsi Meet SDK for iOS, copy
12
+`ios/sdk/JitsiMeet.framework` (if the path points to a symbolic link, follow the
13
+symbolic link) and
14
+`node_modules/react-native-webrtc/ios/WebRTC.framework` into your project.
15
+
16
+## API
7 17
 
8 18
 JitsiMeet is an iOS framework which embodies the whole Jitsi Meet experience and
9 19
 makes it reusable by third-party apps.

+ 1
- 1
ios/app/src/Info.plist Wyświetl plik

@@ -17,7 +17,7 @@
17 17
 	<key>CFBundlePackageType</key>
18 18
 	<string>APPL</string>
19 19
 	<key>CFBundleShortVersionString</key>
20
-	<string>1.4</string>
20
+	<string>1.9</string>
21 21
 	<key>CFBundleSignature</key>
22 22
 	<string>????</string>
23 23
 	<key>CFBundleURLTypes</key>

+ 1
- 1
ios/sdk/sdk.xcodeproj/xcshareddata/xcschemes/JitsiMeet.xcscheme Wyświetl plik

@@ -81,7 +81,7 @@
81 81
             ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
82 82
             <ActionContent
83 83
                title = "Run Script"
84
-               scriptText = "exec &gt; /tmp/${PROJECT_NAME}_archive.log 2&gt;&amp;1&#10;&#10;UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal&#10;&#10;if [ &quot;true&quot; == ${ALREADYINVOKED:-false} ]&#10;then&#10;echo &quot;RECURSION: Detected, stopping&quot;&#10;else&#10;export ALREADYINVOKED=&quot;true&quot;&#10;&#10;# make sure the output directory exists&#10;mkdir -p &quot;${UNIVERSAL_OUTPUTFOLDER}&quot;&#10;&#10;echo &quot;Building for iPhoneSimulator&quot;&#10;xcodebuild -workspace &quot;${WORKSPACE_PATH}&quot; -scheme &quot;${TARGET_NAME}&quot; -configuration ${CONFIGURATION} -sdk iphonesimulator -destination &apos;platform=iOS Simulator,name=iPhone 6&apos; ONLY_ACTIVE_ARCH=NO ARCHS=&apos;i386 x86_64&apos; BUILD_DIR=&quot;${BUILD_DIR}&quot; BUILD_ROOT=&quot;${BUILD_ROOT}&quot; ENABLE_BITCODE=YES OTHER_CFLAGS=&quot;-fembed-bitcode&quot; BITCODE_GENERATION_MODE=bitcode clean build&#10;&#10;# Step 1. Copy the framework structure (from iphoneos build) to the universal folder&#10;echo &quot;Copying to output folder&quot;&#10;cp -R &quot;${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${FULL_PRODUCT_NAME}&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/&quot;&#10;&#10;# Step 2. Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory&#10;SIMULATOR_SWIFT_MODULES_DIR=&quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule/.&quot;&#10;if [ -d &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; ]; then&#10;cp -R &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule&quot;&#10;fi&#10;&#10;# Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory&#10;echo &quot;Combining executables&quot;&#10;lipo -create -output &quot;${UNIVERSAL_OUTPUTFOLDER}/${EXECUTABLE_PATH}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${EXECUTABLE_PATH}&quot; &quot;${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${EXECUTABLE_PATH}&quot;&#10;&#10;# Step 4. Create universal binaries for embedded frameworks&#10;#for SUB_FRAMEWORK in $( ls &quot;${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks&quot; ); do&#10;#BINARY_NAME=&quot;${SUB_FRAMEWORK%.*}&quot;&#10;#lipo -create -output &quot;${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SUB_FRAMEWORK}/${BINARY_NAME}&quot; &quot;${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}&quot;&#10;#done&#10;&#10;# Step 5. Convenience step to copy the framework to the project&apos;s directory&#10;echo &quot;Copying to project dir&quot;&#10;yes | cp -Rf &quot;${UNIVERSAL_OUTPUTFOLDER}/${FULL_PRODUCT_NAME}&quot; &quot;${PROJECT_DIR}&quot;&#10;&#10;open &quot;${PROJECT_DIR}&quot;&#10;&#10;fi">
84
+               scriptText = "exec &gt; /tmp/${PROJECT_NAME}_archive.log 2&gt;&amp;1&#10;&#10;UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal&#10;&#10;if [ &quot;true&quot; == ${ALREADYINVOKED:-false} ]&#10;then&#10;echo &quot;RECURSION: Detected, stopping&quot;&#10;else&#10;export ALREADYINVOKED=&quot;true&quot;&#10;&#10;# make sure the output directory exists&#10;mkdir -p &quot;${UNIVERSAL_OUTPUTFOLDER}&quot;&#10;&#10;echo &quot;Building for iPhoneSimulator&quot;&#10;xcodebuild -workspace &quot;${WORKSPACE_PATH}&quot; -scheme &quot;${TARGET_NAME}&quot; -configuration ${CONFIGURATION} -sdk iphonesimulator -destination &apos;platform=iOS Simulator,name=iPhone 6&apos; ONLY_ACTIVE_ARCH=NO ARCHS=&apos;i386 x86_64&apos; BUILD_DIR=&quot;${BUILD_DIR}&quot; BUILD_ROOT=&quot;${BUILD_ROOT}&quot; ENABLE_BITCODE=YES OTHER_CFLAGS=&quot;-fembed-bitcode&quot; BITCODE_GENERATION_MODE=bitcode clean build&#10;&#10;# Step 1. Copy the framework structure (from iphoneos build) to the universal folder&#10;echo &quot;Copying to output folder&quot;&#10;cp -R &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FULL_PRODUCT_NAME}&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/&quot;&#10;&#10;# Step 2. Copy Swift modules from iphonesimulator build (if it exists) to the copied framework directory&#10;SIMULATOR_SWIFT_MODULES_DIR=&quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule/.&quot;&#10;if [ -d &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; ]; then&#10;cp -R &quot;${SIMULATOR_SWIFT_MODULES_DIR}&quot; &quot;${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Modules/${TARGET_NAME}.swiftmodule&quot;&#10;fi&#10;&#10;# Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory&#10;echo &quot;Combining executables&quot;&#10;lipo -create -output &quot;${UNIVERSAL_OUTPUTFOLDER}/${EXECUTABLE_PATH}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${EXECUTABLE_PATH}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphoneos/${EXECUTABLE_PATH}&quot;&#10;&#10;# Step 4. Create universal binaries for embedded frameworks&#10;#for SUB_FRAMEWORK in $( ls &quot;${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks&quot; ); do&#10;#BINARY_NAME=&quot;${SUB_FRAMEWORK%.*}&quot;&#10;#lipo -create -output &quot;${UNIVERSAL_OUTPUTFOLDER}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}&quot; &quot;${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${SUB_FRAMEWORK}/${BINARY_NAME}&quot; &quot;${ARCHIVE_PRODUCTS_PATH}${INSTALL_PATH}/${TARGET_NAME}.framework/Frameworks/${SUB_FRAMEWORK}/${BINARY_NAME}&quot;&#10;#done&#10;&#10;# Step 5. Convenience step to copy the framework to the project&apos;s directory&#10;echo &quot;Copying to project dir&quot;&#10;yes | cp -Rf &quot;${UNIVERSAL_OUTPUTFOLDER}/${FULL_PRODUCT_NAME}&quot; &quot;${PROJECT_DIR}&quot;&#10;&#10;fi">
85 85
                <EnvironmentBuildable>
86 86
                   <BuildableReference
87 87
                      BuildableIdentifier = "primary"

+ 1
- 1
ios/sdk/src/Info.plist Wyświetl plik

@@ -15,7 +15,7 @@
15 15
 	<key>CFBundlePackageType</key>
16 16
 	<string>FMWK</string>
17 17
 	<key>CFBundleShortVersionString</key>
18
-	<string>1.0</string>
18
+	<string>1.9.0</string>
19 19
 	<key>CFBundleVersion</key>
20 20
 	<string>$(CURRENT_PROJECT_VERSION)</string>
21 21
 	<key>NSPrincipalClass</key>

Ładowanie…
Anuluj
Zapisz