You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by do...@apache.org on 2019/04/10 09:21:24 UTC

[incubator-weex] branch master updated: * [Android] Build cpp/so in integration machine (#2301)

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

dongyayun 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 a0222db  * [Android] Build cpp/so in integration machine (#2301)
a0222db is described below

commit a0222dbefad18e7d1fb0e75a6cf5f52e887e66d3
Author: YorkShen <sh...@gmail.com>
AuthorDate: Wed Apr 10 17:21:16 2019 +0800

    * [Android] Build cpp/so in integration machine (#2301)
    
    * * [Android] Add so to build git ignore, and build it from integration environment.
    
    * * [Android] Remove project.buildCpp and ARMEABI_Size in build.gradle
---
 android/sdk/.gitignore                             |   7 ++
 android/sdk/build.gradle                           |  83 +++------------------
 android/sdk/libs/armeabi-v7a/libweexcore.so        | Bin 2160520 -> 0 bytes
 android/sdk/libs/armeabi-v7a/libweexjss.so         | Bin 554600 -> 0 bytes
 android/sdk/libs/armeabi/libweexcore.so            | Bin 2160520 -> 0 bytes
 android/sdk/libs/armeabi/libweexjss.so             | Bin 558696 -> 0 bytes
 android/sdk/libs/x86/libweexcore.so                | Bin 3356584 -> 0 bytes
 android/sdk/libs/x86/libweexjss.so                 | Bin 992888 -> 0 bytes
 .../com/taobao/weex/utils/WXSoInstallMgrSdk.java   |   9 +--
 9 files changed, 18 insertions(+), 81 deletions(-)

diff --git a/android/sdk/.gitignore b/android/sdk/.gitignore
index 4e5bda9..cb8cf1e 100755
--- a/android/sdk/.gitignore
+++ b/android/sdk/.gitignore
@@ -16,3 +16,10 @@ assets/main.js
 assets/weex-main-jsfm.js
 assets/weex-rax-api.js
 .externalNativeBuild
+
+/libs/armeabi/libweexcore.so
+/libs/armeabi/libweexjss.so
+/libs/armeabi-v7a/libweexcore.so
+/libs/armeabi-v7a/libweexjss.so
+/libs/x86/libweexcore.so
+/libs/x86/libweexjss.so
diff --git a/android/sdk/build.gradle b/android/sdk/build.gradle
index f7cca20..04b24c7 100755
--- a/android/sdk/build.gradle
+++ b/android/sdk/build.gradle
@@ -116,9 +116,6 @@ android {
         }
     }
 
-    def ARMEABI_Size = new File(projectDir,"libs/armeabi/libweexcore.so").length();
-    def ARMEABIV7_Size = new File(projectDir,"libs/armeabi-v7/libweexcore.so").length();
-    def X86_Size = new File(projectDir,"libs/x86/libweexcore.so").length();
     def ndkversion = 16;
     def api_level = "";
     def compile_tool = "clang";
@@ -128,14 +125,8 @@ android {
     } else {
         api_level = "android-19";
     }
-    println "ARMEABI_Size: "+ARMEABI_Size;
-    println "ARMEABIV7_Size:" + ARMEABIV7_Size;
-    println "X86_Size:" + X86_Size;
 
     defaultConfig {
-        buildConfigField "long", "ARMEABI_Size", "${ARMEABI_Size}"
-        buildConfigField "long", "ARMEABIV7_Size", "${ARMEABIV7_Size}"
-        buildConfigField "long", "X86_Size", "${X86_Size}"
         buildConfigField "String", "buildJavascriptFrameworkVersion", "\"${jsfmVersion}\""
         buildConfigField "String", "buildVersion", "\"${version}\""
         minSdkVersion project.minSdkVersion
@@ -152,15 +143,13 @@ android {
                 abiFilters "armeabi-v7a", "armeabi", "x86"
             }
         }
-        if(project.buildCpp) {
-            externalNativeBuild {
-                cmake {
-                    arguments '-DANDROID_PLATFORM=' + "${api_level}",
-                            '-DANDROID_TOOLCHAIN=' + "${compile_tool}",
-                            '-DANDROID_STL=' + "${cxx_stl}",
-                            '-DCMAKE_BUILD_TYPE=Release',
-                            '-DENABLE_ASAN=false'
-                }
+        externalNativeBuild {
+            cmake {
+                arguments '-DANDROID_PLATFORM=' + "${api_level}",
+                        '-DANDROID_TOOLCHAIN=' + "${compile_tool}",
+                        '-DANDROID_STL=' + "${cxx_stl}",
+                        '-DCMAKE_BUILD_TYPE=Release',
+                        '-DENABLE_ASAN=false'
             }
         }
     }
@@ -181,11 +170,9 @@ android {
         }
     }
 
-    if(project.buildCpp) {
-        externalNativeBuild {
-            cmake {
-                path '../../weex_core/CMakeLists.txt'
-            }
+    externalNativeBuild {
+        cmake {
+            path '../../weex_core/CMakeLists.txt'
         }
     }
 
@@ -371,54 +358,4 @@ bintray {
             name = project.version
         }
     }
-}
-
-def copy_so_and_backup() {
-    def cpu_list = ["armeabi", "armeabi-v7a", "x86"]
-    cpu_list.forEach { cpu_name ->
-        File so_file = new File(project.buildDir, "/intermediates/bundles/default/jni/" + cpu_name)
-        if (so_file.exists()) {
-            println(so_file.getAbsolutePath())
-            copy {
-                from so_file.getAbsolutePath()
-                into new File("libs/" + cpu_name)
-                include 'libweexjss.so', 'libweexcore.so'
-            }
-
-            if(cpu_name == "armeabi") {
-                File back_file = new File(project.buildDir, "/intermediates/cmake/release/obj/armeabi/")
-                //backup so to project'parent's path
-                File backup_des = new File(project.buildDir.parentFile.parentFile.parentFile.parentFile,"weex_so_armeabi")
-                if(backup_des.exists()){
-                    backup_des.deleteDir()
-                    backup_des.mkdir()
-                }
-                println(backup_des.absolutePath)
-
-                println("so backup to "+ backup_des.absolutePath)
-                copy {
-                    from back_file.getAbsolutePath()
-                    into backup_des
-                    include 'libweexjss.so', 'libweexcore.so'
-                }
-            }
-        }
-    }
-}
-
-task deleteLibs(type: Delete){ item->
-    project.android.defaultConfig.ndk.abiFilters.each{
-        item.delete "libs/${it}/libweexcore.so", "libs/${it}/libweexjss.so"
-    }
-}
-
-afterEvaluate { project ->
-    project.tasks.find { (it.name.contains("assembleRelease")) }?.doLast {
-        println("begin_copy_so")
-        copy_so_and_backup()
-    }
-
-    if(project.buildCpp){
-        transformNativeLibsWithStripDebugSymbolForRelease.dependsOn deleteLibs
-    }
 }
\ No newline at end of file
diff --git a/android/sdk/libs/armeabi-v7a/libweexcore.so b/android/sdk/libs/armeabi-v7a/libweexcore.so
deleted file mode 100644
index 20422d8..0000000
Binary files a/android/sdk/libs/armeabi-v7a/libweexcore.so and /dev/null differ
diff --git a/android/sdk/libs/armeabi-v7a/libweexjss.so b/android/sdk/libs/armeabi-v7a/libweexjss.so
deleted file mode 100644
index 7291bae..0000000
Binary files a/android/sdk/libs/armeabi-v7a/libweexjss.so and /dev/null differ
diff --git a/android/sdk/libs/armeabi/libweexcore.so b/android/sdk/libs/armeabi/libweexcore.so
deleted file mode 100644
index 32d0f9f..0000000
Binary files a/android/sdk/libs/armeabi/libweexcore.so and /dev/null differ
diff --git a/android/sdk/libs/armeabi/libweexjss.so b/android/sdk/libs/armeabi/libweexjss.so
deleted file mode 100644
index 162b3e6..0000000
Binary files a/android/sdk/libs/armeabi/libweexjss.so and /dev/null differ
diff --git a/android/sdk/libs/x86/libweexcore.so b/android/sdk/libs/x86/libweexcore.so
deleted file mode 100644
index e2e0dd7..0000000
Binary files a/android/sdk/libs/x86/libweexcore.so and /dev/null differ
diff --git a/android/sdk/libs/x86/libweexjss.so b/android/sdk/libs/x86/libweexjss.so
deleted file mode 100644
index bb1a94a..0000000
Binary files a/android/sdk/libs/x86/libweexjss.so and /dev/null differ
diff --git a/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java b/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java
index 21da780..a43be0e 100644
--- a/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java
+++ b/android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java
@@ -21,16 +21,13 @@ package com.taobao.weex.utils;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
 import android.os.Build;
-import android.system.ErrnoException;
-import android.system.Os;
 import android.text.TextUtils;
-
 import com.taobao.weex.IWXStatisticsListener;
 import com.taobao.weex.WXEnvironment;
 import com.taobao.weex.adapter.IWXSoLoaderAdapter;
 import com.taobao.weex.adapter.IWXUserTrackAdapter;
 import com.taobao.weex.common.WXErrorCode;
-
+import dalvik.system.PathClassLoader;
 import java.io.BufferedReader;
 import java.io.Closeable;
 import java.io.File;
@@ -48,8 +45,6 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipException;
 import java.util.zip.ZipFile;
 
-import dalvik.system.PathClassLoader;
-
 
 /**
  * Utility class for managing so library, including load native library and version management.
@@ -76,8 +71,6 @@ public class WXSoInstallMgrSdk {
   private final static String STARTUPSO = "/libweexjsb.so";
   private final static String STARTUPSOANDROID15 = "/libweexjst.so";
 
-  private final static int ARMEABI_Size = 3583820;
-  private final static int X86_Size = 4340864;
 
   static Context mContext = null;
   private static IWXSoLoaderAdapter mSoLoader = null;