Skip to content
This repository was archived by the owner on Jun 3, 2021. It is now read-only.

Commit a0222db

Browse files
YorkShenDarin726
authored andcommitted
* [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
1 parent f3f08b6 commit a0222db

File tree

9 files changed

+18
-81
lines changed

9 files changed

+18
-81
lines changed

android/sdk/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,10 @@ assets/main.js
1616
assets/weex-main-jsfm.js
1717
assets/weex-rax-api.js
1818
.externalNativeBuild
19+
20+
/libs/armeabi/libweexcore.so
21+
/libs/armeabi/libweexjss.so
22+
/libs/armeabi-v7a/libweexcore.so
23+
/libs/armeabi-v7a/libweexjss.so
24+
/libs/x86/libweexcore.so
25+
/libs/x86/libweexjss.so

android/sdk/build.gradle

Lines changed: 10 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ android {
116116
}
117117
}
118118

119-
def ARMEABI_Size = new File(projectDir,"libs/armeabi/libweexcore.so").length();
120-
def ARMEABIV7_Size = new File(projectDir,"libs/armeabi-v7/libweexcore.so").length();
121-
def X86_Size = new File(projectDir,"libs/x86/libweexcore.so").length();
122119
def ndkversion = 16;
123120
def api_level = "";
124121
def compile_tool = "clang";
@@ -128,14 +125,8 @@ android {
128125
} else {
129126
api_level = "android-19";
130127
}
131-
println "ARMEABI_Size: "+ARMEABI_Size;
132-
println "ARMEABIV7_Size:" + ARMEABIV7_Size;
133-
println "X86_Size:" + X86_Size;
134128

135129
defaultConfig {
136-
buildConfigField "long", "ARMEABI_Size", "${ARMEABI_Size}"
137-
buildConfigField "long", "ARMEABIV7_Size", "${ARMEABIV7_Size}"
138-
buildConfigField "long", "X86_Size", "${X86_Size}"
139130
buildConfigField "String", "buildJavascriptFrameworkVersion", "\"${jsfmVersion}\""
140131
buildConfigField "String", "buildVersion", "\"${version}\""
141132
minSdkVersion project.minSdkVersion
@@ -152,15 +143,13 @@ android {
152143
abiFilters "armeabi-v7a", "armeabi", "x86"
153144
}
154145
}
155-
if(project.buildCpp) {
156-
externalNativeBuild {
157-
cmake {
158-
arguments '-DANDROID_PLATFORM=' + "${api_level}",
159-
'-DANDROID_TOOLCHAIN=' + "${compile_tool}",
160-
'-DANDROID_STL=' + "${cxx_stl}",
161-
'-DCMAKE_BUILD_TYPE=Release',
162-
'-DENABLE_ASAN=false'
163-
}
146+
externalNativeBuild {
147+
cmake {
148+
arguments '-DANDROID_PLATFORM=' + "${api_level}",
149+
'-DANDROID_TOOLCHAIN=' + "${compile_tool}",
150+
'-DANDROID_STL=' + "${cxx_stl}",
151+
'-DCMAKE_BUILD_TYPE=Release',
152+
'-DENABLE_ASAN=false'
164153
}
165154
}
166155
}
@@ -181,11 +170,9 @@ android {
181170
}
182171
}
183172

184-
if(project.buildCpp) {
185-
externalNativeBuild {
186-
cmake {
187-
path '../../weex_core/CMakeLists.txt'
188-
}
173+
externalNativeBuild {
174+
cmake {
175+
path '../../weex_core/CMakeLists.txt'
189176
}
190177
}
191178

@@ -371,54 +358,4 @@ bintray {
371358
name = project.version
372359
}
373360
}
374-
}
375-
376-
def copy_so_and_backup() {
377-
def cpu_list = ["armeabi", "armeabi-v7a", "x86"]
378-
cpu_list.forEach { cpu_name ->
379-
File so_file = new File(project.buildDir, "/intermediates/bundles/default/jni/" + cpu_name)
380-
if (so_file.exists()) {
381-
println(so_file.getAbsolutePath())
382-
copy {
383-
from so_file.getAbsolutePath()
384-
into new File("libs/" + cpu_name)
385-
include 'libweexjss.so', 'libweexcore.so'
386-
}
387-
388-
if(cpu_name == "armeabi") {
389-
File back_file = new File(project.buildDir, "/intermediates/cmake/release/obj/armeabi/")
390-
//backup so to project'parent's path
391-
File backup_des = new File(project.buildDir.parentFile.parentFile.parentFile.parentFile,"weex_so_armeabi")
392-
if(backup_des.exists()){
393-
backup_des.deleteDir()
394-
backup_des.mkdir()
395-
}
396-
println(backup_des.absolutePath)
397-
398-
println("so backup to "+ backup_des.absolutePath)
399-
copy {
400-
from back_file.getAbsolutePath()
401-
into backup_des
402-
include 'libweexjss.so', 'libweexcore.so'
403-
}
404-
}
405-
}
406-
}
407-
}
408-
409-
task deleteLibs(type: Delete){ item->
410-
project.android.defaultConfig.ndk.abiFilters.each{
411-
item.delete "libs/${it}/libweexcore.so", "libs/${it}/libweexjss.so"
412-
}
413-
}
414-
415-
afterEvaluate { project ->
416-
project.tasks.find { (it.name.contains("assembleRelease")) }?.doLast {
417-
println("begin_copy_so")
418-
copy_so_and_backup()
419-
}
420-
421-
if(project.buildCpp){
422-
transformNativeLibsWithStripDebugSymbolForRelease.dependsOn deleteLibs
423-
}
424361
}
-2.06 MB
Binary file not shown.
-542 KB
Binary file not shown.
-2.06 MB
Binary file not shown.
-546 KB
Binary file not shown.

android/sdk/libs/x86/libweexcore.so

-3.2 MB
Binary file not shown.

android/sdk/libs/x86/libweexjss.so

-970 KB
Binary file not shown.

android/sdk/src/main/java/com/taobao/weex/utils/WXSoInstallMgrSdk.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@
2121
import android.content.Context;
2222
import android.content.pm.ApplicationInfo;
2323
import android.os.Build;
24-
import android.system.ErrnoException;
25-
import android.system.Os;
2624
import android.text.TextUtils;
27-
2825
import com.taobao.weex.IWXStatisticsListener;
2926
import com.taobao.weex.WXEnvironment;
3027
import com.taobao.weex.adapter.IWXSoLoaderAdapter;
3128
import com.taobao.weex.adapter.IWXUserTrackAdapter;
3229
import com.taobao.weex.common.WXErrorCode;
33-
30+
import dalvik.system.PathClassLoader;
3431
import java.io.BufferedReader;
3532
import java.io.Closeable;
3633
import java.io.File;
@@ -48,8 +45,6 @@
4845
import java.util.zip.ZipException;
4946
import java.util.zip.ZipFile;
5047

51-
import dalvik.system.PathClassLoader;
52-
5348

5449
/**
5550
* Utility class for managing so library, including load native library and version management.
@@ -76,8 +71,6 @@ public class WXSoInstallMgrSdk {
7671
private final static String STARTUPSO = "/libweexjsb.so";
7772
private final static String STARTUPSOANDROID15 = "/libweexjst.so";
7873

79-
private final static int ARMEABI_Size = 3583820;
80-
private final static int X86_Size = 4340864;
8174

8275
static Context mContext = null;
8376
private static IWXSoLoaderAdapter mSoLoader = null;

0 commit comments

Comments
 (0)