mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
More cleanup:
- fixing import library - changing compilation to only look for source files in the root and utility/ folders of a library; also adding utility/ sub-folder to the include path - removing export to application - renaming run to verify / compile and export to upload
This commit is contained in:
@ -984,7 +984,11 @@ public class Base {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
menu.removeAll();
|
menu.removeAll();
|
||||||
addSketches(menu, examplesFolder, false);
|
boolean found = addSketches(menu, examplesFolder, false);
|
||||||
|
if (found) menu.addSeparator();
|
||||||
|
found = addSketches(menu, getSketchbookLibrariesFolder(), false);
|
||||||
|
if (found) menu.addSeparator();
|
||||||
|
addSketches(menu, librariesFolder, false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -1141,7 +1145,7 @@ public class Base {
|
|||||||
|
|
||||||
JMenuItem item = new JMenuItem(libraryName);
|
JMenuItem item = new JMenuItem(libraryName);
|
||||||
item.addActionListener(listener);
|
item.addActionListener(listener);
|
||||||
// item.setActionCommand(libraryJar.getAbsolutePath());
|
item.setActionCommand(subfolder.getAbsolutePath());
|
||||||
menu.add(item);
|
menu.add(item);
|
||||||
ifound = true;
|
ifound = true;
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
});
|
});
|
||||||
fileMenu.add(saveAsMenuItem);
|
fileMenu.add(saveAsMenuItem);
|
||||||
|
|
||||||
item = newJMenuItem("Export", 'E');
|
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();
|
||||||
@ -496,18 +496,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
});
|
});
|
||||||
fileMenu.add(item);
|
fileMenu.add(item);
|
||||||
|
|
||||||
exportAppItem = newJMenuItemShift("Export Application", 'E');
|
|
||||||
exportAppItem.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
//buttons.activate(EditorButtons.EXPORT);
|
|
||||||
//SwingUtilities.invokeLater(new Runnable() {
|
|
||||||
//public void run() {
|
|
||||||
handleExportApplication();
|
|
||||||
//}});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fileMenu.add(exportAppItem);
|
|
||||||
|
|
||||||
fileMenu.addSeparator();
|
fileMenu.addSeparator();
|
||||||
|
|
||||||
item = newJMenuItemShift("Page Setup", 'P');
|
item = newJMenuItemShift("Page Setup", 'P');
|
||||||
@ -556,7 +544,7 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
JMenuItem item;
|
JMenuItem item;
|
||||||
sketchMenu = new JMenu("Sketch");
|
sketchMenu = new JMenu("Sketch");
|
||||||
|
|
||||||
item = newJMenuItem("Run", 'R');
|
item = newJMenuItem("Verify / Compile", 'R');
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
handleRun(false);
|
handleRun(false);
|
||||||
@ -564,13 +552,13 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
});
|
});
|
||||||
sketchMenu.add(item);
|
sketchMenu.add(item);
|
||||||
|
|
||||||
item = newJMenuItemShift("Present", 'R');
|
// item = newJMenuItemShift("Present", 'R');
|
||||||
item.addActionListener(new ActionListener() {
|
// item.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
// public void actionPerformed(ActionEvent e) {
|
||||||
handleRun(true);
|
// handleRun(true);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
sketchMenu.add(item);
|
// sketchMenu.add(item);
|
||||||
|
|
||||||
item = new JMenuItem("Stop");
|
item = new JMenuItem("Stop");
|
||||||
item.addActionListener(new ActionListener() {
|
item.addActionListener(new ActionListener() {
|
||||||
@ -2167,35 +2155,6 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler for Sketch → Export Application
|
|
||||||
*/
|
|
||||||
synchronized public void handleExportApplication() {
|
|
||||||
if (!handleExportCheckModified()) return;
|
|
||||||
toolbar.activate(EditorToolbar.EXPORT);
|
|
||||||
|
|
||||||
//SwingUtilities.invokeLater(new Runnable() {
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
statusNotice("Exporting application...");
|
|
||||||
try {
|
|
||||||
if (sketch.exportApplicationPrompt()) {
|
|
||||||
Base.openFolder(sketch.getFolder());
|
|
||||||
statusNotice("Done exporting.");
|
|
||||||
} else {
|
|
||||||
// error message will already be visible
|
|
||||||
// or there was no error, in which case it was canceled.
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
statusNotice("Error during export.");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//toolbar.clear();
|
|
||||||
toolbar.deactivate(EditorToolbar.EXPORT);
|
|
||||||
}});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if the sketch has been modified, and if so,
|
* Checks to see if the sketch has been modified, and if so,
|
||||||
* asks the user to save the sketch or cancel the export.
|
* asks the user to save the sketch or cancel the export.
|
||||||
|
@ -337,11 +337,7 @@ public class EditorToolbar extends JComponent implements MouseInputListener {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EXPORT:
|
case EXPORT:
|
||||||
if (e.isShiftDown()) {
|
|
||||||
editor.handleExportApplication();
|
|
||||||
} else {
|
|
||||||
editor.handleExport();
|
editor.handleExport();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1315,7 +1315,7 @@ public class Sketch {
|
|||||||
for (String item : preprocessor.getExtraImports()) {
|
for (String item : preprocessor.getExtraImports()) {
|
||||||
File libFolder = (File) Base.importToLibraryTable.get(item);
|
File libFolder = (File) Base.importToLibraryTable.get(item);
|
||||||
|
|
||||||
if (libFolder != null) {
|
if (libFolder != null && !importedLibraries.contains(libFolder)) {
|
||||||
importedLibraries.add(libFolder);
|
importedLibraries.add(libFolder);
|
||||||
classPath += Compiler.contentsToClassPath(libFolder);
|
classPath += Compiler.contentsToClassPath(libFolder);
|
||||||
libraryPath += File.pathSeparator + libFolder.getAbsolutePath();
|
libraryPath += File.pathSeparator + libFolder.getAbsolutePath();
|
||||||
|
@ -76,6 +76,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
// use lib directories as include paths
|
// use lib directories as include paths
|
||||||
for (File file : sketch.getImportedLibraries()) {
|
for (File file : sketch.getImportedLibraries()) {
|
||||||
includePaths.add(file.getPath());
|
includePaths.add(file.getPath());
|
||||||
|
includePaths.add(file.getPath() + File.separator + "utility");
|
||||||
}
|
}
|
||||||
|
|
||||||
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
|
List baseCommandLinker = new ArrayList(Arrays.asList(new String[] {
|
||||||
@ -111,8 +112,10 @@ public class Compiler implements MessageConsumer {
|
|||||||
sourceFilesCPP.addAll(findFilesInPath(target.getPath(), "cpp", true));
|
sourceFilesCPP.addAll(findFilesInPath(target.getPath(), "cpp", true));
|
||||||
|
|
||||||
for (File file : sketch.getImportedLibraries()) {
|
for (File file : sketch.getImportedLibraries()) {
|
||||||
sourceFiles.addAll(findFilesInFolder(file, "c", true));
|
sourceFiles.addAll(findFilesInFolder(file, "c", false));
|
||||||
sourceFilesCPP.addAll(findFilesInFolder(file, "cpp", true));
|
sourceFiles.addAll(findFilesInFolder(new File(file, "utility"), "c", false));
|
||||||
|
sourceFilesCPP.addAll(findFilesInFolder(file, "cpp", false));
|
||||||
|
sourceFilesCPP.addAll(findFilesInFolder(new File(file, "utility"), "cpp", false));
|
||||||
}
|
}
|
||||||
|
|
||||||
firstErrorFound = false; // haven't found any errors yet
|
firstErrorFound = false; // haven't found any errors yet
|
||||||
@ -485,6 +488,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
boolean recurse) {
|
boolean recurse) {
|
||||||
ArrayList<File> files = new ArrayList<File>();
|
ArrayList<File> files = new ArrayList<File>();
|
||||||
|
|
||||||
|
if (folder.listFiles() == null) return files;
|
||||||
|
|
||||||
for (File file : folder.listFiles()) {
|
for (File file : folder.listFiles()) {
|
||||||
if (file.getName().equals(".") || file.getName().equals("..")) continue;
|
if (file.getName().equals(".") || file.getName().equals("..")) continue;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user