You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2020/03/14 12:55:44 UTC

[incubator-weex] branch master updated: Feature(Android): Support x86_64 (#3167)

This is an automated email from the ASF dual-hosted git repository.

kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new a675c3e  Feature(Android): Support x86_64 (#3167)
a675c3e is described below

commit a675c3e151f3fa9339157882c4f44d7452206952
Author: YorkShen <sh...@gmail.com>
AuthorDate: Sat Mar 14 20:55:33 2020 +0800

    Feature(Android): Support x86_64 (#3167)
---
 .travis.yml                                      | 23 +++++++++++---
 android/README.md                                |  5 +--
 android/sdk/build.gradle                         |  4 +++
 android/sdk/buildSrc/asan.gradle                 |  2 ++
 android/sdk/buildSrc/download_jsc.gradle         |  3 +-
 android/sdk/build_jss_r.sh                       | 40 ------------------------
 weex-playground                                  |  2 +-
 weex_core/Source/CMakeLists.txt                  |  2 +-
 weex_core/Source/android/jsengine/CMakeLists.txt |  5 ++-
 weex_core/Source/base/CMakeLists.txt             |  2 +-
 weex_core/Source/js_runtime/CMakeLists.txt       |  5 ++-
 weex_core/debug.sh                               | 13 --------
 weex_core/release.sh                             | 28 -----------------
 13 files changed, 39 insertions(+), 95 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 6ecd0eb..cf07b92 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -34,6 +34,14 @@ matrix:
           components:
             - android-26
             - extra-android-m2repository 
+      - env: TEST_SUITE=android ABI=x86_64
+        language: android
+        dist: trusty
+        jdk: oraclejdk8
+        android:
+          components:
+            - android-26
+            - extra-android-m2repository 
       # static check
       - env: TEST_SUITE=static_code_analysis OCLINT=true
         os: osx
@@ -126,13 +134,16 @@ script:
       "android") 
         case $ABI in
           "armeabi-v7a" )
-            GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false"
+            GRADLE_ABI="-PsupportArmeabi-v7a=true -PsupportArm64-v8a=false -PsupportX86=false -PsupportX86_64=false"
             ;;
           "arm64-v8a" )
-            GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false" 
+            GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=true -PsupportX86=false -PsupportX86_64=false" 
             ;;
           "x86" )
-            GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true"
+            GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=true -PsupportX86_64=false"
+            ;;
+          "x86_64" )
+            GRADLE_ABI="-PsupportArmeabi-v7a=false -PsupportArm64-v8a=false -PsupportX86=false -PsupportX86_64=true"
             ;;
           "*" )
             GRADLE_ABI=""
@@ -141,9 +152,11 @@ script:
         if npm run danger -- ci --dangerfile ./dangerfile-android.js | grep -q "hasAndroidFile" ; then
           cd android
           ./gradlew clean assembleRelease --quiet -PbuildRuntimeApi=true ${GRADLE_ABI} -PapachePackageName="false" || exit 1
-          ./gradlew assembleRelease --quiet ${GRADLE_ABI} -PbuildRuntimeApi=false -Pjsc_url="https://raw.githubusercontent.com/apache/incubator-weex/release/0.26/android/sdk/weex_sdk-0.26.0.aar" -Paar_name="weex_sdk" -PJSInterpolatorName="JavaScriptCore" -PapachePackageName="false" || exit 1
           ./gradlew :weex_sdk:assembleRelease --quiet -PbuildRuntimeApi=true ${GRADLE_ABI} -PapachePackageName="true" || exit 1
-          ./gradlew :weex_sdk:assembleRelease --quiet  ${GRADLE_ABI} -PbuildRuntimeApi=false -Pjsc_url="https://raw.githubusercontent.com/apache/incubator-weex/release/0.26/android/sdk/weex_sdk-0.26.0.aar" -Paar_name="weex_sdk" -PJSInterpolatorName="JavaScriptCore" -PapachePackageName="true" || exit 1
+          if [[ "$ABI" != "x86_64" ]]; then
+            ./gradlew assembleRelease --quiet ${GRADLE_ABI} -PbuildRuntimeApi=false -Pjsc_url="https://raw.githubusercontent.com/apache/incubator-weex/release/0.26/android/sdk/weex_sdk-0.26.0.aar" -Paar_name="weex_sdk" -PJSInterpolatorName="JavaScriptCore" -PapachePackageName="false" || exit 1
+            ./gradlew :weex_sdk:assembleRelease --quiet  ${GRADLE_ABI} -PbuildRuntimeApi=false -Pjsc_url="https://raw.githubusercontent.com/apache/incubator-weex/release/0.26/android/sdk/weex_sdk-0.26.0.aar" -Paar_name="weex_sdk" -PJSInterpolatorName="JavaScriptCore" -PapachePackageName="true" || exit 1
+          fi
         fi
         ;;
       "jsfm" )
