3535
3636public class JavaBuild {
3737 /**
38- * Regular expression for parsing the size() method. This should match
39- * against any uses of the size() function, whether numbers or variables
40- * or whatever. This way, no warning is shown if size() isn't actually used
38+ * Regular expression for parsing the size() method. This should match
39+ * against any uses of the size() function, whether numbers or variables
40+ * or whatever. This way, no warning is shown if size() isn't actually used
4141 * in the sketch, which is the case especially for anyone who is cutting
4242 * and pasting from the reference.
4343 */
44- public static final String SIZE_REGEX =
44+ public static final String SIZE_REGEX =
4545 "(?:^|\\ s|;)size\\ s*\\ (\\ s*([^\\ s,]+)\\ s*,\\ s*([^\\ s,\\ )]+),?\\ s*([^\\ )]*)\\ s*\\ )\\ s*\\ ;" ;
4646 //"(?:^|\\s|;)size\\s*\\(\\s*(\\S+)\\s*,\\s*([^\\s,\\)]+),?\\s*([^\\)]*)\\s*\\)\\s*\\;";
47- public static final String PACKAGE_REGEX =
47+ public static final String PACKAGE_REGEX =
4848 "(?:^|\\ s|;)package\\ s+(\\ S+)\\ ;" ;
4949
5050 protected Sketch sketch ;
5151 protected Mode mode ;
52-
52+
5353 // what happens in the build, stays in the build.
5454 // (which is to say that everything below this line, stays within this class)
5555
@@ -151,7 +151,7 @@ public String build(File srcFolder, File binFolder) throws SketchException {
151151
152152// Base.openFolder(srcFolder);
153153// Base.openFolder(binFolder);
154-
154+
155155 // run the preprocessor
156156 String classNameFound = preprocess (srcFolder );
157157
@@ -166,8 +166,8 @@ public String build(File srcFolder, File binFolder) throws SketchException {
166166 }
167167 return null ;
168168 }
169-
170-
169+
170+
171171 public String getSketchClassName () {
172172 return sketchClassName ;
173173 }
@@ -250,7 +250,7 @@ public String preprocess(File srcFolder,
250250 }
251251
252252 // Automatically insert the OpenGL import line if P3D is used. Do this by
253- // modifying the code here instead of
253+ // modifying the code here instead of
254254 String scrubbed = scrubComments (sketch .getCode (0 ).getProgram ());
255255 String [] matches = PApplet .match (scrubbed , SIZE_REGEX );
256256 String renderer = "" ;
@@ -261,13 +261,13 @@ public String preprocess(File srcFolder,
261261 }
262262 // OpenGL import time! Really, this is for P3D, but may as well do it
263263 // for OpenGL as well.
264- if (renderer .equals ("P3D" ) || renderer .equals ("OPENGL" )) {
264+ if (renderer .equals ("P3D" ) || renderer .equals ("OPENGL" )) {
265265 bigCode .insert (0 , "import processing.opengl.*; " );
266266 }
267267
268268 PreprocessorResult result ;
269269 try {
270- File outputFolder = (packageName == null ) ?
270+ File outputFolder = (packageName == null ) ?
271271 srcFolder : new File (srcFolder , packageName .replace ('.' , '/' ));
272272 outputFolder .mkdirs ();
273273 final File java = new File (outputFolder , sketch .getName () + ".java" );
@@ -407,7 +407,7 @@ public String preprocess(File srcFolder,
407407 }
408408 } else {
409409 boolean found = false ;
410- // If someone insists on unnecessarily repeating the code folder
410+ // If someone insists on unnecessarily repeating the code folder
411411 // import, don't show an error for it.
412412 if (codeFolderPackages != null ) {
413413 String itemPkg = item .substring (0 , item .lastIndexOf ('.' ));
@@ -494,19 +494,19 @@ public String preprocess(File srcFolder,
494494
495495 /**
496496 * Returns true if this package isn't part of a library (it's a system import
497- * or something like that). Don't bother complaining about java.* or javax.*
498- * because it's probably in boot.class.path. But we're not checking against
497+ * or something like that). Don't bother complaining about java.* or javax.*
498+ * because it's probably in boot.class.path. But we're not checking against
499499 * that path since it's enormous. Unfortunately we do still have to check
500- * for libraries that begin with a prefix like javax, since that includes
500+ * for libraries that begin with a prefix like javax, since that includes
501501 * the OpenGL library, even though we're just returning true here, hrm...
502502 */
503503 protected boolean ignorableImport (String pkg ) {
504504 if (pkg .startsWith ("java." )) return true ;
505505 if (pkg .startsWith ("javax." )) return true ;
506506 return false ;
507507 }
508-
509-
508+
509+
510510 protected int findErrorFile (int errorLine ) {
511511 for (int i = sketch .getCodeCount () - 1 ; i > 0 ; i --) {
512512 SketchCode sc = sketch .getCode (i );
@@ -535,8 +535,8 @@ public File getBinFolder() {
535535
536536 /**
537537 * Absolute path to the sketch folder. Used to set the working directry of
538- * the sketch when running, i.e. so that saveFrame() goes to the right
539- * location when running from the PDE, instead of the same folder as the
538+ * the sketch when running, i.e. so that saveFrame() goes to the right
539+ * location when running from the PDE, instead of the same folder as the
540540 * Processing.exe or the root of the user's home dir.
541541 */
542542 public String getSketchPath () {
@@ -548,8 +548,8 @@ public String getSketchPath() {
548548 public String getClassPath () {
549549 return classPath ;
550550 }
551-
552-
551+
552+
553553 /** Return the java.library.path for this sketch (for all the native DLLs etc). */
554554 public String getJavaLibraryPath () {
555555 return javaLibraryPath ;
@@ -698,7 +698,7 @@ protected boolean exportApplet() throws SketchException, IOException {
698698 */
699699 public boolean exportApplet (File appletFolder ) throws SketchException , IOException {
700700 mode .prepareExportFolder (appletFolder );
701-
701+
702702 srcFolder = sketch .makeTempFolder ();
703703 binFolder = sketch .makeTempFolder ();
704704 String foundName = build (srcFolder , binFolder );
@@ -747,10 +747,10 @@ public boolean exportApplet(File appletFolder) throws SketchException, IOExcepti
747747
748748 // Grab the Javadoc-style description from the main code.
749749 String description = "" ;
750- // If there are multiple closings, need to catch the first,
750+ // If there are multiple closings, need to catch the first,
751751 // which is what the (.*?) will do for us.
752752 // http://code.google.com/p/processing/issues/detail?id=877
753- String [] javadoc = PApplet .match (sketch .getCode (0 ).getProgram (), "/\\ *{2,}(.*?)\\ *+/" );
753+ String [] javadoc = PApplet .match (sketch .getCode (0 ).getProgram (), "/\\ *{2,}(.*?)\\ *+/" );
754754 if (javadoc != null ) {
755755 StringBuffer dbuffer = new StringBuffer ();
756756 String found = javadoc [1 ];
@@ -802,7 +802,7 @@ public boolean exportApplet(File appletFolder) throws SketchException, IOExcepti
802802 javaLibraryPath .length () != 0 ;
803803
804804 File skeletonFolder = mode .getContentFile ("applet" );
805-
805+
806806 // Copy the loading gif to the applet
807807 String LOADING_IMAGE = "loading.gif" ;
808808 // Check if the user already has their own loader image
@@ -816,7 +816,7 @@ public boolean exportApplet(File appletFolder) throws SketchException, IOExcepti
816816 // not a good idea after all
817817// File deployFile = new File(skeletonFolder, "deployJava.js");
818818// Base.copyFile(deployFile, new File(appletFolder, "deployJava.js"));
819-
819+
820820 // Create new .jar file
821821 FileOutputStream zipOutputFile =
822822 new FileOutputStream (new File (appletFolder , sketch .getName () + ".jar" ));
@@ -877,7 +877,7 @@ public boolean exportApplet(File appletFolder) throws SketchException, IOExcepti
877877 String bagelJarPath = bagelJar .getAbsolutePath ();
878878 packClassPathIntoZipFile (bagelJarPath , zos , zipFileContents );
879879 }
880-
880+
881881 if (sketch .hasCodeFolder ()) {
882882 File [] codeJarFiles = sketch .getCodeFolder ().listFiles (new FilenameFilter () {
883883 public boolean accept (File dir , String name ) {
@@ -1040,9 +1040,9 @@ static public String scrubComments(String what) {
10401040 */
10411041 protected boolean exportApplication () throws IOException , SketchException {
10421042 // Do the build once, so that we know what libraries are in use (and what
1043- // the situation is with their native libs), and also for efficiency of
1044- // not redoing the compilation for each platform. In particular, though,
1045- // importedLibraries won't be set until the preprocessing has finished,
1043+ // the situation is with their native libs), and also for efficiency of
1044+ // not redoing the compilation for each platform. In particular, though,
1045+ // importedLibraries won't be set until the preprocessing has finished,
10461046 // so we have to do that before the stuff below.
10471047 String foundName = build ();
10481048
@@ -1098,16 +1098,16 @@ protected boolean exportApplication() throws IOException, SketchException {
10981098 private boolean exportApplication (File destFolder ,
10991099 int exportPlatform ,
11001100 int exportBits ) throws IOException , SketchException {
1101- // TODO this should probably be a dialog box instead of a warning
1101+ // TODO this should probably be a dialog box instead of a warning
11021102 // on the terminal. And the message should be written better than this.
11031103 // http://code.google.com/p/processing/issues/detail?id=884
11041104 for (Library library : importedLibraries ) {
11051105 if (!library .supportsArch (exportPlatform , exportBits )) {
11061106 String pn = PConstants .platformNames [exportPlatform ];
1107- System .err .println ("The application." + pn + exportBits +
1108- " folder will not be created because no " +
1107+ System .err .println ("The application." + pn + exportBits +
1108+ " folder will not be created because no " +
11091109 exportBits + "-bit version of " +
1110- library .getName () +
1110+ library .getName () +
11111111 " is available for " + pn );
11121112 return true ; // don't cancel export for this, just move along
11131113 }
@@ -1117,7 +1117,7 @@ private boolean exportApplication(File destFolder,
11171117
11181118 mode .prepareExportFolder (destFolder );
11191119
1120-
1120+
11211121 /// figure out where the jar files will be placed
11221122
11231123 File jarFolder = new File (destFolder , "lib" );
@@ -1172,7 +1172,7 @@ private boolean exportApplication(File destFolder,
11721172
11731173 if (exportPlatform == PConstants .WINDOWS ) {
11741174 if (exportBits == 64 ) {
1175- // We don't yet have a 64-bit launcher, so this is a workaround for now.
1175+ // We don't yet have a 64-bit launcher, so this is a workaround for now.
11761176 File batFile = new File (destFolder , sketch .getName () + ".bat" );
11771177 PrintWriter writer = PApplet .createWriter (batFile );
11781178 writer .println ("@echo off" );
@@ -1222,7 +1222,7 @@ private boolean exportApplication(File destFolder,
12221222
12231223 // add the data folder to the main jar file
12241224// addDataFolder(zos);
1225- // For 2.0a2, make the data folder a separate directory, rather than
1225+ // For 2.0a2, make the data folder a separate directory, rather than
12261226 // packaging potentially large files into the JAR. On OS X, we have to hide
12271227 // the folder inside the .app package, while Linux and Windows will have a
12281228 // 'data' folder next to 'lib'.
@@ -1276,7 +1276,7 @@ private boolean exportApplication(File destFolder,
12761276// System.out.println("export: " + exportFile);
12771277 String exportName = exportFile .getName ();
12781278 if (!exportFile .exists ()) {
1279- System .err .println (exportFile .getName () +
1279+ System .err .println (exportFile .getName () +
12801280 " is mentioned in export.txt, but it's " +
12811281 "a big fat lie and does not exist." );
12821282
@@ -1310,12 +1310,12 @@ private boolean exportApplication(File destFolder,
13101310 // first 2.0a2 attempt, until below...
13111311// } else if (exportPlatform == PConstants.MACOSX) {
13121312// Base.copyFile(exportFile, new File(jarFolder, exportName));
1313- //
1313+ //
13141314// } else {
13151315// Base.copyFile(exportFile, new File(destFolder, exportName));
13161316 } else {
1317- // Starting with 2.0a2 put extra export files (DLLs, plugins folder,
1318- // anything else for libraries) inside lib or Contents/Resources/Java
1317+ // Starting with 2.0a2 put extra export files (DLLs, plugins folder,
1318+ // anything else for libraries) inside lib or Contents/Resources/Java
13191319 Base .copyFile (exportFile , new File (jarFolder , exportName ));
13201320 }
13211321 }
@@ -1363,7 +1363,7 @@ private boolean exportApplication(File destFolder,
13631363// runOptions += " -d32";
13641364// } else if (exportBits == 64) {
13651365// runOptions += " -d64";
1366- // }
1366+ // }
13671367// }
13681368
13691369 /// macosx: write out Info.plist (template for classpath, etc)
@@ -1401,7 +1401,7 @@ private boolean exportApplication(File destFolder,
14011401 while ((index = sb .indexOf ("@@lsarchitecturepriority@@" )) != -1 ) {
14021402 // More about this mess: http://support.apple.com/kb/TS2827
14031403 // First default to exportBits == 0 case
1404- String arch = "<string>x86_64</string>\n <string>i386</string>" ;
1404+ String arch = "<string>x86_64</string>\n <string>i386</string>" ;
14051405 if (exportBits == 32 ) {
14061406 arch = "<string>i386</string>" ;
14071407 } else if (exportBits == 64 ) {
@@ -1442,7 +1442,7 @@ private boolean exportApplication(File destFolder,
14421442 // another fix for bug #234, LD_LIBRARY_PATH ignored on some platforms
14431443 //ps.print("LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$APPDIR\n");
14441444 pw .print ("java " + Preferences .get ("run.options" ) +
1445- " -Djava.library.path=\" $APPDIR:$APPDIR\\ lib\" " +
1445+ " -Djava.library.path=\" $APPDIR:$APPDIR/ lib\" " +
14461446 " -cp \" " + exportClassPath + "\" " +
14471447 " " + sketch .getName () + "\n " );
14481448
0 commit comments