public String [ ] getModules ( ) { // module has higher priority if set by expression if ( module != null ) { return new String [ ] { module } ; } if ( modules == null ) { //Use a Set to avoid duplicate when user set src/main/java as <resource> Set < String > mods = new HashSet < String > ( ) ; Collection < String > sourcePaths = getProject ( ) . getCompileSourceRoots ( ) ; for ( String sourcePath : sourcePaths ) { File sourceDirectory = new File ( sourcePath ) ; if ( sourceDirectory . exists ( ) ) { DirectoryScanner scanner = new DirectoryScanner ( ) ; scanner . setBasedir ( sourceDirectory . getAbsolutePath ( ) ) ; scanner . setIncludes ( new String [ ] { "**/*" + DefaultGwtModuleReader . GWT_MODULE_EXTENSION } ) ; scanner . scan ( ) ; mods . addAll ( Arrays . asList ( scanner . getIncludedFiles ( ) ) ) ; } } Collection < Resource > resources = getProject ( ) . getResources ( ) ; for ( Resource resource : resources ) { File resourceDirectoryFile = new File ( resource . getDirectory ( ) ) ; if ( ! resourceDirectoryFile . exists ( ) ) { continue ; } DirectoryScanner scanner = new DirectoryScanner ( ) ; scanner . setBasedir ( resource . getDirectory ( ) ) ; scanner . setIncludes ( new String [ ] { "**/*" + DefaultGwtModuleReader . GWT_MODULE_EXTENSION } ) ; scanner . scan ( ) ; mods . addAll ( Arrays . asList ( scanner . getIncludedFiles ( ) ) ) ; } if ( mods . isEmpty ( ) ) { getLog ( ) . warn ( "GWT plugin is configured to detect modules, but none were found." ) ; } modules = new String [ mods . size ( ) ] ; int i = 0 ; for ( String fileName : mods ) { String path = fileName . substring ( 0 , fileName . length ( ) - DefaultGwtModuleReader . GWT_MODULE_EXTENSION . length ( ) ) ; modules [ i ++ ] = path . replace ( File . separatorChar , ' ' ) ; } if ( modules . length > 0 ) { getLog ( ) . info ( "auto discovered modules " + Arrays . asList ( modules ) ) ; } } return modules ; }
FIXME move to DefaultGwtModuleReader !