Skip to content

Commit ae99095

Browse files
committed
...now Verify works again... (part 2/3)
1 parent 611ed08 commit ae99095

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

app/src/processing/app/Base.java

+24-12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
package processing.app;
2424

25+
import cc.arduino.Compiler;
2526
import cc.arduino.Constants;
2627
import cc.arduino.UpdatableBoardsLibsFakeURLsHandler;
2728
import cc.arduino.contributions.*;
@@ -349,31 +350,42 @@ public Base(String[] args) throws Exception {
349350
System.exit(0);
350351

351352
} else if (parser.isVerifyOrUploadMode()) {
352-
splash.close();
353353
// Set verbosity for command line build
354354
PreferencesData.setBoolean("build.verbose", parser.isDoVerboseBuild());
355355
PreferencesData.setBoolean("upload.verbose", parser.isDoVerboseUpload());
356+
357+
// Set preserve-temp flag
356358
PreferencesData.setBoolean("runtime.preserve.temp.files", parser.isPreserveTempFiles());
357359

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
360361
PreferencesData.setDoSave(false);
361362

362-
Editor editor = editors.get(0);
363+
Sketch sketch = null;
364+
String outputFile = null;
363365

364-
if (parser.isUploadMode()) {
365-
splash.splashText(tr("Verifying and uploading..."));
366-
editor.exportHandler.run();
367-
} else {
366+
try {
367+
// Build
368368
splash.splashText(tr("Verifying..."));
369-
editor.runHandler.run();
370-
}
371369

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
374376
System.exit(1);
375377
}
376378

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+
377389
// No errors exit gracefully
378390
System.exit(0);
379391
} else if (parser.isGuiMode()) {

0 commit comments

Comments
 (0)