}
// If the design directory has a java classes folder we put those into a jar and zip them to "files/system"
File javaClassesDir = new File(_designDirectory, DesignDirectory.FOLDERNAME_JAVA);
if (javaClassesDir.exists() && javaClassesDir.isDirectory()) {
TemporaryFile jar = new TemporaryFile("plugin-classes.jar", null, null);
ZipOutputStream jarStream = new ZipOutputStream(new FileOutputStream(jar.getFile()));
jarStream.setLevel(0);
DirZipper jarZipper = new DirZipper();
jarZipper.addFilePatternToIgnore("^\\..*$");
jarZipper.zipDirectory(javaClassesDir, jarStream);
jarStream.close();
zipper.zipNormalFile(jar.getFile(), zipOutputStream, "files/system/");
jar.delete();
}
// If we were given a java source folder we put its contents into plugin-sources.zip and put that into "files/system" (for OSS plugins)
if (javaSourceFolder != null) {
File javaSourceDir = new File(javaSourceFolder);
TemporaryFile zip = new TemporaryFile("plugin-sources.zip", null, null);
ZipOutputStream zipStream = new ZipOutputStream(new FileOutputStream(zip.getFile()));
zipStream.setLevel(0);
DirZipper jarZipper = new DirZipper();
jarZipper.addFilePatternToIgnore("^\\..*$");
jarZipper.zipDirectory(javaSourceDir, zipStream);
zipStream.close();
zipper.zipNormalFile(zip.getFile(), zipOutputStream, "files/system/");
zip.delete();
}