Explorar el Código

android: add an improved SDK release script

It releases the SDK and all dependencies (including React Native) to the
specified Maven repo.
master
Saúl Ibarra Corretgé hace 6 años
padre
commit
4c3cf8c14a
Se han modificado 3 ficheros con 68 adiciones y 59 borrados
  1. 14
    40
      android/README.md
  2. 0
    19
      android/scripts/publish-react-native.sh
  3. 54
    0
      android/scripts/release-sdk.sh

+ 14
- 40
android/README.md Ver fichero

2
 
2
 
3
 ## Build your own, or use a pre-build SDK artifacts/binaries
3
 ## Build your own, or use a pre-build SDK artifacts/binaries
4
 
4
 
5
-Jitsi conveniently provides a pre-build SDK artifacts/binaries in its Maven repository. When you do not require any modification to the SDK itself, it's suggested to use the pre-build SDK. This avoids the complexity of building and installing your own SDK artifacts/binaries.
5
+Jitsi conveniently provides a pre-build SDK artifacts/binaries in its Maven repository. When you do not require any
6
+modification to the SDK itself or any of its dependencies, it's suggested to use the pre-build SDK. This avoids the
7
+complexity of building and installing your own SDK artifacts/binaries.
6
 
8
 
7
 ### Use pre-build SDK artifacts/binaries
9
 ### Use pre-build SDK artifacts/binaries
8
 
10
 
29
 ```gradle
31
 ```gradle
30
 dependencies {
32
 dependencies {
31
     // (other dependencies)
33
     // (other dependencies)
32
-    implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
34
+    implementation ('org.jitsi.react:jitsi-meet-sdk:2.+') { transitive = true }
33
 }
35
 }
34
 ```
36
 ```
35
 
37
 
44
 
46
 
45
 If you want to use a SDK that is built from source, you will likely benefit from composing a local Maven repository that contains these dependencies. The text below describes how you create a repository that includes both the SDK as well as these dependencies. For illustration purposes, we'll define the location of this local Maven repository as `/tmp/repo`
47
 If you want to use a SDK that is built from source, you will likely benefit from composing a local Maven repository that contains these dependencies. The text below describes how you create a repository that includes both the SDK as well as these dependencies. For illustration purposes, we'll define the location of this local Maven repository as `/tmp/repo`
46
 
48
 
47
-In source code form, the Android SDK dependencies are locked/pinned by package.json and package-lock.json of the Jitsi Meet project. To obtain the data, execute NPM in the parent directory:
49
+In source code form, the Android SDK dependencies are locked/pinned by package.json and package-lock.json of the Jitsi Meet project. To obtain the data, execute NPM in the jitsi-meet project directory:
48
 
50
 
49
-    $ (cd ..; npm install)
51
+    npm install
50
 
52
 
51
 This will pull in the dependencies in either binary format, or in source code format, somewhere under /node_modules/
53
 This will pull in the dependencies in either binary format, or in source code format, somewhere under /node_modules/
52
 
54
 
53
-At the time of writing, there are two packages pulled in in binary format.
54
-
55
-To copy React Native to your local Maven repository, you can simply copy part of the directory structure that was pulled in by NPM:
56
-
57
-    $ cp -r ../node_modules/react-native/android/com /tmp/repo/
58
-
59
-Alternatively, you can use the scripts located in the android/scripts directory to publish these dependencies to your Maven repo.
60
-
61
-Third-party React Native _modules_, which Jitsi Meet SDK for Android depends on, are download by NPM in source code form. These need to be assembled into Maven artifacts, and then published to your local Maven repository. The SDK project facilitates this.
62
-
63
-To prepare, Configure the Maven repositories in which you are going to publish the SDK artifacts/binaries. In `android/sdk/build.gradle` as well as in `android/build.gradle` modify the lines that contain:
64
-
65
-    "file:${rootProject.projectDir}/../../jitsi-maven-repository/releases"
66
-
67
-Change this value (which represents the Maven repository location used internally by the Jitsi Developers) to the location of the repository that you'd like to use:
68
-
69
-    "file:/tmp/repo"
70
-
71
-Make sure to do this in both files! Each file should require one line to be changed.
72
-
73
-To prevent artifacts from previous builds affecting you're outcome, it's good to start with cleaning your work directories:
74
-
75
-    $ ./gradlew clean
76
-
77
-To create the release assembly for any _specific_ third-party React Native module that you need, you can execture the following commands, replace the module name in the examples below.
78
-
79
-    $ ./gradlew :react-native-webrtc:assembleRelease
80
-    $ ./gradlew :react-native-webrtc:publish
81
-
82
-You build and publish the SDK itself in the same way:
83
-
84
-    $ ./gradlew :sdk:assembleRelease
85
-    $ ./gradlew :sdk:publish
55
+Third-party React Native _modules_, which Jitsi Meet SDK for Android depends on, are download by NPM in source code 
56
+or binary form. These need to be assembled into Maven artifacts, and then published to your local Maven repository.
57
+A script is provided to facilitate this. From the root of the jitsi-meet project repository, run:
86
 
