Search in sources :

Example 1 with BasePlugin

use of com.android.build.gradle.BasePlugin in project atlas by alibaba.

the class AppPluginHook method getAndroidBuilder.

// public void replaceTaskManager() throws Exception {
// 
// AppPlugin appPlugin = project.getPlugins().findPlugin(AppPlugin.class);
// 
// if (null == appPlugin) {
// return;
// }
// 
// TaskManager taskManager =
// (TaskManager)ReflectUtils.getField(BasePlugin.class, appPlugin, "taskManager");
// 
// DependencyManager dependencyManager = (DependencyManager)ReflectUtils.getField(TaskManager.class, taskManager,
// "dependencyManager");
// 
// AtlasDependencyManager atlasDependencyManager = new AtlasDependencyManager(project,
// (ExtraModelInfo)ReflectUtils
// .getField(dependencyManager,
// "extraModelInfo"),
// (SdkHandler)ReflectUtils
// .getField(dependencyManager,
// "sdkHandler"));
// 
// ReflectUtils.updateField(TaskManager.class, taskManager, "dependencyManager", atlasDependencyManager);
// 
// }
public AndroidBuilder getAndroidBuilder() throws Exception {
    BasePlugin basePlugin = project.getPlugins().findPlugin(AppPlugin.class);
    if (null == basePlugin) {
        basePlugin = project.getPlugins().findPlugin(LibraryPlugin.class);
    }
    if (null == basePlugin) {
        return null;
    }
    AndroidBuilder androidBuilder = (AndroidBuilder) ReflectUtils.getField(BasePlugin.class, basePlugin, "androidBuilder");
    return androidBuilder;
}
Also used : BasePlugin(com.android.build.gradle.BasePlugin) AndroidBuilder(com.android.builder.core.AndroidBuilder) LibraryPlugin(com.android.build.gradle.LibraryPlugin)

Aggregations

BasePlugin (com.android.build.gradle.BasePlugin)1 LibraryPlugin (com.android.build.gradle.LibraryPlugin)1 AndroidBuilder (com.android.builder.core.AndroidBuilder)1