private File zipModule ( ModuleIdentifier modID ) { File modDir = new File ( modRoot , modID . toString ( ) ) ; if ( ! modDir . exists ( ) ) { throw new PlatformManagerException ( "Cannot find module" ) ; } // Create a temporary directory in which to store the module and its dependencies. File modRoot = new File ( TEMP_DIR , "vertx-zip-mods" ) ; // Create a zip file. If the zip file already exists in the temporary // Vertigo zips directory then just return the existing zip file. File zipFile = new File ( modRoot , modID . toString ( ) + ".zip" ) ; if ( zipFile . exists ( ) ) { return zipFile ; } // Create a temporary directory to which we'll copy the module and its dependencies. File modDest = new File ( modRoot , modID . toString ( ) + "-" + UUID . randomUUID ( ) . toString ( ) ) ; File modHome = new File ( modDest , modID . toString ( ) ) ; // Create the temporary destination directory. vertx . fileSystem ( ) . mkdirSync ( modHome . getAbsolutePath ( ) , true ) ; // Copy the module into the temporary directory. vertx . fileSystem ( ) . copySync ( modDir . getAbsolutePath ( ) , modHome . getAbsolutePath ( ) , true ) ; // Pull any module dependencies ("includes" and "deploys") into the temporary directory. pullInDependencies ( modID , modHome ) ; // Zip up the temporary directory into the zip file. zipDirectory ( zipFile . getPath ( ) , modDest . getAbsolutePath ( ) ) ; // Delete the temporary directory. vertx . fileSystem ( ) . deleteSync ( modDest . getAbsolutePath ( ) , true ) ; return zipFile ; }
Creates a zip file from a module .