Search in sources :

Example 1 with DexingType

use of com.android.builder.dexing.DexingType in project atlas by alibaba.

the class TransformReplacer method replaceDexMerge.

public void replaceDexMerge(BaseVariantOutput vod) {
    List<TransformTask> list = TransformManager.findTransformTaskByTransformType(variantContext, DexMergerTransform.class);
    DexingType dexingType = variantContext.getScope().getDexingType();
    if (variantContext.getScope().getInstantRunBuildContext().isInInstantRunMode() && variantContext.getVariantConfiguration().getMinSdkVersion().getApiLevel() < 21) {
        dexingType = DexingType.LEGACY_MULTIDEX;
    }
    DexMergerTool dexMergerTool = variantContext.getScope().getDexMerger();
    int sdkVerision = variantContext.getScope().getMinSdkVersion().getFeatureLevel();
    boolean debug = variantContext.getScope().getVariantConfiguration().getBuildType().isDebuggable();
    ErrorReporter errorReporter = variantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter();
    for (TransformTask transformTask : list) {
        AtlasDexMergerTransform dexMergerTransform = new AtlasDexMergerTransform(variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod)), dexingType, dexingType == DexingType.LEGACY_MULTIDEX ? variantContext.getProject().files(variantContext.getScope().getMainDexListFile()) : null, errorReporter, dexMergerTool, sdkVerision, debug);
        ReflectUtils.updateField(transformTask, "transform", dexMergerTransform);
    }
}
Also used : DexingType(com.android.builder.dexing.DexingType) ErrorReporter(com.android.builder.core.ErrorReporter) DexMergerTool(com.android.builder.dexing.DexMergerTool) TransformTask(com.android.build.gradle.internal.pipeline.TransformTask) AtlasDexMergerTransform(com.taobao.android.builder.tasks.transform.dex.AtlasDexMergerTransform)

Example 2 with DexingType

use of com.android.builder.dexing.DexingType in project atlas by alibaba.

the class TransformReplacer method replaceDexTransform.

public void replaceDexTransform(AppVariantContext appVariantContext, BaseVariantOutput vod) {
    List<TransformTask> baseTransforms = TransformManager.findTransformTaskByTransformType(variantContext, DexTransform.class);
    DefaultDexOptions dexOptions = appVariantContext.getAppExtension().getDexOptions();
    DexingType dexingType = appVariantContext.getScope().getDexingType();
    DexByteCodeConverterHook dexByteCodeConverterHook = new DexByteCodeConverterHook(variantContext, variantContext.getAppVariantOutputContext(ApkDataUtils.get(vod)), LoggerWrapper.getLogger(DexByteCodeConverterHook.class), appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo(), new GradleJavaProcessExecutor(appVariantContext.getProject()), appVariantContext.getProject().getLogger().isEnabled(LogLevel.INFO), new ExtraModelInfo(appVariantContext.getScope().getGlobalScope().getProjectOptions(), appVariantContext.getProject().getLogger()));
    for (TransformTask transformTask : baseTransforms) {
        DexTransform newTransform = new DexTransform(dexOptions, dexingType, false, appVariantContext.getProject().files(variantContext.getScope().getMainDexListFile()), verifyNotNull(appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getTargetInfo(), "Target Info not set."), dexByteCodeConverterHook, appVariantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter(), variantContext.getScope().getMinSdkVersion().getFeatureLevel());
        ReflectUtils.updateField(transformTask, "transform", newTransform);
    }
}
Also used : DexingType(com.android.builder.dexing.DexingType) ExtraModelInfo(com.android.build.gradle.internal.ExtraModelInfo) DexByteCodeConverterHook(com.taobao.android.builder.hook.dex.DexByteCodeConverterHook) TransformTask(com.android.build.gradle.internal.pipeline.TransformTask) DefaultDexOptions(com.android.builder.core.DefaultDexOptions) GradleJavaProcessExecutor(com.android.build.gradle.internal.process.GradleJavaProcessExecutor)

Aggregations

TransformTask (com.android.build.gradle.internal.pipeline.TransformTask)2 DexingType (com.android.builder.dexing.DexingType)2 ExtraModelInfo (com.android.build.gradle.internal.ExtraModelInfo)1 GradleJavaProcessExecutor (com.android.build.gradle.internal.process.GradleJavaProcessExecutor)1 DefaultDexOptions (com.android.builder.core.DefaultDexOptions)1 ErrorReporter (com.android.builder.core.ErrorReporter)1 DexMergerTool (com.android.builder.dexing.DexMergerTool)1 DexByteCodeConverterHook (com.taobao.android.builder.hook.dex.DexByteCodeConverterHook)1 AtlasDexMergerTransform (com.taobao.android.builder.tasks.transform.dex.AtlasDexMergerTransform)1