mirror of
https://gitee.com/replugin/RePlugin.git
synced 2024-12-02 11:48:02 +08:00
BugFix: Get manifest failed when check InstantRun task. (#160)
* BugFix: Get manifest failed when check InstantRun task.
This commit is contained in:
parent
dfb29e5f00
commit
65d4c377a6
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user