MCPcopy
hub / github.com/arduino/Arduino / build

Method build

app/src/processing/app/SketchController.java:643–670  ·  view source on GitHub ↗

Preprocess and compile all the code for this sketch. In an advanced program, the returned class name could be different, which is why the className is set based on the return value. A compilation error will burp up a RunnerException. @return null if compilation failed, main class name if not

(boolean verbose, boolean save)

Source from the content-addressed store, hash-verified

641 * @return null if compilation failed, main class name if not
642 */
643 public String build(boolean verbose, boolean save) throws RunnerException, PreferencesMapException, IOException {
644 // run the preprocessor
645 for (CompilerProgressListener progressListener : editor.status.getCompilerProgressListeners()){
646 progressListener.progress(20);
647 }
648
649 EditorConsole.setCurrentEditorConsole(editor.console);
650
651 ensureExistence();
652
653
654 boolean deleteTemp = false;
655 File pathToSketch = sketch.getPrimaryFile().getFile();
656 if (sketch.isModified()) {
657 // If any files are modified, make a copy of the sketch with the changes
658 // saved, so arduino-builder will see the modifications.
659 pathToSketch = saveSketchInTempFolder();
660 deleteTemp = true;
661 }
662
663 try {
664 return new Compiler(pathToSketch, sketch).build(editor.status.getCompilerProgressListeners(), save);
665 } finally {
666 // Make sure we clean up any temporary sketch copy
667 if (deleteTemp)
668 FileUtils.recursiveDelete(pathToSketch.getParentFile());
669 }
670 }
671
672 private File saveSketchInTempFolder() throws IOException {
673 File tempFolder = FileUtils.createTempFolder("arduino_modified_sketch_");

Callers 3

exportAppletMethod · 0.95
runMethod · 0.45
BaseMethod · 0.45

Calls 9

ensureExistenceMethod · 0.95
recursiveDeleteMethod · 0.95
getPrimaryFileMethod · 0.80
progressMethod · 0.65
isModifiedMethod · 0.65
getFileMethod · 0.45

Tested by

no test coverage detected