diff --git a/android/README.md b/android/README.md
index c88cff2..608f0b3 100644
--- a/android/README.md
+++ b/android/README.md
@@ -35,9 +35,10 @@ When some commits of  playground rely on unpublished features of weex-sdk,a SNAP
 
 ```
 cd android
-./gradlew clean install ArtifactoryPublish -PgroupId="org.apache.weex" -PartifactName="sdk_legacy" -PapachePackageName="false" -PunbundlingJSC="true" -PbuildRuntimeApi=true -PweexVersion=$PUBLISH_VERSION -PbintrayUser=weex -PbintrayApiKey=$JCENTER_TOKEN 
+./gradlew clean install artifactoryPublish -PgroupId="org.apache.weex" -PartifactName="sdk_legacy"
+-PapachePackageName="false" -PunbundlingJSC="true" -PbuildRuntimeApi=true -PweexVersion=$PUBLISH_VERSION -PbintrayUser=weex -PbintrayApiKey=$JCENTER_TOKEN
 ```
 
 * Explanation for variable:  
 $PUBLISH_VERSION The version of snapshot, like 0.26.1.3-SNAPSHOT  
-$JCENTER_TOKEN The private key for JCenter (https://bintray.com/alibabaweex/maven/weex_sdk/), which is the distribution channel for Android
\ No newline at end of file
+$JCENTER_TOKEN The private key for JCenter (https://bintray.com/weex/Android/sdk), which is the distribution channel for Android
\ No newline at end of file
diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle
index 15be1de..97e1fc4 100755
--- a/android/sdk/build.gradle
+++ b/android/sdk/build.gradle
@@ -64,6 +64,7 @@ android {
             exclude 'lib/armeabi-v7a/libc++_shared.so'
             exclude 'lib/arm64-v8a/libc++_shared.so'
             exclude 'lib/x86/libc++_shared.so'
+            exclude 'lib/x86_64/libc++_shared.so'
         }
     }
     copy {
@@ -133,6 +134,9 @@ android {
             if(!project.hasProperty('supportX86') || "false" != project.getProperty('supportX86')){
                 abiFilters 'x86'
             }
+            if(!project.hasProperty('supportX86_64') || "false" != project.getProperty('supportX86_64')){
+                abiFilters 'x86_64'
+            }
         }
         externalNativeBuild {
             cmake {
diff --git a/android/sdk/buildSrc/asan.gradle b/android/sdk/buildSrc/asan.gradle
index df81979..168ae47 100644
--- a/android/sdk/buildSrc/asan.gradle
+++ b/android/sdk/buildSrc/asan.gradle
@@ -58,6 +58,8 @@ task copyASanLib(type: Copy){
             renamedAbi = "aarch64"
         if (asanAbi == "x86")
             renamedAbi = "i686"
+        if (asanAbi == "x86_64")
+            renamedAbi = "x86_64"
         new File(dir).eachFileRecurse { file ->
             if (file.name == 'libclang_rt.asan-' + renamedAbi + '-android.so')
                 from file.absolutePath
diff --git a/android/sdk/buildSrc/download_jsc.gradle b/android/sdk/buildSrc/download_jsc.gradle
index c75c90e..d49ac86 100644
--- a/android/sdk/buildSrc/download_jsc.gradle
+++ b/android/sdk/buildSrc/download_jsc.gradle
@@ -70,8 +70,7 @@ task copyJscToJniDir(type: Copy, dependsOn: unzipJSC) {
     into libsDir
     include 'jni/**/*.so'
     exclude '**/libweexcore.so', '**/libweexjsb.so', '**/libweexjss.so',
-            '**/libweexjssr.so', '**/libweexjst.so', '**/libc++_shared.so',
-            '**/x86_64/**'
+            '**/libweexjssr.so', '**/libweexjst.so', '**/libc++_shared.so'
     includeEmptyDirs false
     eachFile {
         def path_list = new LinkedList<>(it.relativePath.segments.toList())
diff --git a/android/sdk/build_jss_r.sh b/android/sdk/build_jss_r.sh
deleted file mode 100755
index cf0a5a0..0000000
--- a/android/sdk/build_jss_r.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-echo "--> # buils jsc_runtime so"
-
-
-../gradlew assembleRelease  -PbuildRuntimeApi=true 
-
-
-echo "--> ## cp jss_runtime so"
-
-unzip -o build/outputs/aar/weex_sdk-release.aar -d build/outputs/aar/weex_sdk-release
-
-
-cp build/outputs/aar/weex_sdk-release/jni/armeabi-v7a/libweexjss.so libs/armeabi-v7a/libweexjssr.so
-cp build/outputs/aar/weex_sdk-release/jni/arm64-v8a/libweexjss.so libs/arm64-v8a/libweexjssr.so
-cp build/outputs/aar/weex_sdk-release/jni/x86/libweexjss.so libs/x86/libweexjssr.so
-
-
-echo "--> ## cp jss_runtime Symbol so"
-
-rm -rf unstrippedSo
-mkdir unstrippedSo
-
-cp build/unstrippedSo/armeabi-v7a_libweexjss.so unstrippedSo/armeabi-v7a_libweexjssr.so
-cp build/unstrippedSo/arm64-v8a_libweexjss.so unstrippedSo/arm64-v8a_libweexjssr.so
-cp build/unstrippedSo/x86_libweexjss.so unstrippedSo/x86_libweexjssr.so
\ No newline at end of file
diff --git a/weex-playground b/weex-playground
index 2cb8f27..7fe693d 160000
--- a/weex-playground
+++ b/weex-playground
@@ -1 +1 @@
-Subproject commit 2cb8f2740fe51917f945c4423b6720c77beb95af
+Subproject commit 7fe693dde0f6710553f08840be785392209c611d
diff --git a/weex_core/Source/CMakeLists.txt b/weex_core/Source/CMakeLists.txt
index 34da3c1..2b7a392 100755
--- a/weex_core/Source/CMakeLists.txt
+++ b/weex_core/Source/CMakeLists.txt
@@ -44,7 +44,7 @@ add_definitions(-DDEBUG=1)
 message("ANDROID_PROJECT_DIR:"${ANDROID_PROJECT_DIR})
 set(LOCAL_LIBRARIES_DIR ${ANDROID_PROJECT_DIR}/src/main/jniLibs/${ANDROID_ABI})
 
-if ("${ANDROID_ABI}" STREQUAL "x86")
+if ("${ANDROID_ABI}" STREQUAL "x86" OR "${ANDROID_ABI}" STREQUAL "x86_64")
     # todo
 else ()
     if ("${ENABLE_ASAN}" STREQUAL "true")
diff --git a/weex_core/Source/android/jsengine/CMakeLists.txt b/weex_core/Source/android/jsengine/CMakeLists.txt
index 098e376..4c0a691 100644
--- a/weex_core/Source/android/jsengine/CMakeLists.txt
+++ b/weex_core/Source/android/jsengine/CMakeLists.txt
@@ -46,8 +46,11 @@ elseif ("${ANDROID_ABI}" STREQUAL "armeabi-v7a")
 elseif("${ANDROID_ABI}" STREQUAL "arm64-v8a")
     add_definitions(-DWTF_CPU_ARM64)
     set(WTF_CPU_ARM64 1)
-else ()
+elseif("${ANDROID_ABI}" STREQUAL "x86")
     add_definitions(-DWTF_CPU_X86)
+    set(WTF_CPU_X86 1)
+elseif("${ANDROID_ABI}" STREQUAL "x86_64")
+    add_definitions(-DWTF_CPU_X86_64)
     set(WTF_CPU_X86_64 1)
 endif ()
 
diff --git a/weex_core/Source/base/CMakeLists.txt b/weex_core/Source/base/CMakeLists.txt
index 11088bd..9818ecb 100644
--- a/weex_core/Source/base/CMakeLists.txt
+++ b/weex_core/Source/base/CMakeLists.txt
@@ -69,7 +69,7 @@ set(${BASE_LIBRARY_NAME}_SOURCES
 
 if (ANDROID)
     add_definitions(-DOS_ANDROID=1)
-    if ("${ANDROID_ABI}" STREQUAL "x86" OR "${ANDROID_ABI}" STREQUAL "arm64-v8a")
+    if ("${ANDROID_ABI}" STREQUAL "x86" OR "${ANDROID_ABI}" STREQUAL "arm64-v8a" OR "${ANDROID_ABI}" STREQUAL "x86_64")
     else ()
       list(APPEND ${BASE_LIBRARY_NAME}_SOURCES
           crash/backtrace.h
diff --git a/weex_core/Source/js_runtime/CMakeLists.txt b/weex_core/Source/js_runtime/CMakeLists.txt
index b62b59b..feed09e 100644
--- a/weex_core/Source/js_runtime/CMakeLists.txt
+++ b/weex_core/Source/js_runtime/CMakeLists.txt
@@ -73,8 +73,11 @@ elseif ("${ANDROID_ABI}" STREQUAL "armeabi-v7a")
 elseif("${ANDROID_ABI}" STREQUAL "arm64-v8a")
     add_definitions(-DWTF_CPU_ARM64)
     set(WTF_CPU_ARM64 1)
-else ()
+elseif("${ANDROID_ABI}" STREQUAL "x86")
     add_definitions(-DWTF_CPU_X86)
+    set(WTF_CPU_X86 1)
+elseif("${ANDROID_ABI}" STREQUAL "x86_64")
+    add_definitions(-DWTF_CPU_X86_64)
     set(WTF_CPU_X86_64 1)
 endif ()
 
diff --git a/weex_core/debug.sh b/weex_core/debug.sh
deleted file mode 100755
index 6315925..0000000
--- a/weex_core/debug.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-cd ../android/sdk
-../gradlew assembleDebug
-cd ..
-cp sdk/build/intermediates/cmake/debug/obj/armeabi/libweexcore.so sdk/libs/armeabi/libweexcore.so
-##cp sdk/build/intermediates/cmake/debug/obj/armeabi-v7a/libweexcore.so sdk/libs/armeabi-v7a/libweexcore.so
-##cp sdk/build/intermediates/cmake/debug/obj/x86/libweexcore.so sdk/libs/x86/libweexcore.so
-
-cp sdk/build/intermediates/cmake/debug/obj/armeabi/libweexjss.so sdk/libs/armeabi/libweexjss.so
-##cp sdk/build/intermediates/cmake/debug/obj/armeabi-v7a/libweexjss.so sdk/libs/armeabi-v7a/libweexjss.so
-##cp sdk/build/intermediates/cmake/debug/obj/x86/libweexjss.so sdk/libs/x86/libweexjss.so
-export ANDROID_NDK='/Users/furture/Library/Android/sdk/android-ndk-r16b'
-${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/bin/strip -s sdk/libs/armeabi/libweexcore.so
-${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/arm-linux-androideabi/bin/strip -s sdk/libs/armeabi/libweexjss.so
diff --git a/weex_core/release.sh b/weex_core/release.sh
deleted file mode 100755
index 7bff147..0000000
--- a/weex_core/release.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-cd ../android
-#rm -rf sdk/build/intermediates/bundles/default/jni/*
-./gradlew  assembleRelease clean  -PbuildRuntimeApi=true
-
-#cp sdk/build/intermediates/bundles/default/jni/armeabi/libweexcore.so sdk/libs/armeabi/libweexcore.so
-#cp sdk/build/intermediates/bundles/default/jni/armeabi-v7a/libweexcore.so sdk/libs/armeabi-v7a/libweexcore.so
-#cp sdk/build/intermediates/bundles/default/jni/x86/libweexcore.so sdk/libs/x86/libweexcore.so
-
-# cp jss so
-
-cp sdk/build/intermediates/intermediate-jars/release/jni/arm64-v8a/libweexjss.so sdk/libs/arm64-v8a/libweexjssr.so
-cp sdk/build/intermediates/intermediate-jars/release/jni/armeabi-v7a/libweexjss.so sdk/libs/armeabi-v7a/libweexjssr.so
-cp sdk/build/intermediates/intermediate-jars/release/jni/x86/libweexjss.so sdk/libs/x86/libweexjssr.so
-
-
-
-
-# back up obj
-
-rm -rf ~/Desktop/weex_so_armeabi
-mkdir ~/Desktop/weex_so_armeabi
-cp sdk/build/intermediates/cmake/release/obj/arm64-v8a/libweexjss.so ~/Desktop/weex_so_armeabi/libweexjssr_64_v8a.so
-cp sdk/build/intermediates/cmake/release/obj/armeabi-v7a/libweexjss.so ~/Desktop/weex_so_armeabi/libweexjssr_v7a.so
-cp sdk/build/intermediates/cmake/release/obj/x86/libweexjss.so ~/Desktop/weex_so_armeabi/libweexjssr_x86.so
-
-
-
-./gradlew  assembleRelease -PbuildRuntimeApi=false
\ No newline at end of file