public void execute ( ) throws MojoExecutionException , MojoFailureException { // If the current POM isn't an Android-related POM, then don't do // anything. This helps work with multi-module projects. if ( ! isCurrentProjectAndroid ( ) ) { return ; } validateStandardLocations ( ) ; try { targetDirectory . mkdirs ( ) ; copyManifest ( ) ; // Check for a deprecated AAR > APKLIB artifact combination if ( warnOnApklibDependencies ) { checkForApklibDependencies ( ) ; } // TODO Do we really want to continue supporting APKSOURCES? How long has it been deprecated extractSourceDependencies ( ) ; // Extract the apklib and aar dependencies into unpacked-libs so that they can be referenced in the build. extractLibraryDependencies ( ) ; // Copy project assets to combinedAssets so that aapt has a single assets folder to load. copyFolder ( assetsDirectory , combinedAssets ) ; final String [ ] relativeAidlFileNames1 = findRelativeAidlFileNames ( aidlSourceDirectory ) ; final String [ ] relativeAidlFileNames2 = findRelativeAidlFileNames ( extractedDependenciesJavaSources ) ; final Map < String , String [ ] > relativeApklibAidlFileNames = new HashMap < String , String [ ] > ( ) ; if ( ! isInstrumentationTest ( ) ) { // Only add transitive APKLIB deps if we are building an APK and not an instrumentation test apk. for ( Artifact artifact : getTransitiveDependencyArtifacts ( APKLIB ) ) { final File libSourceFolder = getUnpackedApkLibSourceFolder ( artifact ) ; final String [ ] apklibAidlFiles = findRelativeAidlFileNames ( libSourceFolder ) ; relativeApklibAidlFileNames . put ( artifact . getId ( ) , apklibAidlFiles ) ; } } checkPackagesForDuplicates ( ) ; checkForConflictingLayouts ( ) ; generateR ( ) ; generateBuildConfig ( ) ; // When compiling AIDL for this project, // make sure we compile AIDL for dependencies as well. // This is so project A, which depends on project B, can // use AIDL info from project B in its own AIDL final Map < File , String [ ] > files = new HashMap < File , String [ ] > ( ) ; files . put ( aidlSourceDirectory , relativeAidlFileNames1 ) ; files . put ( extractedDependenciesJavaSources , relativeAidlFileNames2 ) ; if ( ! isInstrumentationTest ( ) ) { // Only add transitive APKLIB deps if we are building an APK and not an instrumentation test apk. for ( Artifact artifact : getTransitiveDependencyArtifacts ( APKLIB ) ) { final File unpackedLibSourceFolder = getUnpackedApkLibSourceFolder ( artifact ) ; files . put ( unpackedLibSourceFolder , relativeApklibAidlFileNames . get ( artifact . getId ( ) ) ) ; } } generateAidlFiles ( files ) ; } catch ( MojoExecutionException e ) { getLog ( ) . error ( "Error when generating sources." , e ) ; throw e ; } }
Generates the sources .