Search in sources :

Example 1 with AtlasMultiDexListTransform

use of com.taobao.android.builder.tasks.transform.dex.AtlasMultiDexListTransform in project atlas by alibaba.

the class TransformReplacer method replaceMultiDexListTransform.

public void replaceMultiDexListTransform() {
    List<TransformTask> list = null;
    FastMultiDexer fastMultiDexer = new FastMultiDexer(variantContext);
    if (usingIncrementalDexing(variantContext.getScope())) {
        list = TransformManager.findTransformTaskByTransformType(variantContext, MainDexListTransform.class);
    } else {
        list = TransformManager.findTransformTaskByTransformType(variantContext, MultiDexTransform.class);
    }
    if (list.size() > 0 && fastMultiDexer.isFastMultiDexEnabled()) {
        com.android.build.gradle.internal.dsl.DexOptions dexOptions = variantContext.getScope().getGlobalScope().getExtension().getDexOptions();
        AtlasMultiDexListTransform atlasMultiDexListTransform = new AtlasMultiDexListTransform(variantContext.getScope(), dexOptions);
        for (TransformTask transformTask : list) {
            ReflectUtils.updateField(transformTask, "transform", atlasMultiDexListTransform);
            transformTask.doFirst(task -> AtlasBuildContext.androidBuilderMap.get(task.getProject()).multiDexer = (AtlasBuilder.MultiDexer) fastMultiDexer);
            transformTask.doLast(task -> AtlasBuildContext.androidBuilderMap.get(task.getProject()).multiDexer = null);
        }
    }
}
Also used : AtlasMultiDexListTransform(com.taobao.android.builder.tasks.transform.dex.AtlasMultiDexListTransform) FastMultiDexer(com.taobao.android.builder.tools.multidex.FastMultiDexer) FastMultiDexer(com.taobao.android.builder.tools.multidex.FastMultiDexer) TransformTask(com.android.build.gradle.internal.pipeline.TransformTask)

Aggregations

TransformTask (com.android.build.gradle.internal.pipeline.TransformTask)1 AtlasMultiDexListTransform (com.taobao.android.builder.tasks.transform.dex.AtlasMultiDexListTransform)1 FastMultiDexer (com.taobao.android.builder.tools.multidex.FastMultiDexer)1