}
private List<SourceProvider> getSourceProviders() {
if (mProviders == null) {
List<SourceProvider> providers = Lists.newArrayList();
AndroidArtifact mainArtifact = mVariant.getMainArtifact();
providers.add(mProject.getDefaultConfig().getSourceProvider());
for (String flavorName : mVariant.getProductFlavors()) {
for (ProductFlavorContainer flavor : mProject.getProductFlavors()) {
if (flavorName.equals(flavor.getProductFlavor().getName())) {
providers.add(flavor.getSourceProvider());
break;
}
}
}
SourceProvider multiProvider = mainArtifact.getMultiFlavorSourceProvider();
if (multiProvider != null) {
providers.add(multiProvider);
}
String buildTypeName = mVariant.getBuildType();
for (BuildTypeContainer buildType : mProject.getBuildTypes()) {
if (buildTypeName.equals(buildType.getBuildType().getName())) {
providers.add(buildType.getSourceProvider());
break;
}
}
SourceProvider variantProvider = mainArtifact.getVariantSourceProvider();
if (variantProvider != null) {
providers.add(variantProvider);
}
mProviders = providers;