// the list of dependency must be reversed to use the right overlay order.
for (int n = mFlatLibraries.size() - 1 ; n >= 0 ; n--) {
AndroidDependency dependency = mFlatLibraries.get(n);
File resFolder = dependency.getResFolder();
if (resFolder != null) {
ResourceSet resourceSet = new ResourceSet(dependency.getFolder().getName());
resourceSet.addSource(resFolder);
resourceSets.add(resourceSet);
}
}
Set<File> mainResDirs = mDefaultSourceProvider.getResourcesDirectories();
ResourceSet resourceSet = new ResourceSet(BuilderConstants.MAIN);
resourceSet.addSources(mainResDirs);
if (generatedResFolder != null) {
resourceSet.addSource(generatedResFolder);
}
resourceSets.add(resourceSet);
// the list of flavor must be reversed to use the right overlay order.
for (int n = mFlavorSourceProviders.size() - 1; n >= 0 ; n--) {
SourceProvider sourceProvider = mFlavorSourceProviders.get(n);
Set<File> flavorResDirs = sourceProvider.getResourcesDirectories();
// we need the same of the flavor config, but it's in a different list.
// This is fine as both list are parallel collections with the same number of items.
resourceSet = new ResourceSet(mFlavorConfigs.get(n).getName());
resourceSet.addSources(flavorResDirs);
resourceSets.add(resourceSet);
}
if (mBuildTypeSourceProvider != null) {
Set<File> typeResDirs = mBuildTypeSourceProvider.getResourcesDirectories();
resourceSet = new ResourceSet(mBuildType.getName());
resourceSet.addSources(typeResDirs);
resourceSets.add(resourceSet);
}
return resourceSets;
}