Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:alibaba/atlas into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
chenzhong.cz committed Aug 15, 2018
2 parents 02936a2 + fa73c87 commit 9f550f3
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion atlas-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repositories {
group = 'com.taobao.android'
description = """atlas_core"""
String postFix = mini=='true' ? "-mini" : "";
version "5.1.0.5-rc1"
version "5.1.0.5-rc2"

String getEnvValue(key, defValue) {
def val = System.getProperty(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public KernalBundle(final File updateDir, final File dexPatchDir, String version
public static void patchNativeLib(Context base) {
try {
File dir = new File(base.getFilesDir(), String.format("nativeLib-%s", base.getPackageManager().getPackageInfo(base.getPackageName(), 0).versionName));
ClassLoader loader = Atlas.class.getClassLoader();
ClassLoader loader = KernalBundle.class.getClassLoader();
Field pathListField = findField(loader, "pathList");
Object dexPathList = pathListField.get(loader);
patchLibrary(dexPathList, dir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@

package android.taobao.atlas.startup.patch.releaser;

import android.app.PreVerifier;
import android.os.Build;
import android.taobao.atlas.runtime.RuntimeVariables;
import android.taobao.atlas.startup.patch.*;
Expand All @@ -231,6 +232,13 @@ public class NativeLibReleaser {

private static PatchMerger patchMerger;

public NativeLibReleaser() {
if(Boolean.FALSE.booleanValue()){
String.valueOf(PreVerifier.class);
}
}


public static boolean releaseLibs(File apkFile, File reversionDir) throws IOException {
ZipFile rawZip = new ZipFile(KernalConstants.APK_PATH);
if (new File(reversionDir, "lib").exists() && new File(reversionDir, "lib").listFiles().length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion atlas-docs/principle-intro/Runtime_principle.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

3. runtime层:主要包括清单管理、版本管理、以及系统代理三大块,基于不同的触发点按需执行bundle的安装和加载;runtime层同时提供了开发期快速debug支持和监控两个功能模块。从Delegate层可以看到,最核心的两个代理点:一个是DelegateClassLoader:负责路由class加载到各个bundle内部,第二个是DelegateResource:负责资源查找时能够找到bundle内的资源;这是bundle能够真正运行起来的根本;其余的代理点均是为了保证在必要的时机按需加载起来目标bundle,让其可以被DelegateClassloader和DelegateResource使用

4. 对外接入层:AtlasBridgeApplication是atlas框架下apk的真正Application,在基于Atlas框架构建的过程中会替换原有manifest中的application,所以Atlas没入的接入并不存在任何初始化代码,构建脚本完成了接入的过程。AtlasBridgeApplication里面除了完成了Atlas的初始化功能,同时**内置了multidex的功能**,这样做的原因有两个:
4. 对外接入层:AtlasBridgeApplication是atlas框架下apk的真正Application,在基于Atlas框架构建的过程中会替换原有manifest中的application,所以Atlas的接入并不存在任何初始化代码,构建脚本完成了接入的过程。AtlasBridgeApplication里面除了完成了Atlas的初始化功能,同时**内置了multidex的功能**,这样做的原因有两个:
1. 很多大型的app不合理的初始化导致用multidex分包逻辑拆分的时候主dex的代码就有可能方法数超过65536,AtlasBridgeApplication与业务代码完全解耦,所以拆分上面只要保证atlas框架在主dex,其他代码无论怎么拆分都不会有问题;
2. 如果不替换Application,那么atlas的初始化就会在application里面,由于基于Atlas的动态部署实际上是类替换的机制,那么这种机制就会必然存在包括Application及其import的class等部分代码在dalvik不支持部署的情况,这个在使用过程中造成一定成本,需要小心的使用以避免dalivk内部class resolve机制导致部分class没成功,替换以后该问题得到最好的解决,除atlas本身以外,所有业务代码均可以动态部署;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@ public static File getDiffFile() {
String diffPath = osName + "/" + fileName;

File temp = new File(new File(SystemUtils.class.getProtectionDomain().getCodeSource().getLocation().getFile()).getParentFile(),fileName);
if(temp.exists()){
return temp;
}
FileOutputStream fileOutputStream = null;
InputStream inputStream = null;
try {

fileOutputStream = new FileOutputStream(temp);

inputStream = SystemUtils.class.getClassLoader().getResourceAsStream(diffPath);
Expand All @@ -50,12 +52,8 @@ public static File getDiffFile() {

}

// File tempFile = new File(workingDir,)
return temp;



// return new File(SystemUtils.class.getClassLoader().getResourceAsStream(diffPath).getFile());
}


Expand All @@ -81,6 +79,9 @@ public static File getPatchFile() {

File temp = new File(new File(SystemUtils.class.getProtectionDomain().getCodeSource().getLocation().getFile()).getParentFile(),fileName);

if (temp.exists()){
return temp;
}
try {

fileOutputStream = new FileOutputStream(temp);
Expand Down

0 comments on commit 9f550f3

Please sign in to comment.