ソースを参照

android: prepare SDK build for Hermes

We need to push the Hermes AAR to Maven and have the SDK depend on it.
master
Saúl Ibarra Corretgé 5年前
コミット
306c8ba8c2
2個のファイルの変更32行の追加14行の削除
  1. 18
    14
      android/scripts/release-sdk.sh
  2. 14
    0
      android/sdk/build.gradle

+ 18
- 14
android/scripts/release-sdk.sh ファイルの表示

@@ -10,7 +10,7 @@ MVN_HTTP=0
10 10
 DEFAULT_SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
11 11
 SDK_VERSION=${OVERRIDE_SDK_VERSION:-${DEFAULT_SDK_VERSION}}
12 12
 RN_VERSION=$(jq -r '.dependencies."react-native"' ${THIS_DIR}/../../package.json)
13
-JSC_VERSION="r"$(jq -r '.dependencies."jsc-android"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -d . -f 1 | cut -c 2-)
13
+HERMES_VERSION=$(jq -r '.dependencies."hermes-engine"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -c 2-)
14 14
 DO_GIT_TAG=${GIT_TAG:-0}
15 15
 
16 16
 if [[ $THE_MVN_REPO == http* ]]; then
@@ -38,17 +38,19 @@ if [[ $MVN_HTTP == 1 ]]; then
38 38
         -DgeneratePom=false \
39 39
         -DpomFile=react-native-${RN_VERSION}.pom || true
40 40
     popd
41
-    # Push JSC
42
-    echo "Pushing JSC ${JSC_VERSION} to the Maven repo"
43
-    pushd ${THIS_DIR}/../../node_modules/jsc-android/dist/org/webkit/android-jsc/${JSC_VERSION}
41
+    # Push Hermes
42
+    echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
43
+    pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
44 44
     mvn \
45 45
         deploy:deploy-file \
46 46
         -Durl=${MVN_REPO} \
47 47
         -DrepositoryId=${MVN_REPO_ID} \
48
-        -Dfile=android-jsc-${JSC_VERSION}.aar \
48
+        -Dfile=hermes-release.aar \
49 49
         -Dpackaging=aar \
50
-        -DgeneratePom=false \
51
-        -DpomFile=android-jsc-${JSC_VERSION}.pom || true
50
+        -DgroupId=com.facebook \
51
+        -DartifactId=hermes \
52
+        -Dversion=${HERMES_VERSION} \
53
+        -DgeneratePom=true || true
52 54
     popd
53 55
 else
54 56
     # Push React Native, if necessary
@@ -65,17 +67,19 @@ else
65 67
         popd
66 68
     fi
67 69
 
68
-    # Push JSC, if necessary
69
-    if [[ ! -d ${MVN_REPO}/org/webkit/android-jsc/${JSC_VERSION} ]]; then
70
-        echo "Pushing JSC ${JSC_VERSION} to the Maven repo"
71
-        pushd ${THIS_DIR}/../../node_modules/jsc-android/dist/org/webkit/android-jsc/${JSC_VERSION}
70
+    # Push Hermes, if necessary
71
+    if [[ ! -d ${MVN_REPO}/com/facebook/hermes/${HERMES_VERSION} ]]; then
72
+        echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
73
+        pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
72 74
         mvn \
73 75
             deploy:deploy-file \
74 76
             -Durl=${MVN_REPO} \
75
-            -Dfile=android-jsc-${JSC_VERSION}.aar \
77
+            -Dfile=hermes-release.aar \
76 78
             -Dpackaging=aar \
77
-            -DgeneratePom=false \
78
-            -DpomFile=android-jsc-${JSC_VERSION}.pom
79
+            -DgroupId=com.facebook \
80
+            -DartifactId=hermes \
81
+            -Dversion=${HERMES_VERSION} \
82
+            -DgeneratePom=true
79 83
         popd
80 84
     fi
81 85
 

+ 14
- 0
android/sdk/build.gradle ファイルの表示

@@ -1,3 +1,5 @@
1
+import groovy.json.JsonSlurper
2
+
1 3
 apply plugin: 'com.android.library'
2 4
 apply plugin: 'maven-publish'
3 5
 
@@ -31,6 +33,10 @@ android {
31 33
             }
32 34
         }
33 35
     }
36
+
37
+    packagingOptions {
38
+        pickFirst '**/libc++_shared.so'
39
+    }
34 40
 }
35 41
 
36 42
 dependencies {
@@ -218,6 +224,14 @@ publishing {
218 224
                     dependency.appendNode('artifactId', artifactId)
219 225
                     dependency.appendNode('version', it.moduleVersion)
220 226
                 }
227
+
228
+                // Add Hermes dependency.
229
+                def hermesPkg = new File("$rootDir/../node_modules/hermes-engine/package.json")
230
+                def hermesVersion = new JsonSlurper().parseText(hermesPkg.text).version
231
+                def hermesDependency = dependencies.appendNode('dependency')
232
+                hermesDependency.appendNode('groupId', "com.facebook")
233
+                hermesDependency.appendNode('artifactId', "hermes")
234
+                hermesDependency.appendNode('version', hermesVersion)
221 235
             }
222 236
         }
223 237
 

読み込み中…
キャンセル
保存