Search in sources :

Example 1 with PatchCleaner

use of com.taobao.atlas.update.util.PatchCleaner in project atlas by alibaba.

the class AtlasUpdater method update.

/**
     * 更新主入口
     * @param updateInfo  更新的基础信息
     * @param patchFile   tpatch包
     * @throws MergeException
     * @throws BundleException
     */
public static void update(UpdateInfo updateInfo, File patchFile) throws MergeException, BundleException {
    MergeCallback mergeCallback = new MergeCallback() {

        @Override
        public void onMergeResult(boolean result, String bundleName) {
            if (result) {
                Log.d("[dexmerge]", "merge bundle " + bundleName + " success ");
            } else {
                Log.e("[dexmerge]", "merge bundle " + bundleName + " fail ");
            }
        }
    };
    PatchMerger patchMerger = new PatchMerger(updateInfo, patchFile, mergeCallback);
    try {
        patchMerger.merge();
    } catch (IOException e) {
        e.printStackTrace();
    }
    PatchInstaller patchInstaller = new PatchInstaller(patchMerger.mergeOutputs, updateInfo);
    patchInstaller.install();
    new PatchCleaner().clearUpdatePath(updateInfo.workDir.getAbsolutePath());
}
Also used : PatchCleaner(com.taobao.atlas.update.util.PatchCleaner) MergeCallback(com.taobao.atlas.dexmerge.MergeCallback) PatchMerger(com.taobao.atlas.update.util.PatchMerger) PatchInstaller(com.taobao.atlas.update.util.PatchInstaller) IOException(java.io.IOException)

Aggregations

MergeCallback (com.taobao.atlas.dexmerge.MergeCallback)1 PatchCleaner (com.taobao.atlas.update.util.PatchCleaner)1 PatchInstaller (com.taobao.atlas.update.util.PatchInstaller)1 PatchMerger (com.taobao.atlas.update.util.PatchMerger)1 IOException (java.io.IOException)1