Search in sources :

Example 1 with AppExtension

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

the class AtlasPlugin method configTasks.

protected void configTasks(Project project) {
    if (PluginTypeUtils.isAppProject(project)) {
        AppExtension appExtension = DefaultGroovyMethods.asType(DefaultGroovyMethods.getAt(project.getExtensions(), "android"), AppExtension.class);
        //FIXME
        new AtlasAppTaskManager(tAndroidBuilder, appExtension, project, atlasExtension).run();
    } else if (PluginTypeUtils.isLibraryProject(project)) {
        LibraryExtension libExtension = DefaultGroovyMethods.asType(DefaultGroovyMethods.getAt(project.getExtensions(), "android"), LibraryExtension.class);
        new AtlasLibTaskManager(tAndroidBuilder, libExtension, project, atlasExtension).run();
    }
}
Also used : AppExtension(com.android.build.gradle.AppExtension) LibraryExtension(com.android.build.gradle.LibraryExtension)

Example 2 with AppExtension

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

the class AppVariantContextFactory method create.

@NotNull
public AppVariantContext create(Project project, ApplicationVariantImpl applicationVariant) {
    AppVariantContext appVariantContext;
    AppExtension appExtension = project.getExtensions().getByType(AppExtension.class);
    AtlasExtension atlasExtension = project.getExtensions().getByType(AtlasExtension.class);
    appVariantContext = new AppVariantContext(applicationVariant, project, atlasExtension, appExtension);
    return appVariantContext;
}
Also used : AtlasExtension(com.taobao.android.builder.extension.AtlasExtension) AppExtension(com.android.build.gradle.AppExtension) AppVariantContext(com.android.build.gradle.internal.api.AppVariantContext) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with AppExtension

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

the class DependencyManager method resolveDependencies.

/**
     * 解析项目的依赖,只对使用官方插件的工程启用,可以兼容solib的功能
     */
public void resolveDependencies() {
    // 如果使用官方的插件并且是app,再做一次依赖仲裁
    if (PluginTypeUtils.usedGooglePlugin(project)) {
        if (androidExtension instanceof AppExtension) {
            final AppExtension appExtension = (AppExtension) androidExtension;
            appExtension.getApplicationVariants().all(new Closure<Object>(this, this) {

                public void doCall(Object applicationVariant) {
                    VariantContext variantContext = new VariantContext((ApplicationVariantImpl) applicationVariant, project, atlasExtension, appExtension);
                    resolveDependencyForConfig(variantContext.getVariantDependency(), false);
                }
            });
        } else if (androidExtension instanceof LibraryExtension) {
            final LibraryExtension libraryExtension = (LibraryExtension) androidExtension;
            libraryExtension.getLibraryVariants().all(new Closure<Object>(this, this) {

                public void doCall(Object libraryVariant) {
                    VariantContext variantContext = new VariantContext((LibraryVariantImpl) libraryVariant, project, atlasExtension, libraryExtension);
                    resolveDependencyForConfig(variantContext.getVariantDependency(), true);
                }
            });
        }
    }
}
Also used : ApplicationVariantImpl(com.android.build.gradle.internal.api.ApplicationVariantImpl) Closure(groovy.lang.Closure) AppExtension(com.android.build.gradle.AppExtension) VariantContext(com.android.build.gradle.internal.api.VariantContext) LibraryExtension(com.android.build.gradle.LibraryExtension)

Aggregations

AppExtension (com.android.build.gradle.AppExtension)3 LibraryExtension (com.android.build.gradle.LibraryExtension)2 AppVariantContext (com.android.build.gradle.internal.api.AppVariantContext)1 ApplicationVariantImpl (com.android.build.gradle.internal.api.ApplicationVariantImpl)1 VariantContext (com.android.build.gradle.internal.api.VariantContext)1 AtlasExtension (com.taobao.android.builder.extension.AtlasExtension)1 Closure (groovy.lang.Closure)1 NotNull (org.jetbrains.annotations.NotNull)1