Merge pull request #100 from Qihoo360/erhu-patch-reflectioin-taskManager

Using reflection to access internal field
This commit is contained in:
JunjieHu 2017-07-04 11:44:42 +08:00 committed by GitHub
commit 882922674e

View File

@ -18,8 +18,8 @@
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 com.qihoo360.replugin.gradle.plugin.inner.Util
import org.gradle.api.Project
/**
@ -43,15 +43,17 @@ public class ManifestAPI {
def static private manifestPath(Project project, String variantDir) {
AppPlugin appPlugin = project.plugins.getPlugin(AppPlugin)
TaskManager taskManager = appPlugin.taskManager
// taskManager 2.1.3 protected 访 private 访
// 使访
TaskManager taskManager = BasePlugin.metaClass.getProperty(appPlugin, 'taskManager')
def globalScope = taskManager.globalScope;
File xmlPath = new File(globalScope.getIntermediatesDir(),
"/manifests/full/" + variantDir + "/AndroidManifest.xml")
'/manifests/full/' + variantDir + '/AndroidManifest.xml')
//
if (!xmlPath.exists()) {
println "AndroidManifest.xml not exist"
println 'AndroidManifest.xml not exist'
}
println "AndroidManifest.xml 路径:$xmlPath"