public void generateLibraryRs ( final Set < Artifact > libraries ) { // list of all the symbol tables final List < SymbolTable > symbolTables = new ArrayList <> ( libraries . size ( ) ) ; // For each dependency, load its symbol file. for ( final Artifact lib : libraries ) { final File unpackedLibDirectory = mojo . getUnpackedLibFolder ( lib ) ; final File rFile = new File ( unpackedLibDirectory , "R.txt" ) ; if ( rFile . isFile ( ) ) { final File libManifestFile = new File ( unpackedLibDirectory , "AndroidManifest.xml" ) ; final String packageName = new DefaultManifestParser ( libManifestFile ) . getPackage ( ) ; if ( rJavaAlreadyExists ( packageName ) ) { log . info ( "Not creating R for " + packageName + " as it already exists" ) ; continue ; } log . info ( "Generating R for " + packageName + " at " + rFile ) ; SymbolTable libSymbols = SymbolIo . read ( rFile ) ; libSymbols = libSymbols . rename ( packageName , libSymbols . getTableName ( ) ) ; symbolTables . add ( libSymbols ) ; } } if ( symbolTables . isEmpty ( ) ) { return ; } // load the full resources values from the R.txt calculated for the project. final File projectR = new File ( targetDirectory , "R.txt" ) ; final SymbolTable mainSymbols = SymbolIo . read ( projectR ) ; // now loop on all the package name, merge all the symbols to write, and write them RGeneration . generateRForLibraries ( mainSymbols , symbolTables , genDirectory . getAbsoluteFile ( ) , false ) ; }
Generates R java files those libraries that do not already have their R java in the compile classpath .