use of com.android.build.gradle.internal.dsl.BuildType in project atlas by alibaba.
the class BasePlugin method createExtension.
private void createExtension() {
final NamedDomainObjectContainer<BuildType> buildTypeContainer = project.container(BuildType.class, new BuildTypeFactory(instantiator, project, project.getLogger()));
final NamedDomainObjectContainer<ProductFlavor> productFlavorContainer = project.container(ProductFlavor.class, new ProductFlavorFactory(instantiator, project, project.getLogger(), extraModelInfo));
final NamedDomainObjectContainer<SigningConfig> signingConfigContainer = project.container(SigningConfig.class, new SigningConfigFactory(instantiator));
extension = project.getExtensions().create("android", getExtensionClass(), project, instantiator, androidBuilder, sdkHandler, buildTypeContainer, productFlavorContainer, signingConfigContainer, extraModelInfo, isLibrary());
// create the default mapping configuration.
project.getConfigurations().create("default" + VariantDependencies.CONFIGURATION_MAPPING).setDescription("Configuration for default mapping artifacts.");
project.getConfigurations().create("default" + VariantDependencies.CONFIGURATION_METADATA).setDescription("Metadata for the produced APKs.");
dependencyManager = new TDependencyManager(project, extraModelInfo, sdkHandler);
ndkHandler = new NdkHandler(project.getRootDir(), null, /* compileSkdVersion, this will be set in afterEvaluate */
"gcc", "");
taskManager = createTaskManager(project, androidBuilder, dataBindingBuilder, extension, sdkHandler, ndkHandler, dependencyManager, registry);
variantFactory = createVariantFactory();
variantManager = new VariantManager(project, androidBuilder, extension, variantFactory, taskManager, instantiator);
// Register a builder for the custom tooling model
ModelBuilder modelBuilder = new ModelBuilder(androidBuilder, variantManager, taskManager, extension, extraModelInfo, ndkHandler, new NativeLibraryFactoryImpl(ndkHandler), isLibrary(), AndroidProject.GENERATION_ORIGINAL);
registry.register(modelBuilder);
// Register a builder for the native tooling model
NativeModelBuilder nativeModelBuilder = new NativeModelBuilder(variantManager);
registry.register(nativeModelBuilder);
// map the whenObjectAdded callbacks on the containers.
signingConfigContainer.whenObjectAdded(new Action<SigningConfig>() {
@Override
public void execute(SigningConfig signingConfig) {
variantManager.addSigningConfig(signingConfig);
}
});
buildTypeContainer.whenObjectAdded(new Action<BuildType>() {
@Override
public void execute(BuildType buildType) {
SigningConfig signingConfig = signingConfigContainer.findByName(BuilderConstants.DEBUG);
buildType.init(signingConfig);
variantManager.addBuildType(buildType);
}
});
productFlavorContainer.whenObjectAdded(new Action<ProductFlavor>() {
@Override
public void execute(ProductFlavor productFlavor) {
variantManager.addProductFlavor(productFlavor);
}
});
// map whenObjectRemoved on the containers to throw an exception.
signingConfigContainer.whenObjectRemoved(new UnsupportedAction("Removing signingConfigs is not supported."));
buildTypeContainer.whenObjectRemoved(new UnsupportedAction("Removing build types is not supported."));
productFlavorContainer.whenObjectRemoved(new UnsupportedAction("Removing product flavors is not supported."));
// create default Objects, signingConfig first as its used by the BuildTypes.
variantFactory.createDefaultComponents(buildTypeContainer, productFlavorContainer, signingConfigContainer);
}
use of com.android.build.gradle.internal.dsl.BuildType in project atlas by alibaba.
the class PostProcessManifestAction method isMultiDexEnabled.
private boolean isMultiDexEnabled() {
boolean isMultiDex = false;
for (BuildType buildType : appVariantContext.getAppExtension().getBuildTypes()) {
if (buildType.getName().equals(baseVariantOutputData.getName())) {
isMultiDex = (null != buildType.getMultiDexEnabled()) ? buildType.getMultiDexEnabled() : false;
break;
}
}
MultiDexConfig multiDexConfig = (MultiDexConfig) appVariantContext.getAtlasExtension().getMultiDexConfigs().findByName(appVariantContext.getBuildType().getName());
boolean fastMultiDex = null != multiDexConfig && multiDexConfig.isFastMultiDex();
return isMultiDex || fastMultiDex;
}
Aggregations