Skip to content

Commit 0da652f

Browse files
committed
[tinker] support android gradle plugin 3.0 for 'keepDexApply' mode.
1 parent 7c98c03 commit 0da652f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tinker-build/tinker-patch-gradle-plugin/src/main/groovy/com/tencent/tinker/build/gradle/transform/ImmutableDexTransform.groovy

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package com.tencent.tinker.build.gradle.transform
1818

1919
import com.android.annotations.NonNull
2020
import com.android.build.api.transform.*
21+
import com.android.build.gradle.internal.pipeline.TransformManager
2122
import com.android.build.gradle.internal.pipeline.TransformTask
2223
import com.android.build.gradle.internal.transforms.DexTransform
2324
import com.google.common.base.Joiner
@@ -77,7 +78,11 @@ public class ImmutableDexTransform extends Transform {
7778
this.varName = variant.name.capitalize()
7879
this.varDirName = variant.getDirName()
7980
this.oldApkPath = project.tinkerPatch.oldApk
80-
this.mainDexListFile = dexTransform.mainDexListFile
81+
if (dexTransform.mainDexListFile instanceof File) {
82+
this.mainDexListFile = dexTransform.mainDexListFile
83+
} else {
84+
this.mainDexListFile = dexTransform.mainDexListFile.getSingleFile()
85+
}
8186
}
8287

8388
public void initFileEnv(TransformOutputProvider outputProvider) {
@@ -241,7 +246,7 @@ public class ImmutableDexTransform extends Transform {
241246
ArrayList<String> dexPathList = new ArrayList<>()
242247

243248
def dxOutDir = transformInvocation.outputProvider.getContentLocation("main",
244-
getOutputTypes(), jarInputs.first().getScopes(), Format.DIRECTORY)
249+
getOutputTypes(), TransformManager.SCOPE_FULL_PROJECT, Format.DIRECTORY)
245250
if (dxOutDir.exists()) {
246251
FileOperation.cleanDir(dxOutDir)
247252
} else {

0 commit comments

Comments
 (0)