BugFix: Get manifest failed when check InstantRun task. (#160)

* BugFix: Get manifest failed when check InstantRun task.
This commit is contained in:
erhu 2017-07-08 17:56:47 +08:00 committed by Jiongxuan Zhang
parent dfb29e5f00
commit 65d4c377a6

View File

@ -17,9 +17,6 @@
package com.qihoo360.replugin.gradle.plugin.manifest
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.BasePlugin
import com.android.build.gradle.internal.TaskManager
import org.gradle.api.Project
/**
@ -38,7 +35,6 @@ public class ManifestAPI {
/**
* AndroidManifest.xml
* @return
*/
def static manifestPath(Project project, String variantDir) {
def variantDirArray = variantDir.split("/")
@ -55,17 +51,20 @@ public class ManifestAPI {
//processManifestTask存在的话
//transform的task目前能保证在processManifestTask之后执行
if (processManifestTask) {
//
File result = null
//manifest
File manifestOutputFile = processManifestTask.getManifestOutputFile()
//instant run的manifest
File instantRunManifestOutputFile = processManifestTask.getInstantRunManifestOutputFile()
//
println " manifestOutputFile:${manifestOutputFile} ${manifestOutputFile.exists()}"
println " instantRunManifestOutputFile:${instantRunManifestOutputFile} ${instantRunManifestOutputFile.exists()}"
//manifest
result = manifestOutputFile
try {
//instant run Task
def instantRunTask = project.tasks.getByName("transformClassesWithInstantRunFor${variantName}")
//instant run是否存在且文件存在
@ -78,6 +77,9 @@ public class ManifestAPI {
result = instantRunManifestOutputFile
}
}
} catch (ignored) {
// transformClassesWithInstantRunForXXX may not exists
}
//
if (!result.exists()) {