use of com.android.build.gradle.internal.api.VariantContext 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);
}
});
}
}
}
Aggregations