src/main/java/com/simpligility/maven/plugins/android/phase01generatesources/GenerateSourcesMojo.java
private void generateAidlFiles( Map<File /*sourceDirectory*/, String[] /*relativeAidlFileNames*/> files )
            throws MojoExecutionException
    {
        List<String> protoCommands = new ArrayList<String>();
        protoCommands.add( "-p" + getAndroidSdk().getPathForFrameworkAidl() );

        genDirectoryAidl.mkdirs();
        getLog().info( "Adding AIDL gen folder to compile classpath: " + genDirectoryAidl );
        project.addCompileSourceRoot( genDirectoryAidl.getPath() );
        Set<File> sourceDirs = files.keySet();
        for ( File sourceDir : sourceDirs )
        {
            protoCommands.add( "-I" + sourceDir );
        }
        for ( File sourceDir : sourceDirs )
        {
            for ( String relativeAidlFileName : files.get( sourceDir ) )
            {
                File targetDirectory = new File( genDirectoryAidl, new File( relativeAidlFileName ).getParent() );
                targetDirectory.mkdirs();

                final String shortAidlFileName = new File( relativeAidlFileName ).getName();
                final String shortJavaFileName = shortAidlFileName.substring( 0, shortAidlFileName.lastIndexOf( "." ) )
                        + ".java";
                final File aidlFileInSourceDirectory = new File( sourceDir, relativeAidlFileName );

                List<String> commands = new ArrayList<String>( protoCommands );
                commands.add( aidlFileInSourceDirectory.getAbsolutePath() );
                commands.add( new File( targetDirectory, shortJavaFileName ).getAbsolutePath() );
                try
                {
                    CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
                    executor.setLogger( this.getLog() );
                    executor.setCaptureStdOut( true );
                    executor.executeCommand( getAndroidSdk().getAidlPath(), commands, project.getBasedir(),
                            false );
                }
                catch ( ExecutionException e )
                {
                    throw new MojoExecutionException( "", e );
                }
            }
        }
    }
private void generateAidlFiles( Map<File /*sourceDirectory*/, String[] /*relativeAidlFileNames*/> files )
            throws MojoExecutionException
    {
        List<String> protoCommands = new ArrayList<String>();
        protoCommands.add( "-p" + getAndroidSdk().getPathForFrameworkAidl() );

        genDirectoryAidl.mkdirs();
        getLog().info( "Adding AIDL gen folder to compile classpath: " + genDirectoryAidl );
        project.addCompileSourceRoot( genDirectoryAidl.getPath() );
        Set<File> sourceDirs = files.keySet();
        for ( File sourceDir : sourceDirs )
        {
            protoCommands.add( "-I" + sourceDir );
        }
        for ( File sourceDir : sourceDirs )
        {
            for ( String relativeAidlFileName : files.get( sourceDir ) )
            {
                File targetDirectory = new File( genDirectoryAidl, new File( relativeAidlFileName ).getParent() );
                targetDirectory.mkdirs();

                final String shortAidlFileName = new File( relativeAidlFileName ).getName();
                final String shortJavaFileName = shortAidlFileName.substring( 0, shortAidlFileName.lastIndexOf( "." ) )
                        + ".java";
                final File aidlFileInSourceDirectory = new File( sourceDir, relativeAidlFileName );

                List<String> commands = new ArrayList<String>( protoCommands );
                commands.add( aidlFileInSourceDirectory.getAbsolutePath() );
                commands.add( new File( targetDirectory, shortJavaFileName ).getAbsolutePath() );
                try
                {
                    CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
                    executor.setLogger( this.getLog() );
                    executor.setCaptureStdOut( true );
                    executor.executeCommand( getAndroidSdk().getAidlPath(), commands, project.getBasedir(),
                            false );
                }
                catch ( ExecutionException e )
                {
                    throw new MojoExecutionException( "", e );
                }
            }
        }
    }
private void generateAidlFiles ( Map < File /*sourceDirectory*/ , String [ ] /*relativeAidlFileNames*/ > files ) throws MojoExecutionException { List < String > protoCommands = new ArrayList < String > ( ) ; protoCommands . add ( "-p" + getAndroidSdk ( ) . getPathForFrameworkAidl ( ) ) ; genDirectoryAidl . mkdirs ( ) ; getLog ( ) . info ( "Adding AIDL gen folder to compile classpath: " + genDirectoryAidl ) ; project . addCompileSourceRoot ( genDirectoryAidl . getPath ( ) ) ; Set < File > sourceDirs = files . keySet ( ) ; for ( File sourceDir : sourceDirs ) { protoCommands . add ( "-I" + sourceDir ) ; } for ( File sourceDir : sourceDirs ) { for ( String relativeAidlFileName : files . get ( sourceDir ) ) { File targetDirectory = new File ( genDirectoryAidl , new File ( relativeAidlFileName ) . getParent ( ) ) ; targetDirectory . mkdirs ( ) ; final String shortAidlFileName = new File ( relativeAidlFileName ) . getName ( ) ; final String shortJavaFileName = shortAidlFileName . substring ( 0 , shortAidlFileName . lastIndexOf ( "." ) ) + ".java" ; final File aidlFileInSourceDirectory = new File ( sourceDir , relativeAidlFileName ) ; List < String > commands = new ArrayList < String > ( protoCommands ) ; commands . add ( aidlFileInSourceDirectory . getAbsolutePath ( ) ) ; commands . add ( new File ( targetDirectory , shortJavaFileName ) . getAbsolutePath ( ) ) ; try { CommandExecutor executor = CommandExecutor . Factory . createDefaultCommmandExecutor ( ) ; executor . setLogger ( this . getLog ( ) ) ; executor . setCaptureStdOut ( true ) ; executor . executeCommand ( getAndroidSdk ( ) . getAidlPath ( ) , commands , project . getBasedir ( ) , false ) ; } catch ( ExecutionException e ) { throw new MojoExecutionException ( "" , e ) ; } } } }
Given a map of source directories to list of AIDL (relative) filenames within each,
runs the AIDL compiler for each, such that all source directories are available to
the AIDL compiler.

@param files Map of source directory File instances to the relative paths to all AIDL files within
@throws MojoExecutionException If the AIDL compiler fails
Given a map of source directories to list of AIDL ( relative ) filenames within each runs the AIDL compiler for each such that all source directories are available to the AIDL compiler .