| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent cf2f7b0 commit 20ec815
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,9 @@ X could add -Dapp.root=$APP_ROOT and get via System.getProperty("app.root") | |||
| 15 | 15 | X https://github.com/processing/processing/issues/2181 | |
| 16 | 16 | X textWidth() incorrect with default (JAVA2D) renderer and default font | |
| 17 | 17 | X https://github.com/processing/processing/issues/2175 | |
| 18 | + X Error on size() when using FX2D due to stage inset issues | ||
| 19 | + X https://github.com/processing/processing/issues/3412 | ||
| 20 | + X probably fixes w/ size() removal change | ||
| 18 | 21 | ||
| 19 | 22 | jakub | |
| 20 | 23 | X Remove alpha filler (hopefully no regression here) | |
@@ -58,8 +61,6 @@ _ https://github.com/processing/processing/issues/2063 | |||
| 58 | 61 | ||
| 59 | 62 | ||
| 60 | 63 | javafx | |
| 61 | - _ Error on size() when using FX2D due to stage inset issues | ||
| 62 | - _ https://github.com/processing/processing/issues/3412 | ||
| 63 | 64 | _ static mode sketches (draw once and halt w/o closing window) | |
| 64 | 65 | _ fix display handling, line up the device order with AWT | |
| 65 | 66 | _ https://docs.oracle.com/javafx/2/api/javafx/stage/Screen.html | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -112,10 +112,10 @@ public Commander(String[] args) { | |||
| 112 | 112 | System.exit(1); | |
| 113 | 113 | } | |
| 114 | 114 | ||
| 115 | - // File preferencesFile = Base.getSettingsFile("preferences.txt"); | ||
| 116 | - // System.out.println("Preferences file at " + preferencesFile.getAbsolutePath()); | ||
| 117 | - | ||
| 115 | + int argOffset = 0; | ||
| 118 | 116 | for (String arg : args) { | |
| 117 | + argOffset++; | ||
| 118 | + | ||
| 119 | 119 | if (arg.length() == 0) { | |
| 120 | 120 | // ignore it, just the crappy shell script | |
| 121 | 121 | ||
@@ -127,18 +127,19 @@ public Commander(String[] args) { | |||
| 127 | 127 | ||
| 128 | 128 | } else if (arg.equals(buildArg)) { | |
| 129 | 129 | task = BUILD; | |
| 130 | + break; | ||
| 130 | 131 | ||
| 131 | 132 | } else if (arg.equals(runArg)) { | |
| 132 | 133 | task = RUN; | |
| 134 | + break; | ||
| 133 | 135 | ||
| 134 | 136 | } else if (arg.equals(presentArg)) { | |
| 135 | 137 | task = PRESENT; | |
| 136 | - | ||
| 137 | - // } else if (arg.equals(exportAppletArg)) { | ||
| 138 | - // task = EXPORT_APPLET; | ||
| 138 | + break; | ||
| 139 | 139 | ||
| 140 | 140 | } else if (arg.equals(exportApplicationArg)) { | |
| 141 | 141 | task = EXPORT; | |
| 142 | + break; | ||
| 142 | 143 | ||
| 143 | 144 | } else if (arg.equals(noJavaArg)) { | |
| 144 | 145 | embedJava = false; | |
@@ -189,6 +190,7 @@ public Commander(String[] args) { | |||
| 189 | 190 | complainAndQuit("I don't know anything about " + arg + ".", true); | |
| 190 | 191 | } | |
| 191 | 192 | } | |
| 193 | + String[] sketchArgs = PApplet.subset(args, argOffset); | ||
| 192 | 194 | ||
| 193 | 195 | // if ((outputPath == null) && | |
| 194 | 196 | // (task == PREPROCESS || task == BUILD || | |
@@ -268,7 +270,11 @@ public Commander(String[] args) { | |||
| 268 | 270 | success = true; | |
| 269 | 271 | if (task == RUN || task == PRESENT) { | |
| 270 | 272 | Runner runner = new Runner(build, this); | |
| 271 | - runner.launch(task == PRESENT); | ||
| 273 | + if (task == PRESENT) { | ||
| 274 | + runner.present(sketchArgs); | ||
| 275 | + } else { | ||
| 276 | + runner.launch(sketchArgs); | ||
| 277 | + } | ||
| 272 | 278 | } | |
| 273 | 279 | } else { | |
| 274 | 280 | success = false; | |
@@ -369,7 +375,7 @@ static void printCommandLine(PrintStream out) { | |||
| 369 | 375 | out.println(); | |
| 370 | 376 | out.println("--build Preprocess and compile a sketch into .class files."); | |
| 371 | 377 | out.println("--run Preprocess, compile, and run a sketch."); | |
| 372 | - out.println("--present Preprocess, compile, and run a sketch full screen."); | ||
| 378 | + out.println("--present Preprocess, compile, and run a sketch in presentation mode."); | ||
| 373 | 379 | out.println(); | |
| 374 | 380 | out.println("--export Export an application."); | |
| 375 | 381 | out.println("--no-java Do not embed Java. Use at your own risk!"); | |
@@ -378,6 +384,13 @@ static void printCommandLine(PrintStream out) { | |||
| 378 | 384 | // out.println("--bits Must be specified if libraries are used that are"); | |
| 379 | 385 | // out.println(" 32- or 64-bit specific such as the OpenGL library."); | |
| 380 | 386 | // out.println(" Otherwise specify 0 or leave it out."); | |
| 387 | + | ||
| 388 | + out.println("The --build, --run, --present, or --export must be the final parameter."); | ||
| 389 | + out.println("Additional arguments will be passed to the sketch itself and available"); | ||
| 390 | + out.println("in the sketch's 'args' field. To pass options understood by PApplet.main(),"); | ||
| 391 | + out.println("write a custom main() method so that the preprocessor does not add one."); | ||
| 392 | + out.println("https://github.com/processing/processing/wiki/Command-Line"); | ||
| 393 | + | ||
| 381 | 394 | out.println(); | |
| 382 | 395 | } | |
| 383 | 396 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -216,7 +216,7 @@ public synchronized void startDebug() { | |||
| 216 | 216 | ||
| 217 | 217 | log(Level.INFO, "launching debuggee runtime"); | |
| 218 | 218 | runtime = new Runner(build, editor); | |
| 219 | - VirtualMachine vm = runtime.launchDebug(); // non-blocking | ||
| 219 | + VirtualMachine vm = runtime.debug(null); // non-blocking | ||
| 220 | 220 | if (vm == null) { | |
| 221 | 221 | log(Level.SEVERE, "error 37: launch failed"); | |
| 222 | 222 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -149,7 +149,12 @@ public Runner handleLaunch(Sketch sketch, RunnerListener listener, | |||
| 149 | 149 | final Runner runtime = new Runner(build, listener); | |
| 150 | 150 | new Thread(new Runnable() { | |
| 151 | 151 | public void run() { | |
| 152 | - runtime.launch(present); // this blocks until finished | ||
| 152 | + // these block until finished | ||
| 153 | + if (present) { | ||
| 154 | + runtime.present(null); | ||
| 155 | + } else { | ||
| 156 | + runtime.launch(null); | ||
| 157 | + } | ||
| 153 | 158 | } | |
| 154 | 159 | }).start(); | |
| 155 | 160 | return runtime; | |
@@ -197,15 +202,20 @@ public Runner handleTweak(Sketch sketch, | |||
| 197 | 202 | if (appletClassName != null) { | |
| 198 | 203 | final Runner runtime = new Runner(build, listener); | |
| 199 | 204 | new Thread(new Runnable() { | |
| 200 | - public void run() { | ||
| 201 | - runtime.launch(present); // this blocks until finished | ||
| 202 | - // next lines are executed when the sketch quits | ||
| 203 | - if (launchInteractive) { | ||
| 204 | - editor.initEditorCode(parser.allHandles, false); | ||
| 205 | - editor.stopTweakMode(parser.allHandles); | ||
| 206 | - } | ||
| 205 | + public void run() { | ||
| 206 | + // these block until finished | ||
| 207 | + if (present) { | ||
| 208 | + runtime.present(null); | ||
| 209 | + } else { | ||
| 210 | + runtime.launch(null); | ||
| 207 | 211 | } | |
| 208 | - }).start(); | ||
| 212 | + // next lines are executed when the sketch quits | ||
| 213 | + if (launchInteractive) { | ||
| 214 | + editor.initEditorCode(parser.allHandles, false); | ||
| 215 | + editor.stopTweakMode(parser.allHandles); | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + }).start(); | ||
| 209 | 219 | ||
| 210 | 220 | if (launchInteractive) { | |
| 211 | 221 | // replace editor code with baseCode | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ | |||
| 26 | 26 | import processing.app.exec.StreamRedirectThread; | |
| 27 | 27 | import processing.app.ui.Editor; | |
| 28 | 28 | import processing.core.*; | |
| 29 | + import processing.data.StringList; | ||
| 29 | 30 | import processing.mode.java.JavaBuild; | |
| 30 | 31 | ||
| 31 | 32 | import java.awt.GraphicsDevice; | |
@@ -113,19 +114,28 @@ public Runner(JavaBuild build, RunnerListener listener) throws SketchException { | |||
| 113 | 114 | } | |
| 114 | 115 | ||
| 115 | 116 | ||
| 116 | - public void launch(boolean presenting) { | ||
| 117 | - if (launchVirtualMachine(presenting)) { | ||
| 117 | + public VirtualMachine launch(String[] args) { | ||
| 118 | + if (launchVirtualMachine(false, args)) { | ||
| 118 | 119 | generateTrace(); | |
| 119 | 120 | } | |
| 121 | + return vm; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + | ||
| 125 | + public VirtualMachine present(String[] args) { | ||
| 126 | + if (launchVirtualMachine(true, args)) { | ||
| 127 | + generateTrace(); | ||
| 128 | + } | ||
| 129 | + return vm; | ||
| 120 | 130 | } | |
| 121 | 131 | ||
| 122 | 132 | ||
| 123 | 133 | /** | |
| 124 | 134 | * Simple non-blocking launch of the virtual machine. VM starts suspended. | |
| 125 | 135 | * @return debuggee VM or null on failure | |
| 126 | 136 | */ | |
| 127 | - public VirtualMachine launchDebug() { | ||
| 128 | - if (launchVirtualMachine(false)) { // will return null on failure | ||
| 137 | + public VirtualMachine debug(String[] args) { | ||
| 138 | + if (launchVirtualMachine(false, args)) { // will return null on failure | ||
| 129 | 139 | redirectStreams(vm); | |
| 130 | 140 | } | |
| 131 | 141 | return vm; | |
@@ -153,9 +163,9 @@ public VirtualMachine vm() { | |||
| 153 | 163 | } | |
| 154 | 164 | ||
| 155 | 165 | ||
| 156 | - public boolean launchVirtualMachine(boolean presenting) { | ||
| 157 | - String[] vmParams = getMachineParams(); | ||
| 158 | - String[] sketchParams = getSketchParams(presenting); | ||
| 166 | + public boolean launchVirtualMachine(boolean present, String[] args) { | ||
| 167 | + StringList vmParams = getMachineParams(); | ||
| 168 | + StringList sketchParams = getSketchParams(present, args); | ||
| 159 | 169 | // PApplet.printArray(sketchParams); | |
| 160 | 170 | int port = 8000 + (int) (Math.random() * 1000); | |
| 161 | 171 | String portStr = String.valueOf(port); | |
@@ -167,13 +177,13 @@ public boolean launchVirtualMachine(boolean presenting) { | |||
| 167 | 177 | String jdwpArg = "-agentlib:jdwp=transport=dt_socket,address=" + portStr + ",server=y,suspend=y"; | |
| 168 | 178 | ||
| 169 | 179 | // Everyone works the same under Java 7 (also on OS X) | |
| 170 | - String[] commandArgs = new String[] { Platform.getJavaPath(), jdwpArg }; | ||
| 180 | + StringList commandArgs = new StringList(); | ||
| 181 | + commandArgs.append(Platform.getJavaPath()); | ||
| 182 | + commandArgs.append(jdwpArg); | ||
| 171 | 183 | ||
| 172 | - commandArgs = PApplet.concat(commandArgs, vmParams); | ||
| 173 | - commandArgs = PApplet.concat(commandArgs, sketchParams); | ||
| 174 | - // PApplet.println(commandArgs); | ||
| 175 | - // commandArg.setValue(commandArgs); | ||
| 176 | - launchJava(commandArgs); | ||
| 184 | + commandArgs.append(vmParams); | ||
| 185 | + commandArgs.append(sketchParams); | ||
| 186 | + launchJava(commandArgs.array()); | ||
| 177 | 187 | ||
| 178 | 188 | AttachingConnector connector = (AttachingConnector) | |
| 179 | 189 | findConnector("com.sun.jdi.SocketAttach"); | |
@@ -228,8 +238,8 @@ public boolean launchVirtualMachine(boolean presenting) { | |||
| 228 | 238 | } | |
| 229 | 239 | ||
| 230 | 240 | ||
| 231 | - protected String[] getMachineParams() { | ||
| 232 | - ArrayList<String> params = new ArrayList<String>(); | ||
| 241 | + protected StringList getMachineParams() { | ||
| 242 | + StringList params = new StringList(); | ||
| 233 | 243 | ||
| 234 | 244 | //params.add("-Xint"); // interpreted mode | |
| 235 | 245 | //params.add("-Xprof"); // profiler | |
@@ -244,73 +254,53 @@ protected String[] getMachineParams() { | |||
| 244 | 254 | for (int i = 0; i < pieces.length; i++) { | |
| 245 | 255 | String p = pieces[i].trim(); | |
| 246 | 256 | if (p.length() > 0) { | |
| 247 | - params.add(p); | ||
| 257 | + params.append(p); | ||
| 248 | 258 | } | |
| 249 | 259 | } | |
| 250 | 260 | } | |
| 251 | 261 | ||
| 252 | 262 | // params.add("-Djava.ext.dirs=nuffing"); | |
| 253 | 263 | ||
| 254 | 264 | if (Preferences.getBoolean("run.options.memory")) { | |
| 255 | - params.add("-Xms" + Preferences.get("run.options.memory.initial") + "m"); | ||
| 256 | - params.add("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); | ||
| 265 | + params.append("-Xms" + Preferences.get("run.options.memory.initial") + "m"); | ||
| 266 | + params.append("-Xmx" + Preferences.get("run.options.memory.maximum") + "m"); | ||
| 257 | 267 | } | |
| 258 | 268 | ||
| 259 | 269 | if (Platform.isMacOS()) { | |
| 260 | - params.add("-Xdock:name=" + build.getSketchClassName()); | ||
| 270 | + params.append("-Xdock:name=" + build.getSketchClassName()); | ||
| 261 | 271 | // params.add("-Dcom.apple.mrj.application.apple.menu.about.name=" + | |
| 262 | 272 | // sketch.getMainClassName()); | |
| 263 | 273 | } | |
| 264 | 274 | // sketch.libraryPath might be "" | |
| 265 | 275 | // librariesClassPath will always have sep char prepended | |
| 266 | - params.add("-Djava.library.path=" + | ||
| 267 | - build.getJavaLibraryPath() + | ||
| 268 | - File.pathSeparator + | ||
| 269 | - System.getProperty("java.library.path")); | ||
| 276 | + params.append("-Djava.library.path=" + | ||
| 277 | + build.getJavaLibraryPath() + | ||
| 278 | + File.pathSeparator + | ||
| 279 | + System.getProperty("java.library.path")); | ||
| 270 | 280 | ||
| 271 | - params.add("-cp"); | ||
| 272 | - params.add(build.getClassPath()); | ||
| 273 | - // params.add(sketch.getClassPath() + | ||
| 274 | - // File.pathSeparator + | ||
| 275 | - // Base.librariesClassPath); | ||
| 281 | + params.append("-cp"); | ||
| 282 | + params.append(build.getClassPath()); | ||
| 276 | 283 | ||
| 277 | 284 | // enable assertions | |
| 278 | 285 | // http://dev.processing.org/bugs/show_bug.cgi?id=1188 | |
| 279 | - params.add("-ea"); | ||
| 286 | + params.append("-ea"); | ||
| 280 | 287 | //PApplet.println(PApplet.split(sketch.classPath, ':')); | |
| 281 | 288 | ||
| 282 | - String outgoing[] = new String[params.size()]; | ||
| 283 | - params.toArray(outgoing); | ||
| 284 | - | ||
| 285 | - // PApplet.println(outgoing); | ||
| 286 | - // PApplet.println(PApplet.split(outgoing[0], ":")); | ||
| 287 | - // PApplet.println(); | ||
| 288 | - // PApplet.println("class path"); | ||
| 289 | - // PApplet.println(PApplet.split(outgoing[2], ":")); | ||
| 290 | - | ||
| 291 | - return outgoing; | ||
| 292 | - //return (String[]) params.toArray(); | ||
| 293 | - | ||
| 294 | - // System.out.println("sketch class path"); | ||
| 295 | - // PApplet.println(PApplet.split(sketch.classPath, ';')); | ||
| 296 | - // System.out.println(); | ||
| 297 | - // System.out.println("libraries class path"); | ||
| 298 | - // PApplet.println(PApplet.split(Base.librariesClassPath, ';')); | ||
| 299 | - // System.out.println(); | ||
| 289 | + return params; | ||
| 300 | 290 | } | |
| 301 | 291 | ||
| 302 | 292 | ||
| 303 | - protected String[] getSketchParams(boolean presenting) { | ||
| 304 | - ArrayList<String> params = new ArrayList<String>(); | ||
| 293 | + protected StringList getSketchParams(boolean present, String[] args) { | ||
| 294 | + StringList params = new StringList(); | ||
| 305 | 295 | ||
| 306 | 296 | // It's dangerous to add your own main() to your code, | |
| 307 | 297 | // but if you've done it, we'll respect your right to hang yourself. | |
| 308 | 298 | // http://processing.org/bugs/bugzilla/1446.html | |
| 309 | 299 | if (build.getFoundMain()) { | |
| 310 | - params.add(build.getSketchClassName()); | ||
| 300 | + params.append(build.getSketchClassName()); | ||
| 311 | 301 | ||
| 312 | 302 | } else { | |
| 313 | - params.add("processing.core.PApplet"); | ||
| 303 | + params.append("processing.core.PApplet"); | ||
| 314 | 304 | ||
| 315 | 305 | // get the stored device index (starts at 1) | |
| 316 | 306 | int runDisplay = Preferences.getInteger("run.display"); | |
@@ -366,8 +356,8 @@ protected String[] getSketchParams(boolean presenting) { | |||
| 366 | 356 | // If sketches are to be shown on the same display as the editor, | |
| 367 | 357 | // provide the editor location so the sketch's main() can place it. | |
| 368 | 358 | Point editorLocation = editor.getLocation(); | |
| 369 | - params.add(PApplet.ARGS_EDITOR_LOCATION + "=" + | ||
| 370 | - editorLocation.x + "," + editorLocation.y); | ||
| 359 | + params.append(PApplet.ARGS_EDITOR_LOCATION + "=" + | ||
| 360 | + editorLocation.x + "," + editorLocation.y); | ||
| 371 | 361 | } else { | |
| 372 | 362 | // The sketch's main() will set a location centered on the new | |
| 373 | 363 | // display. It has to happen in main() because the width/height | |
@@ -379,37 +369,38 @@ protected String[] getSketchParams(boolean presenting) { | |||
| 379 | 369 | // params.add(PApplet.ARGS_LOCATION + "=" + runX + "," + runY); | |
| 380 | 370 | } | |
| 381 | 371 | } else { | |
| 382 | - params.add(PApplet.ARGS_LOCATION + "=" + | ||
| 383 | - windowLocation.x + "," + windowLocation.y); | ||
| 372 | + params.append(PApplet.ARGS_LOCATION + "=" + | ||
| 373 | + windowLocation.x + "," + windowLocation.y); | ||
| 384 | 374 | } | |
| 385 | - params.add(PApplet.ARGS_EXTERNAL); | ||
| 375 | + params.append(PApplet.ARGS_EXTERNAL); | ||
| 386 | 376 | } | |
| 387 | 377 | ||
| 388 | - params.add(PApplet.ARGS_DISPLAY + "=" + runDisplay); | ||
| 378 | + params.append(PApplet.ARGS_DISPLAY + "=" + runDisplay); | ||
| 389 | 379 | ||
| 390 | 380 | ||
| 391 | - if (presenting) { | ||
| 392 | - params.add(PApplet.ARGS_PRESENT); | ||
| 381 | + if (present) { | ||
| 382 | + params.append(PApplet.ARGS_PRESENT); | ||
| 393 | 383 | // if (Preferences.getBoolean("run.present.exclusive")) { | |
| 394 | 384 | // params.add(PApplet.ARGS_EXCLUSIVE); | |
| 395 | 385 | // } | |
| 396 | - params.add(PApplet.ARGS_STOP_COLOR + "=" + | ||
| 397 | - Preferences.get("run.present.stop.color")); | ||
| 398 | - params.add(PApplet.ARGS_WINDOW_COLOR + "=" + | ||
| 399 | - Preferences.get("run.present.bgcolor")); | ||
| 386 | + params.append(PApplet.ARGS_STOP_COLOR + "=" + | ||
| 387 | + Preferences.get("run.present.stop.color")); | ||
| 388 | + params.append(PApplet.ARGS_WINDOW_COLOR + "=" + | ||
| 389 | + Preferences.get("run.present.bgcolor")); | ||
| 400 | 390 | } | |
| 401 | 391 | ||
| 402 | 392 | // There was a PDE X hack that put this after the class name, but it was | |
| 403 | 393 | // removed for 3.0a6 because it would break the args passed to sketches. | |
| 404 | - params.add(PApplet.ARGS_SKETCH_FOLDER + "=" + build.getSketchPath()); | ||
| 394 | + params.append(PApplet.ARGS_SKETCH_FOLDER + "=" + build.getSketchPath()); | ||
| 405 | 395 | ||
| 406 | - params.add(build.getSketchClassName()); | ||
| 396 | + params.append(build.getSketchClassName()); | ||
| 407 | 397 | } | |
| 408 | - | ||
| 409 | - // String outgoing[] = new String[params.size()]; | ||
| 410 | - // params.toArray(outgoing); | ||
| 411 | - // return outgoing; | ||
| 412 | - return params.toArray(new String[0]); | ||
| 398 | + // Add command-line arguments to be given to the sketch itself | ||
| 399 | + if (args != null) { | ||
| 400 | + params.append(args); | ||
| 401 | + } | ||
| 402 | + // Pass back the whole list | ||
| 403 | + return params; | ||
| 413 | 404 | } | |
| 414 | 405 | ||
| 415 | 406 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments