- // build package path to new class file
- File path = builddir;
- char[][] name = c[i].getCompoundName();
- path = new File(builddir, str(pack(name), '/'));
- if (!path.exists()) path.mkdirs();
-
- // write new class file
- path = new File(path, new String(name(name)) + ".class");
- OutputStream o = new BufferedOutputStream(
- new FileOutputStream(path));
- o.write(c[i].getBytes());
- o.close();
+ char[][] name = c[i].getCompoundName();
+ if (verbose) {
+ String pct = "";
+ /*+ percent;
+ percent++;
+ while (pct.length() < 2) pct = " " + pct;
+ pct = "(" + pct + "%) ";
+ */
+ String printme = " writing: " + pct + str(pack(name),'.') + "." + new String(name(name));
+ if (clearing.length() < printme.length()) clearing = "";
+ else clearing = clearing.substring(printme.length());
+ System.out.print(printme + clearing + "\r");
+ for(clearing = ""; clearing.length() < printme.length() + 5; clearing += " ");
+ }
+ if (buildzip) {
+ try {
+ jarfile.putNextEntry(new ZipEntry(str(pack(name), '/') + "/" + new String(name(name)) + ".class"));
+ jarfile.write(c[i].getBytes());
+ } catch (java.util.zip.ZipException ze) {
+ // HACK: horrendous hack
+ if (ze.getMessage().indexOf("duplicate entry") != -1) {
+ //System.out.println("compiler emitted class twice: " + new String(name(name)));
+ } else {
+ throw ze;
+ }
+ }
+ } else {
+ // build package path to new class file
+ File path = new File(builddir, str(pack(name), '/'));
+ if (!path.exists()) path.mkdirs();
+ // write new class file
+ path = new File(path, new String(name(name)) + ".class");
+ OutputStream o = new BufferedOutputStream(new FileOutputStream(path));
+ o.write(c[i].getBytes());
+ o.close();
+ }