58
 
87
-Alternatively, you can assemble and publish _all_ subprojects, which include the react-native modules, but also the SDK itself, with a single command:
59
+    ./android/scripts/release-sdk.sh /tmp/repo
88
 
60
 
89
-    $ ./gradlew clean assembleRelease publish
61
+This will build and publish the SDK, and all of its dependencies to the specified Maven repository (`/tmp/repo`) in
62
+this example.
90
 
63
 
91
 You're now ready to use the artifacts. In _your_ project, add the Maven repository that you used above (`/tmp/repo`) into your top-level `build.gradle` file:
64
 You're now ready to use the artifacts. In _your_ project, add the Maven repository that you used above (`/tmp/repo`) into your top-level `build.gradle` file:
92
 
65
 
104
 
77
 
105
     implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
78
     implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
106
 
79
 
107
-Note that there should not be a need to explicitly add the other dependencies, as they will be pulled in as transitive dependencies of `jitsi-meet-sdk`.
80
+Note that there should not be a need to explicitly add the other dependencies, as they will be pulled in as transitive
81
+dependencies of `jitsi-meet-sdk`.
108
 
82
 
109
 </details>
83
 </details>
110
 
84
 

+ 0
- 19
android/scripts/publish-react-native.sh Ver fichero

1
-#!/bin/bash
2
-
3
-CWD=$(dirname $0)
4
-MVN_REPO=$(realpath $1)
5
-RN_VERSION=$(jq -r '.dependencies."react-native"' ${CWD}/../../package.json)
6
-
7
-pushd ${CWD}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
8
-
9
-mvn \
10
-    deploy:deploy-file \
11
-    -Durl=file://${MVN_REPO} \
12
-    -Dfile=react-native-${RN_VERSION}.aar \
13
-    -Dpackaging=aar \
14
-    -Dsources=react-native-${RN_VERSION}-sources.jar \
15
-    -Djavadoc=react-native-${RN_VERSION}-javadoc.jar \
16
-    -DgeneratePom=false \
17
-    -DpomFile=react-native-${RN_VERSION}.pom
18
-
19
-popd

+ 54
- 0
android/scripts/release-sdk.sh Ver fichero

1
+#!/bin/bash
2
+
3
+set -e -u
4
+
5
+
6
+THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
7
+DEFAULT_MVN_REPO="${THIS_DIR}/../../../jitsi-maven-repository/releases"
8
+export MVN_REPO=$(realpath ${1:-$DEFAULT_MVN_REPO})
9
+SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
10
+RN_VERSION=$(jq -r '.dependencies."react-native"' ${THIS_DIR}/../../package.json)
11
+
12
+
13
+echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
14
+echo "Using ${MVN_REPO} as the Maven repo"
15
+
16
+# Check if an SDK with that same version has already been released
17
+if [[ -d ${MVN_REPO}/org/jitsi/react/jitsi-meet-sdk/${SDK_VERSION} ]]; then
18
+    echo "There is already a release with that version in the Maven repo!"
19
+    exit 1
20
+fi
21
+
22
+# First push React Native, if necessary
23
+if [[ ! -d ${MVN_REPO}/com/facebook/react/react-native/${RN_VERSION} ]]; then
24
+    echo "Pushing React Native ${RN_VERSION} to the Maven repo"
25
+    pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
26
+    mvn \
27
+        deploy:deploy-file \
28
+        -Durl=file://${MVN_REPO} \
29
+        -Dfile=react-native-${RN_VERSION}.aar \
30
+        -Dpackaging=aar \
31
+        -DgeneratePom=false \
32
+        -DpomFile=react-native-${RN_VERSION}.pom
33
+    popd
34
+fi
35
+
36
+# Now build and publish the Jitsi Meet SDK and its dependencies
37
+echo "Building and publishing the Jitsi Meet SDK"
38
+pushd ${THIS_DIR}/../
39
+./gradlew clean assembleRelease publish
40
+popd
41
+
42
+# The artifacts are now on the Maven repo, commit them
43
+pushd ${MVN_REPO}
44
+if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]]; then
45
+    git add -A .
46
+    git commit -m "Jitsi Meet SDK + dependencies"
47
+fi
48
+popd
49
+
50
+# Tag the release
51
+git tag -a android-sdk-${SDK_VERSION}
52
+
53
+# Done!
54
+echo "Finished! Don't forget to push the tag and the Maven repo artifacts."

Loading…
Cancelar
Guardar