mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Holding shift when pressing run or upload buttons give verbose output.
The upload.verbose and build.verbose preferences are still respected. You don't get verbose output with Command-Shift-R or Command-Shift-U, unlike Processing in which the shift modifier switches from Run to Present. Mostly this is because I didn't think verbose output deserved its own menu items, and that's how Processing implements the other shortcut. Holding shift while pressing upload doesn't show the compilation command lines. This matches the functionality of the upload.verbose preference, but may imply that the upload button doesn't also compile the code. Also, in Snow Leopard, the temp directory is in some crazy folder in /var. Luckily, everything still seems to work okay.
This commit is contained in:
parent
3febe7ce42
commit
240607a4a6
@ -496,11 +496,19 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
item = newJMenuItem("Upload to I/O Board", 'U');
|
||||
item.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
handleExport();
|
||||
handleExport(false);
|
||||
}
|
||||
});
|
||||
fileMenu.add(item);
|
||||
|
||||
// item = newJMenuItemShift("Upload to I/O Board (verbose)", 'U');
|
||||
// item.addActionListener(new ActionListener() {
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// handleExport(true);
|
||||
// }
|
||||
// });
|
||||
// fileMenu.add(item);
|
||||
|
||||
fileMenu.addSeparator();
|
||||
|
||||
item = newJMenuItemShift("Page Setup", 'P');
|
||||
@ -557,7 +565,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
});
|
||||
sketchMenu.add(item);
|
||||
|
||||
// item = newJMenuItemShift("Present", 'R');
|
||||
// item = newJMenuItemShift("Verify / Compile (verbose)", 'R');
|
||||
// item.addActionListener(new ActionListener() {
|
||||
// public void actionPerformed(ActionEvent e) {
|
||||
// handleRun(true);
|
||||
@ -1736,9 +1744,9 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
/**
|
||||
* Implements Sketch → Run.
|
||||
* @param present Set true to run in full screen (present mode).
|
||||
* @param verbose Set true to run with verbose output.
|
||||
*/
|
||||
public void handleRun(boolean present) {
|
||||
public void handleRun(final boolean verbose) {
|
||||
internalCloseRunner();
|
||||
running = true;
|
||||
toolbar.activate(EditorToolbar.RUN);
|
||||
@ -1752,14 +1760,15 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
console.clear();
|
||||
}
|
||||
|
||||
presenting = present;
|
||||
//presenting = present;
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
sketch.compile(new Target(
|
||||
Base.getHardwarePath() + File.separator + "cores",
|
||||
Preferences.get("boards." + Preferences.get("board") + ".build.core")));
|
||||
Preferences.get("boards." + Preferences.get("board") + ".build.core")),
|
||||
verbose);
|
||||
statusNotice("Done compiling.");
|
||||
} catch (RunnerException e) {
|
||||
//statusError("Error compiling...");
|
||||
@ -2155,7 +2164,7 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
* Made synchronized to (hopefully) avoid problems of people
|
||||
* hitting export twice, quickly, and horking things up.
|
||||
*/
|
||||
synchronized public void handleExport() {
|
||||
synchronized public void handleExport(final boolean verbose) {
|
||||
//if (!handleExportCheckModified()) return;
|
||||
toolbar.activate(EditorToolbar.EXPORT);
|
||||
|
||||
@ -2173,7 +2182,8 @@ public class Editor extends JFrame implements RunnerListener {
|
||||
|
||||
boolean success = sketch.exportApplet(new Target(
|
||||
Base.getHardwarePath() + File.separator + "cores",
|
||||
Preferences.get("boards." + Preferences.get("board") + ".build.core")));
|
||||
Preferences.get("boards." + Preferences.get("board") + ".build.core")),
|
||||
verbose);
|
||||
if (success) {
|
||||
statusNotice("Done uploading.");
|
||||
} else {
|
||||
|
@ -340,7 +340,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
||||
break;
|
||||
|
||||
case EXPORT:
|
||||
editor.handleExport();
|
||||
editor.handleExport(e.isShiftDown());
|
||||
break;
|
||||
|
||||
case SERIAL:
|
||||
|
@ -1140,7 +1140,9 @@ public class Sketch {
|
||||
* X. afterwards, some of these steps need a cleanup function
|
||||
* </PRE>
|
||||
*/
|
||||
protected String compile(Target target) throws RunnerException {
|
||||
protected String compile(Target target, boolean verbose)
|
||||
throws RunnerException {
|
||||
|
||||
String name;
|
||||
|
||||
// make sure the user didn't hide the sketch folder
|
||||
@ -1173,7 +1175,7 @@ public class Sketch {
|
||||
cleanup();
|
||||
|
||||
// handle preprocessing the main file's code
|
||||
name = build(tempBuildFolder.getAbsolutePath(), target);
|
||||
name = build(tempBuildFolder.getAbsolutePath(), target, verbose);
|
||||
size(tempBuildFolder.getAbsolutePath(), name);
|
||||
|
||||
return name;
|
||||
@ -1364,29 +1366,31 @@ public class Sketch {
|
||||
*
|
||||
* @return null if compilation failed, main class name if not
|
||||
*/
|
||||
public String build(String buildPath, Target target) throws RunnerException {
|
||||
public String build(String buildPath, Target target, boolean verbose)
|
||||
throws RunnerException {
|
||||
|
||||
// run the preprocessor
|
||||
String primaryClassName = preprocess(buildPath, target);
|
||||
|
||||
// compile the program. errors will happen as a RunnerException
|
||||
// that will bubble up to whomever called build().
|
||||
Compiler compiler = new Compiler();
|
||||
if (compiler.compile(this, buildPath, primaryClassName, target)) {
|
||||
if (compiler.compile(this, buildPath, primaryClassName, target, verbose)) {
|
||||
return primaryClassName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
protected boolean exportApplet(Target target) throws Exception {
|
||||
return exportApplet(new File(folder, "applet").getAbsolutePath(), target);
|
||||
protected boolean exportApplet(Target target, boolean verbose) throws Exception {
|
||||
return exportApplet(new File(folder, "applet").getAbsolutePath(), target, verbose);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle export to applet.
|
||||
*/
|
||||
public boolean exportApplet(String appletPath, Target target)
|
||||
public boolean exportApplet(String appletPath, Target target, boolean verbose)
|
||||
throws RunnerException, IOException {
|
||||
|
||||
// Make sure the user didn't hide the sketch folder
|
||||
@ -1410,7 +1414,7 @@ public class Sketch {
|
||||
appletFolder.mkdirs();
|
||||
|
||||
// build the sketch
|
||||
String foundName = build(appletFolder.getPath(), target);
|
||||
String foundName = build(appletFolder.getPath(), target, false);
|
||||
// (already reported) error during export, exit this function
|
||||
if (foundName == null) return false;
|
||||
|
||||
@ -1424,7 +1428,7 @@ public class Sketch {
|
||||
// }
|
||||
|
||||
size(appletFolder.getPath(), foundName);
|
||||
upload(appletFolder.getPath(), foundName);
|
||||
upload(appletFolder.getPath(), foundName, verbose);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1449,7 +1453,7 @@ public class Sketch {
|
||||
}
|
||||
|
||||
|
||||
protected String upload(String buildPath, String suggestedClassName)
|
||||
protected String upload(String buildPath, String suggestedClassName, boolean verbose)
|
||||
throws RunnerException {
|
||||
|
||||
Uploader uploader;
|
||||
@ -1458,7 +1462,8 @@ public class Sketch {
|
||||
//
|
||||
uploader = new AvrdudeUploader();
|
||||
boolean success = uploader.uploadUsingPreferences(buildPath,
|
||||
suggestedClassName);
|
||||
suggestedClassName,
|
||||
verbose);
|
||||
|
||||
return success ? suggestedClassName : null;
|
||||
}
|
||||
|
@ -42,8 +42,9 @@ public class AvrdudeUploader extends Uploader {
|
||||
}
|
||||
|
||||
// XXX: add support for uploading sketches using a programmer
|
||||
public boolean uploadUsingPreferences(String buildPath, String className)
|
||||
public boolean uploadUsingPreferences(String buildPath, String className, boolean verbose)
|
||||
throws RunnerException {
|
||||
this.verbose = verbose;
|
||||
String uploadUsing = Preferences.get("boards." + Preferences.get("board") + ".upload.using");
|
||||
if (uploadUsing == null) {
|
||||
// fall back on global preference
|
||||
@ -153,7 +154,7 @@ public class AvrdudeUploader extends Uploader {
|
||||
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avr/etc/avrdude.conf");
|
||||
}
|
||||
|
||||
if (Preferences.getBoolean("upload.verbose")) {
|
||||
if (verbose || Preferences.getBoolean("upload.verbose")) {
|
||||
commandDownloader.add("-v");
|
||||
commandDownloader.add("-v");
|
||||
commandDownloader.add("-v");
|
||||
|
@ -43,6 +43,7 @@ public class Compiler implements MessageConsumer {
|
||||
Sketch sketch;
|
||||
String buildPath;
|
||||
String primaryClassName;
|
||||
boolean verbose;
|
||||
|
||||
RunnerException exception;
|
||||
|
||||
@ -61,10 +62,12 @@ public class Compiler implements MessageConsumer {
|
||||
public boolean compile(Sketch sketch,
|
||||
String buildPath,
|
||||
String primaryClassName,
|
||||
Target target) throws RunnerException {
|
||||
Target target,
|
||||
boolean verbose) throws RunnerException {
|
||||
this.sketch = sketch;
|
||||
this.buildPath = buildPath;
|
||||
this.primaryClassName = primaryClassName;
|
||||
this.verbose = verbose;
|
||||
|
||||
// the pms object isn't used for anything but storage
|
||||
MessageStream pms = new MessageStream(this);
|
||||
@ -223,7 +226,7 @@ public class Compiler implements MessageConsumer {
|
||||
commandList.toArray(command);
|
||||
int result = 0;
|
||||
|
||||
if (Preferences.getBoolean("build.verbose")) {
|
||||
if (verbose || Preferences.getBoolean("build.verbose")) {
|
||||
for(int j = 0; j < command.length; j++) {
|
||||
System.out.print(command[j] + " ");
|
||||
}
|
||||
|
@ -56,11 +56,13 @@ public abstract class Uploader implements MessageConsumer {
|
||||
static InputStream serialInput;
|
||||
static OutputStream serialOutput;
|
||||
//int serial; // last byte of data received
|
||||
|
||||
boolean verbose;
|
||||
|
||||
public Uploader() {
|
||||
}
|
||||
|
||||
public abstract boolean uploadUsingPreferences(String buildPath, String className)
|
||||
public abstract boolean uploadUsingPreferences(String buildPath, String className, boolean verbose)
|
||||
throws RunnerException;
|
||||
|
||||
public abstract boolean burnBootloader(String programmer) throws RunnerException;
|
||||
@ -117,7 +119,7 @@ public abstract class Uploader implements MessageConsumer {
|
||||
|
||||
commandArray[0] = avrBasePath + commandArray[0];
|
||||
|
||||
if (Preferences.getBoolean("upload.verbose")) {
|
||||
if (verbose || Preferences.getBoolean("upload.verbose")) {
|
||||
for(int i = 0; i < commandArray.length; i++) {
|
||||
System.out.print(commandArray[i] + " ");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user