mCmdLineRunner.runCmdLine(command, null);
// now if the project has libraries, R needs to be created for each libraries,
// but only if the current project is not a library.
if (type != VariantConfiguration.Type.LIBRARY && !libraries.isEmpty()) {
SymbolLoader fullSymbolValues = null;
// First pass processing the libraries, collecting them by packageName,
// and ignoring the ones that have the same package name as the application
// (since that R class was already created).
String appPackageName = packageForR;
if (appPackageName == null) {
appPackageName = VariantConfiguration.getManifestPackage(manifestFile);
}
// list of all the symbol loaders per package names.
Multimap<String, SymbolLoader> libMap = ArrayListMultimap.create();
for (SymbolFileProvider lib : libraries) {
File rFile = lib.getSymbolFile();
// if the library has no resource, this file won't exist.
if (rFile.isFile()) {
String packageName = VariantConfiguration.getManifestPackage(lib.getManifest());
if (appPackageName.equals(packageName)) {
// ignore libraries that have the same package name as the app
continue;
}
// load the full values if that's not already been done.
// Doing it lazily allow us to support the case where there's no
// resources anywhere.
if (fullSymbolValues == null) {
fullSymbolValues = new SymbolLoader(new File(symbolOutputDir, "R.txt"),
mLogger);
fullSymbolValues.load();
}
SymbolLoader libSymbols = new SymbolLoader(rFile, mLogger);
libSymbols.load();
// store these symbols by associating them with the package name.
libMap.put(packageName, libSymbols);
}