mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03: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:
@ -496,11 +496,19 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
item = newJMenuItem("Upload to I/O Board", 'U');
|
item = newJMenuItem("Upload to I/O Board", 'U');
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
handleExport();
|
handleExport(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fileMenu.add(item);
|
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();
|
fileMenu.addSeparator();
|
||||||
|
|
||||||
item = newJMenuItemShift("Page Setup", 'P');
|
item = newJMenuItemShift("Page Setup", 'P');
|
||||||
@ -557,7 +565,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
});
|
});
|
||||||
sketchMenu.add(item);
|
sketchMenu.add(item);
|
||||||
|
|
||||||
// item = newJMenuItemShift("Present", 'R');
|
// item = newJMenuItemShift("Verify / Compile (verbose)", 'R');
|
||||||
// item.addActionListener(new ActionListener() {
|
// item.addActionListener(new ActionListener() {
|
||||||
// public void actionPerformed(ActionEvent e) {
|
// public void actionPerformed(ActionEvent e) {
|
||||||
// handleRun(true);
|
// handleRun(true);
|
||||||
@ -1736,9 +1744,9 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Implements Sketch → Run.
|
* 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();
|
internalCloseRunner();
|
||||||
running = true;
|
running = true;
|
||||||
toolbar.activate(EditorToolbar.RUN);
|
toolbar.activate(EditorToolbar.RUN);
|
||||||
@ -1752,14 +1760,15 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
console.clear();
|
console.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
presenting = present;
|
//presenting = present;
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
sketch.compile(new Target(
|
sketch.compile(new Target(
|
||||||
Base.getHardwarePath() + File.separator + "cores",
|
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.");
|
statusNotice("Done compiling.");
|
||||||
} catch (RunnerException e) {
|
} catch (RunnerException e) {
|
||||||
//statusError("Error compiling...");
|
//statusError("Error compiling...");
|
||||||
@ -2155,7 +2164,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
* Made synchronized to (hopefully) avoid problems of people
|
* Made synchronized to (hopefully) avoid problems of people
|
||||||
* hitting export twice, quickly, and horking things up.
|
* hitting export twice, quickly, and horking things up.
|
||||||
*/
|
*/
|
||||||
synchronized public void handleExport() {
|
synchronized public void handleExport(final boolean verbose) {
|
||||||
//if (!handleExportCheckModified()) return;
|
//if (!handleExportCheckModified()) return;
|
||||||
toolbar.activate(EditorToolbar.EXPORT);
|
toolbar.activate(EditorToolbar.EXPORT);
|
||||||
|
|
||||||
@ -2173,7 +2182,8 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
boolean success = sketch.exportApplet(new Target(
|
boolean success = sketch.exportApplet(new Target(
|
||||||
Base.getHardwarePath() + File.separator + "cores",
|
Base.getHardwarePath() + File.separator + "cores",
|
||||||
Preferences.get("boards." + Preferences.get("board") + ".build.core")));
|
Preferences.get("boards." + Preferences.get("board") + ".build.core")),
|
||||||
|
verbose);
|
||||||
if (success) {
|
if (success) {
|
||||||
statusNotice("Done uploading.");
|
statusNotice("Done uploading.");
|
||||||
} else {
|
} else {
|
||||||
|
@ -340,7 +340,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPORT:
|
case EXPORT:
|
||||||
editor.handleExport();
|
editor.handleExport(e.isShiftDown());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SERIAL:
|
case SERIAL:
|
||||||
|
@ -1140,7 +1140,9 @@ public class Sketch {
|
|||||||
* X. afterwards, some of these steps need a cleanup function
|
* X. afterwards, some of these steps need a cleanup function
|
||||||
* </PRE>
|
* </PRE>
|
||||||
*/
|
*/
|
||||||
protected String compile(Target target) throws RunnerException {
|
protected String compile(Target target, boolean verbose)
|
||||||
|
throws RunnerException {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
|
||||||
// make sure the user didn't hide the sketch folder
|
// make sure the user didn't hide the sketch folder
|
||||||
@ -1173,7 +1175,7 @@ public class Sketch {
|
|||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
// handle preprocessing the main file's code
|
// handle preprocessing the main file's code
|
||||||
name = build(tempBuildFolder.getAbsolutePath(), target);
|
name = build(tempBuildFolder.getAbsolutePath(), target, verbose);
|
||||||
size(tempBuildFolder.getAbsolutePath(), name);
|
size(tempBuildFolder.getAbsolutePath(), name);
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
@ -1364,29 +1366,31 @@ public class Sketch {
|
|||||||
*
|
*
|
||||||
* @return null if compilation failed, main class name if not
|
* @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
|
// run the preprocessor
|
||||||
String primaryClassName = preprocess(buildPath, target);
|
String primaryClassName = preprocess(buildPath, target);
|
||||||
|
|
||||||
// compile the program. errors will happen as a RunnerException
|
// compile the program. errors will happen as a RunnerException
|
||||||
// that will bubble up to whomever called build().
|
// that will bubble up to whomever called build().
|
||||||
Compiler compiler = new Compiler();
|
Compiler compiler = new Compiler();
|
||||||
if (compiler.compile(this, buildPath, primaryClassName, target)) {
|
if (compiler.compile(this, buildPath, primaryClassName, target, verbose)) {
|
||||||
return primaryClassName;
|
return primaryClassName;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected boolean exportApplet(Target target) throws Exception {
|
protected boolean exportApplet(Target target, boolean verbose) throws Exception {
|
||||||
return exportApplet(new File(folder, "applet").getAbsolutePath(), target);
|
return exportApplet(new File(folder, "applet").getAbsolutePath(), target, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle export to applet.
|
* Handle export to applet.
|
||||||
*/
|
*/
|
||||||
public boolean exportApplet(String appletPath, Target target)
|
public boolean exportApplet(String appletPath, Target target, boolean verbose)
|
||||||
throws RunnerException, IOException {
|
throws RunnerException, IOException {
|
||||||
|
|
||||||
// Make sure the user didn't hide the sketch folder
|
// Make sure the user didn't hide the sketch folder
|
||||||
@ -1410,7 +1414,7 @@ public class Sketch {
|
|||||||
appletFolder.mkdirs();
|
appletFolder.mkdirs();
|
||||||
|
|
||||||
// build the sketch
|
// build the sketch
|
||||||
String foundName = build(appletFolder.getPath(), target);
|
String foundName = build(appletFolder.getPath(), target, false);
|
||||||
// (already reported) error during export, exit this function
|
// (already reported) error during export, exit this function
|
||||||
if (foundName == null) return false;
|
if (foundName == null) return false;
|
||||||
|
|
||||||
@ -1424,7 +1428,7 @@ public class Sketch {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
size(appletFolder.getPath(), foundName);
|
size(appletFolder.getPath(), foundName);
|
||||||
upload(appletFolder.getPath(), foundName);
|
upload(appletFolder.getPath(), foundName, verbose);
|
||||||
|
|
||||||
return true;
|
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 {
|
throws RunnerException {
|
||||||
|
|
||||||
Uploader uploader;
|
Uploader uploader;
|
||||||
@ -1458,7 +1462,8 @@ public class Sketch {
|
|||||||
//
|
//
|
||||||
uploader = new AvrdudeUploader();
|
uploader = new AvrdudeUploader();
|
||||||
boolean success = uploader.uploadUsingPreferences(buildPath,
|
boolean success = uploader.uploadUsingPreferences(buildPath,
|
||||||
suggestedClassName);
|
suggestedClassName,
|
||||||
|
verbose);
|
||||||
|
|
||||||
return success ? suggestedClassName : null;
|
return success ? suggestedClassName : null;
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,9 @@ public class AvrdudeUploader extends Uploader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX: add support for uploading sketches using a programmer
|
// 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 {
|
throws RunnerException {
|
||||||
|
this.verbose = verbose;
|
||||||
String uploadUsing = Preferences.get("boards." + Preferences.get("board") + ".upload.using");
|
String uploadUsing = Preferences.get("boards." + Preferences.get("board") + ".upload.using");
|
||||||
if (uploadUsing == null) {
|
if (uploadUsing == null) {
|
||||||
// fall back on global preference
|
// fall back on global preference
|
||||||
@ -153,7 +154,7 @@ public class AvrdudeUploader extends Uploader {
|
|||||||
commandDownloader.add("-C" + Base.getHardwarePath() + "/tools/avr/etc/avrdude.conf");
|
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");
|
commandDownloader.add("-v");
|
||||||
commandDownloader.add("-v");
|
commandDownloader.add("-v");
|
||||||
|
@ -43,6 +43,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
Sketch sketch;
|
Sketch sketch;
|
||||||
String buildPath;
|
String buildPath;
|
||||||
String primaryClassName;
|
String primaryClassName;
|
||||||
|
boolean verbose;
|
||||||
|
|
||||||
RunnerException exception;
|
RunnerException exception;
|
||||||
|
|
||||||
@ -61,10 +62,12 @@ public class Compiler implements MessageConsumer {
|
|||||||
public boolean compile(Sketch sketch,
|
public boolean compile(Sketch sketch,
|
||||||
String buildPath,
|
String buildPath,
|
||||||
String primaryClassName,
|
String primaryClassName,
|
||||||
Target target) throws RunnerException {
|
Target target,
|
||||||
|
boolean verbose) throws RunnerException {
|
||||||
this.sketch = sketch;
|
this.sketch = sketch;
|
||||||
this.buildPath = buildPath;
|
this.buildPath = buildPath;
|
||||||
this.primaryClassName = primaryClassName;
|
this.primaryClassName = primaryClassName;
|
||||||
|
this.verbose = verbose;
|
||||||
|
|
||||||
// the pms object isn't used for anything but storage
|
// the pms object isn't used for anything but storage
|
||||||
MessageStream pms = new MessageStream(this);
|
MessageStream pms = new MessageStream(this);
|
||||||
@ -223,7 +226,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
commandList.toArray(command);
|
commandList.toArray(command);
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
if (Preferences.getBoolean("build.verbose")) {
|
if (verbose || Preferences.getBoolean("build.verbose")) {
|
||||||
for(int j = 0; j < command.length; j++) {
|
for(int j = 0; j < command.length; j++) {
|
||||||
System.out.print(command[j] + " ");
|
System.out.print(command[j] + " ");
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,12 @@ public abstract class Uploader implements MessageConsumer {
|
|||||||
static OutputStream serialOutput;
|
static OutputStream serialOutput;
|
||||||
//int serial; // last byte of data received
|
//int serial; // last byte of data received
|
||||||
|
|
||||||
|
boolean verbose;
|
||||||
|
|
||||||
public Uploader() {
|
public Uploader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean uploadUsingPreferences(String buildPath, String className)
|
public abstract boolean uploadUsingPreferences(String buildPath, String className, boolean verbose)
|
||||||
throws RunnerException;
|
throws RunnerException;
|
||||||
|
|
||||||
public abstract boolean burnBootloader(String programmer) 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];
|
commandArray[0] = avrBasePath + commandArray[0];
|
||||||
|
|
||||||
if (Preferences.getBoolean("upload.verbose")) {
|
if (verbose || Preferences.getBoolean("upload.verbose")) {
|
||||||
for(int i = 0; i < commandArray.length; i++) {
|
for(int i = 0; i < commandArray.length; i++) {
|
||||||
System.out.print(commandArray[i] + " ");
|
System.out.print(commandArray[i] + " ");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user