public static Set < String > getBuildFilesForSourceDirs ( List < String > sourceDirs , String [ ] includes , String [ ] excludes ) throws MojoExecutionException { Set < String > result = new LinkedHashSet < String > ( ) ; for ( String sourceDir : sourceDirs ) { try { if ( FileUtils . fileExists ( sourceDir ) ) { result . addAll ( FileUtils . getFileNames ( new File ( sourceDir ) , ( null == includes || 0 == includes . length ) ? DEFAULT_INCLUDES : getAsCsv ( includes ) , ( null == excludes || 0 == excludes . length ) ? DEFAULT_EXCLUDES : getAsCsv ( excludes ) , true ) ) ; } } catch ( IOException e ) { throw new MojoExecutionException ( "IO Error resolving sourcedirs" , e ) ; } } // We might need to check if some of these files are already included through the weaveDirectories. return result ; }
Based on a set of sourcedirs apply include and exclude statements and returns a set of all the files to be compiled and weaved .