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);
}
}
}
Aggregations