com.android.build.gradle.internal.api.ApplicationVariantImpl Java Examples

The following examples show how to use com.android.build.gradle.internal.api.ApplicationVariantImpl. 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: AtlasAppTaskManager.java    From atlas with Apache License 2.0 6 votes vote down vote up
private void repalceAndroidBuilder(ApplicationVariant applicationVariant) {
        try {
            if (applicationVariant instanceof ApplicationVariantImpl) {
                VariantScope variantScope = ((ApplicationVariantImpl) applicationVariant).getVariantData().getScope();
                GlobalScope globalScope = variantScope.getGlobalScope();
//                ReflectUtils.updateField(globalScope, "androidBuilder", AtlasBuildContext.androidBuilderMap.get(globalScope.getProject()));
//                Field f = ProjectOptions.class.getDeclaredField("booleanOptions");
//                f.setAccessible(true);
//                Map map = (Map) f.get(((ApplicationVariantImpl) applicationVariant).getVariantData().getScope().getGlobalScope().getProjectOptions());
//                map.put(BooleanOption.ENABLE_AAPT2, false);
                AtlasBuildContext.androidBuilderMap.get(globalScope.getProject()).initAapt(globalScope.getProjectOptions());

            }
        } catch (Exception e) {
            logger.error(e, "write globalScope androidBuilder field failed!");
        }
    }
 
Example #2
Source File: ApplicationVariantFactory.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
@Override
@NonNull
public ApplicationVariant createVariantApi(
        @NonNull BaseVariantData<? extends BaseVariantOutputData> variantData,
        @NonNull ReadOnlyObjectProvider readOnlyObjectProvider) {
    // create the base variant object.
    ApplicationVariantImpl variant = instantiator.newInstance(
            ApplicationVariantImpl.class,
            variantData,
            androidBuilder,
            readOnlyObjectProvider);

    // now create the output objects
    createApkOutputApiObjects(instantiator, variantData, variant);

    return variant;
}
 
Example #3
Source File: CompileDependenciesFileGenerator.java    From Phantom with Apache License 2.0 5 votes vote down vote up
public CompileDependenciesFileGenerator(Project project, ApplicationVariantImpl variant, File outputFileDir,
        String outputFileName) {
    super(Constant.HOST_TAG, project, variant, outputFileDir, outputFileName);
    this.project = project;
    this.applicationVariant = variant;
    this.agpVersion = (ComparableVersion) project.getExtensions().getExtraProperties().get(Constant.AGP_VERSION);
}
 
Example #4
Source File: AppVariantContextFactory.java    From atlas with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #5
Source File: AppVariantContextFactory.java    From atlas with Apache License 2.0 3 votes vote down vote up
public AppVariantContext getAppVariantContext(Project project, ApplicationVariant applicationVariant) {

        AppVariantContext appVariantContext = appVariantContextMap.get(applicationVariant);

        if (null == appVariantContext) {

            appVariantContext = create(project, (ApplicationVariantImpl)applicationVariant);

            appVariantContextMap.put(applicationVariant, appVariantContext);

        }

        return appVariantContext;

    }