|
22 | 22 |
|
23 | 23 | package processing.app;
|
24 | 24 |
|
| 25 | +import cc.arduino.Compiler; |
25 | 26 | import cc.arduino.Constants;
|
26 | 27 | import cc.arduino.UpdatableBoardsLibsFakeURLsHandler;
|
27 | 28 | import cc.arduino.contributions.*;
|
@@ -349,31 +350,42 @@ public Base(String[] args) throws Exception {
|
349 | 350 | System.exit(0);
|
350 | 351 |
|
351 | 352 | } else if (parser.isVerifyOrUploadMode()) {
|
352 |
| - splash.close(); |
353 | 353 | // Set verbosity for command line build
|
354 | 354 | PreferencesData.setBoolean("build.verbose", parser.isDoVerboseBuild());
|
355 | 355 | PreferencesData.setBoolean("upload.verbose", parser.isDoVerboseUpload());
|
| 356 | + |
| 357 | + // Set preserve-temp flag |
356 | 358 | PreferencesData.setBoolean("runtime.preserve.temp.files", parser.isPreserveTempFiles());
|
357 | 359 |
|
358 |
| - // Make sure these verbosity preferences are only for the |
359 |
| - // current session |
| 360 | + // Make sure these verbosity preferences are only for the current session |
360 | 361 | PreferencesData.setDoSave(false);
|
361 | 362 |
|
362 |
| - Editor editor = editors.get(0); |
| 363 | + Sketch sketch = null; |
| 364 | + String outputFile = null; |
363 | 365 |
|
364 |
| - if (parser.isUploadMode()) { |
365 |
| - splash.splashText(tr("Verifying and uploading...")); |
366 |
| - editor.exportHandler.run(); |
367 |
| - } else { |
| 366 | + try { |
| 367 | + // Build |
368 | 368 | splash.splashText(tr("Verifying..."));
|
369 |
| - editor.runHandler.run(); |
370 |
| - } |
371 | 369 |
|
372 |
| - // Error during build or upload |
373 |
| - if (editor.status.isErr()) { |
| 370 | + File sketchFile = new File(parser.getFilenames().get(0)); |
| 371 | + sketch = new Sketch(sketchFile); |
| 372 | + |
| 373 | + outputFile = new Compiler(sketch).build(progress -> {}, false); |
| 374 | + } catch (Exception e) { |
| 375 | + // Error during build |
374 | 376 | System.exit(1);
|
375 | 377 | }
|
376 | 378 |
|
| 379 | + if (parser.isUploadMode()) { |
| 380 | + splash.splashText(tr("Verifying and uploading...")); |
| 381 | + // XXX: TODO |
| 382 | + //editor.exportHandler.run(); |
| 383 | + // Error during upload |
| 384 | + //if (editor.status.isErr()) { |
| 385 | + // System.exit(1); |
| 386 | + //} |
| 387 | + } |
| 388 | + |
377 | 389 | // No errors exit gracefully
|
378 | 390 | System.exit(0);
|
379 | 391 | } else if (parser.isGuiMode()) {
|
|
0 commit comments