Skip to content

Commit

Permalink
[jsruntime] add runtime code (a/b) and build success
Browse files Browse the repository at this point in the history
[Android] rebuild jsc for initHeapTimer and jsruntme/old  code are work fine

[jsruntime] dom_wson switch fix

[Android] add args check fix && add a/b so load/update logic

[Android] build logic for a/b and __enable_native_promise__ flag

Fix License issue for javaScriptCore (apache#2498)

License under following directory:
* `weex_core/Source/include/JavaScriptCore`
* `weex_core/Source/include/wtf`

Update license

Update Android Build Script and License.

[Android] update jsc.so

[Android] update jsfm to 0.27

[Android] add data record

[Android] add build script for build runtime-jss.so

load so dynamic

[Android] fix icu init

fix v7a build

[Android] fix jsfm switch promise flag
  • Loading branch information
lucky-chen authored and zhongcang committed Jul 10, 2019
1 parent 7e274f2 commit 4754cb7
Show file tree
Hide file tree
Showing 1,395 changed files with 38,578 additions and 19,217 deletions.
618 changes: 431 additions & 187 deletions LICENSE

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ public void onCreate() {
if(!TextUtils.isEmpty(BuildConfig.externalLibraryName)){
builder.addNativeLibrary(BuildConfig.externalLibraryName);
}
WXSDKEngine.initialize(this, builder.build());
WXSDKManager.getInstance().setWxConfigAdapter(new DefaultConfigAdapter());
WXSDKEngine.initialize(this, builder.build());
WXSDKManager.getInstance().addWXAnalyzer(new WXAnalyzerDemoListener());
WXAnalyzerDataTransfer.isOpenPerformance = false;

Expand Down
63 changes: 33 additions & 30 deletions android/sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ android {

def android_project_dir = projectDir

def buildRuntimeApi = project.hasProperty('buildRuntimeApi') ? project.property('buildRuntimeApi') : true

defaultConfig {
buildConfigField "String", "buildJavascriptFrameworkVersion", "\"${jsfmVersion}\""
buildConfigField "String", "buildVersion", "\"${version}\""
Expand All @@ -129,7 +131,7 @@ android {
versionName project.version
ndk {
if(!project.hasProperty('supportArmeabi-v7a') || "false" != project.getProperty('supportArmeabi-v7a')){
abiFilters 'arm64-v8a'
abiFilters 'armeabi-v7a'
}

if(!project.hasProperty('supportArm64-v8a') || "false" != project.getProperty('supportArm64-v8a')){
Expand All @@ -147,7 +149,8 @@ android {
'-DANDROID_STL=' + "${cxx_stl}",
'-DCMAKE_BUILD_TYPE=Release',
'-DANDROID_PROJECT_DIR=' + "${android_project_dir}",
'-DENABLE_ASAN=false'
'-DENABLE_ASAN=false',
'-DBUILD_RUNTIME_API='+"${buildRuntimeApi}"
}
}
}
Expand Down Expand Up @@ -228,34 +231,34 @@ dependencies {
testImplementation 'org.json:json:20160212'
}

if(file('../license/LICENSE').exists()){
license {
header = file('../license/LICENSE')
mapping('cpp','JAVADOC_STYLE')
mapping('h','JAVADOC_STYLE')
excludes(['com/taobao/weex/utils/WXDataStructureUtil.java'])
}

task weex_core_license(type: com.hierynomus.gradle.license.tasks.LicenseFormat){
source = fileTree(dir:"../../weex_core").include(['**/*.h','**/*.cpp', '**/*.cc', '**/*.c']).
exclude(['Source/rapidjson/**/*.h','Source/rapidjson/**/*.cpp',
'Source/android/base/base64/**/*.h','Source/android/base/base64/**/*.cpp',
'Source/android/jniprebuild/jniheader/*.h',
'Source/base/Compatible.cpp',
'Source/IPC/**/*.h','Source/IPC/**/*.cpp', 'Source/IPC/**/*.c',
'Source/base/third_party/icu/*.h',
'Source/base/third_party/icu/*.cpp',
'Source/android/jsengine/dependence/**/*.h',
'Source/android/jsengine/dependence/**/*.cpp',
'Source/include/wtf/**/*.h',
'Source/include/wtf/**/*.c',
'Source/include/wtf/**/*.cpp',
'Source/include/JavaScriptCore/**/*.h',
'Source/include/JavaScriptCore/**/*.c',
'Source/include/JavaScriptCore/**/*.cpp'])
}
preBuild.dependsOn licenseFormat
}
if(file('../license/LICENSE').exists()){
license {
header = file('../license/LICENSE')
mapping('cpp','JAVADOC_STYLE')
mapping('h','JAVADOC_STYLE')
excludes(['com/taobao/weex/utils/WXDataStructureUtil.java'])
}

task weex_core_license(type: com.hierynomus.gradle.license.tasks.LicenseFormat){
source = fileTree(dir:"../../weex_core").include(['**/*.h','**/*.cpp', '**/*.cc', '**/*.c']).
exclude(['Source/rapidjson/**/*.h','Source/rapidjson/**/*.cpp',
'Source/android/base/base64/**/*.h','Source/android/base/base64/**/*.cpp',
'Source/android/jniprebuild/jniheader/*.h',
'Source/base/Compatible.cpp',
'Source/IPC/**/*.h','Source/IPC/**/*.cpp', 'Source/IPC/**/*.c',
'Source/base/third_party/icu/*.h',
'Source/base/third_party/icu/*.cpp',
'Source/android/jsengine/dependence/**/*.h',
'Source/android/jsengine/dependence/**/*.cpp',
'Source/include/wtf/**/*.h',
'Source/include/wtf/**/*.c',
'Source/include/wtf/**/*.cpp',
'Source/include/JavaScriptCore/**/*.h',
'Source/include/JavaScriptCore/**/*.c',
'Source/include/JavaScriptCore/**/*.cpp'])
}
preBuild.dependsOn licenseFormat
}

task checkNdkVersion() {
def rootDir = project.rootDir
Expand Down
24 changes: 24 additions & 0 deletions android/sdk/build_jss_r.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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
Binary file modified android/sdk/libs/arm64-v8a/libJavaScriptCore.so
Binary file not shown.
Binary file modified android/sdk/libs/armeabi-v7a/libJavaScriptCore.so
Binary file not shown.
Binary file modified android/sdk/libs/x86/libJavaScriptCore.so
Binary file not shown.
11 changes: 10 additions & 1 deletion android/sdk/src/main/java/com/taobao/weex/WXEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public class WXEnvironment {

public static boolean AUTO_UPDATE_APPLICATION_SCREEN_SIZE = true;

public static volatile boolean sUseRunTimeApi = false;

/**
* Debug model
*/
Expand Down Expand Up @@ -137,6 +139,8 @@ public class WXEnvironment {

private static String CORE_JSS_SO_PATH = null;

public static String CORE_JSS_RUNTIME_SO_PATH = null;

private static String CORE_JSS_ICU_PATH = null;

private static String CORE_JSC_SO_PATH = null;
Expand Down Expand Up @@ -528,9 +532,14 @@ public static String getLibJScRealPath() {
}

public static String getLibJssRealPath() {
if (WXEnvironment.sUseRunTimeApi && !TextUtils.isEmpty(CORE_JSS_RUNTIME_SO_PATH)){
WXLogUtils.e("test-> findLibJssRuntimeRealPath " + CORE_JSS_RUNTIME_SO_PATH);
return CORE_JSS_RUNTIME_SO_PATH;
}

if(TextUtils.isEmpty(CORE_JSS_SO_PATH)) {
CORE_JSS_SO_PATH = findSoPath(CORE_JSS_SO_NAME);
WXLogUtils.e("findLibJssRealPath " + CORE_JSS_SO_PATH);
WXLogUtils.e("test-> findLibJssRealPath " + CORE_JSS_SO_PATH);
}

return CORE_JSS_SO_PATH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,11 @@ private WXParams assembleDefaultOptions() {
customOptions.put("enableBackupThreadCache", String.valueOf(wxJscProcessManager.enableBackUpThreadCache()));
}

if (!WXEnvironment.sUseRunTimeApi){
customOptions.put("__enable_native_promise__","true");
}


wxParams.setOptions(customOptions);
wxParams.setNeedInitV8(WXSDKManager.getInstance().needInitV8());
mInitParams = wxParams;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package com.taobao.weex.bridge;

import com.taobao.weex.WXEnvironment;
import com.taobao.weex.base.CalledByNative;
import com.taobao.weex.utils.WXLogUtils;

Expand Down Expand Up @@ -244,6 +245,11 @@ public void setLibLdPath(String libLdPath) {
this.libLdPath = libLdPath;
}

@CalledByNative
public String getUseRunTimeApi() {
return String.valueOf(WXEnvironment.sUseRunTimeApi);
}

public Map<String, Object> toMap() {
HashMap<String, Object> map = new HashMap<>();
map.put("appName", appName);
Expand All @@ -266,6 +272,8 @@ public Map<String, Object> toMap() {
map.put("libIcuPath", libIcuPath);
map.put("libLdPath", libLdPath);
map.put("options", options);
map.put("useRunTimeApi",WXEnvironment.sUseRunTimeApi);
map.put("__enable_native_promise__",!WXEnvironment.sUseRunTimeApi);
return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public void doInit() {
addProperty(KEY_PAGE_PROPERTIES_WEEX_VERSION, WXEnvironment.WXSDK_VERSION);
addProperty(KEY_PAGE_PROPERTIES_UIKIT_TYPE, instance.getRenderType());

addProperty("wxUseRuntimeApi",WXEnvironment.sUseRunTimeApi);
if (instance != null && (instance.getRenderStrategy() == WXRenderStrategy.DATA_RENDER
|| instance.getRenderStrategy() == WXRenderStrategy.DATA_RENDER_BINARY)) {
addProperty(KEY_PAGE_PROPERTIES_RENDER_TYPE, WXEnvironment.EAGLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ public static void commitCriticalExceptionWithDefaultUrl(
Map<String, String> commitMap = extParams;
if (null == commitMap){
commitMap = new HashMap<>();
commitMap.put("wxSdkInitStartTime", String.valueOf(WXEnvironment.sSDKInitStart));
commitMap.put("wxSDKInitCostTime", String.valueOf(WXEnvironment.sSDKInitTime));
commitMap.put("wxSDKCurExceptionTime", String.valueOf(System.currentTimeMillis()));
}
commitMap.put("wxSdkInitStartTime", String.valueOf(WXEnvironment.sSDKInitStart));
commitMap.put("wxSDKInitCostTime", String.valueOf(WXEnvironment.sSDKInitTime));
commitMap.put("wxSDKCurExceptionTime", String.valueOf(System.currentTimeMillis()));
commitMap.put("wxUseRuntimeApi",String.valueOf(WXEnvironment.sUseRunTimeApi));
if (!TextUtils.isEmpty(instanceId)) {
instanceIdCommit = instanceId;
instance = WXSDKManager.getInstance().getAllInstanceMap().get(instanceId);
Expand Down
30 changes: 30 additions & 0 deletions android/sdk/src/main/java/com/taobao/weex/utils/WXFileUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
Expand Down Expand Up @@ -266,4 +267,33 @@ public static void copyFile(File oldFile, File newFile) {
}
}

public static void copyFileWithException(File oldFile,File newFile ) throws Exception{
FileInputStream inputStream = null;
FileOutputStream outputStream = null;
try {
inputStream = new FileInputStream(oldFile);
byte[] data = new byte[1024];
outputStream = new FileOutputStream(newFile);
while (inputStream.read(data) != -1) {
outputStream.write(data);
}
}catch (Exception e){
throw e;
}finally {
closeIo(inputStream);
closeIo(outputStream);
}
}

public static void closeIo(Closeable c){
if (null == c){
return;
}
try {
c.close();
}catch (Throwable e){
e.printStackTrace();
}
}

}
Loading

0 comments on commit 4754cb7

Please sign in to comment.