List < File > getRecursiveThriftFiles ( MavenProject project , String outputDirectory , List < File > files ) throws IOException { HashFunction hashFun = Hashing . md5 ( ) ; File dir = new File ( new File ( project . getFile ( ) . getParent ( ) , "target" ) , outputDirectory ) ; if ( dir . exists ( ) ) { URI baseDir = getFileURI ( dir ) ; for ( File f : findThriftFilesInDirectory ( dir ) ) { URI fileURI = getFileURI ( f ) ; String relPath = baseDir . relativize ( fileURI ) . getPath ( ) ; File destFolder = getResourcesOutputDirectory ( ) ; destFolder . mkdirs ( ) ; File destFile = new File ( destFolder , relPath ) ; if ( ! destFile . exists ( ) || ( destFile . isFile ( ) && ! Files . hash ( f , hashFun ) . equals ( Files . hash ( destFile , hashFun ) ) ) ) { getLog ( ) . info ( format ( "copying %s to %s" , f . getCanonicalPath ( ) , destFile . getCanonicalPath ( ) ) ) ; copyFile ( f , destFile ) ; } files . add ( destFile ) ; } } Map < String , MavenProject > refs = project . getProjectReferences ( ) ; for ( String name : refs . keySet ( ) ) { getRecursiveThriftFiles ( refs . get ( name ) , outputDirectory , files ) ; } return files ; }
Walk project references recursively adding thrift files to the provided list .