com.android.build.gradle.AppPlugin Java Examples

The following examples show how to use com.android.build.gradle.AppPlugin. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShrinkerPlugin.java    From shrinker with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(Project project) {
    if (!project.getPlugins().hasPlugin(AppPlugin.class)) {
        throw new UnsupportedOperationException("Plugin 'shrinker' can only apply with 'com.android.application'");
    }
    AppExtension android = project.getExtensions().getByType(AppExtension.class);
    ShrinkerExtension config = project.getExtensions().create("shrinker", ShrinkerExtension.class);
    android.registerTransform(new InlineRTransform(config));
}
 
Example #2
Source File: AtlasInstantAppPlugin.java    From atlas with Apache License 2.0 4 votes vote down vote up
@Override
public void apply(Project project) {
    PluginManager.addPluginIfNot(project, AppPlugin.class);
    PluginManager.addPluginIfNot(project, InstantAppPlugin.class);
    super.apply(project);
}
 
Example #3
Source File: AppPluginHook.java    From atlas with Apache License 2.0 4 votes vote down vote up
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;

    }
 
Example #4
Source File: AtlasAppPlugin.java    From atlas with Apache License 2.0 3 votes vote down vote up
@Override
public void apply(Project project) {
    PluginManager.addPluginIfNot(project, AppPlugin.class);

    PluginManager.addPluginIfNot(project, AtlasPlugin.class);

}
 
Example #5
Source File: PluginTypeUtils.java    From atlas with Apache License 2.0 2 votes vote down vote up
/**
 * Decide if you're using GuGe's androidPlugin
 *
 * @param project
 * @return
 */
public static boolean usedGooglePlugin(Project project) {
    return hasPlugins(project, GOOGLE_ANDROID_PLUGINS) || project.getPlugins().hasPlugin(AppPlugin.class)
        || project.getPlugins().hasPlugin(LibraryPlugin.class)||project.getPlugins().hasPlugin(FeaturePlugin.class);

}