mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-19 09:42:11 +03:00
Command line build. Still requires a display to show GUI.
This commit is contained in:
@ -109,7 +109,7 @@ public class Base {
|
|||||||
Editor activeEditor;
|
Editor activeEditor;
|
||||||
|
|
||||||
|
|
||||||
static public void main(String args[]) {
|
static public void main(String args[]) throws Exception {
|
||||||
try {
|
try {
|
||||||
File versionFile = getContentFile("lib/version.txt");
|
File versionFile = getContentFile("lib/version.txt");
|
||||||
if (versionFile.exists()) {
|
if (versionFile.exists()) {
|
||||||
@ -240,7 +240,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Base(String[] args) {
|
public Base(String[] args) throws Exception {
|
||||||
platform.init(this);
|
platform.init(this);
|
||||||
|
|
||||||
// Get the sketchbook path, and make sure it's set properly
|
// Get the sketchbook path, and make sure it's set properly
|
||||||
@ -276,11 +276,28 @@ public class Base {
|
|||||||
// Setup board-dependent variables.
|
// Setup board-dependent variables.
|
||||||
onBoardOrPortChange();
|
onBoardOrPortChange();
|
||||||
|
|
||||||
// Check if there were previously opened sketches to be restored
|
boolean opened = false;
|
||||||
boolean opened = restoreSketches();
|
boolean doUpload = false;
|
||||||
|
String selectBoard = null;
|
||||||
|
String selectPort = null;
|
||||||
// Check if any files were passed in on the command line
|
// Check if any files were passed in on the command line
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
|
if (args[i].equals("--upload")) {
|
||||||
|
doUpload = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (args[i].equals("--board")) {
|
||||||
|
i++;
|
||||||
|
if (i < args.length)
|
||||||
|
selectBoard = args[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (args[i].equals("--port")) {
|
||||||
|
i++;
|
||||||
|
if (i < args.length)
|
||||||
|
selectPort = args[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
String path = args[i];
|
String path = args[i];
|
||||||
// Fix a problem with systems that use a non-ASCII languages. Paths are
|
// Fix a problem with systems that use a non-ASCII languages. Paths are
|
||||||
// being passed in with 8.3 syntax, which makes the sketch loader code
|
// being passed in with 8.3 syntax, which makes the sketch loader code
|
||||||
@ -299,6 +316,23 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (doUpload) {
|
||||||
|
if (!opened)
|
||||||
|
throw new Exception(_("Can't open source sketch!"));
|
||||||
|
Thread.sleep(2000);
|
||||||
|
Editor editor = editors.get(0);
|
||||||
|
if (selectPort != null)
|
||||||
|
editor.selectSerialPort(selectPort);
|
||||||
|
if (selectBoard != null)
|
||||||
|
selectBoard(selectBoard);
|
||||||
|
editor.exportHandler.run();
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there were previously opened sketches to be restored
|
||||||
|
if (restoreSketches())
|
||||||
|
opened = true;
|
||||||
|
|
||||||
// Create a new empty window (will be replaced with any files to be opened)
|
// Create a new empty window (will be replaced with any files to be opened)
|
||||||
if (!opened) {
|
if (!opened) {
|
||||||
handleNew();
|
handleNew();
|
||||||
@ -1131,19 +1165,10 @@ public class Base {
|
|||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
AbstractAction action = new AbstractAction(boardName) {
|
AbstractAction action = new AbstractAction(boardName) {
|
||||||
public void actionPerformed(ActionEvent actionevent) {
|
public void actionPerformed(ActionEvent actionevent) {
|
||||||
Preferences.set("target_package", (String) getValue("package"));
|
selectBoard((String) getValue("b"));
|
||||||
Preferences.set("target_platform", (String) getValue("platform"));
|
|
||||||
Preferences.set("board", (String) getValue("board"));
|
|
||||||
|
|
||||||
onBoardOrPortChange();
|
|
||||||
Sketch.buildSettingChanged();
|
|
||||||
rebuildImportMenu(Editor.importMenu);
|
|
||||||
rebuildExamplesMenu(Editor.examplesMenu);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
action.putValue("package", packageName);
|
action.putValue("b", packageName + ":" + platformName + ":" + board);
|
||||||
action.putValue("platform", platformName);
|
|
||||||
action.putValue("board", board);
|
|
||||||
JMenuItem item = new JRadioButtonMenuItem(action);
|
JMenuItem item = new JRadioButtonMenuItem(action);
|
||||||
if (packageName.equals(selPackage) &&
|
if (packageName.equals(selPackage) &&
|
||||||
platformName.equals(selPlatform) && board.equals(selBoard)) {
|
platformName.equals(selPlatform) && board.equals(selBoard)) {
|
||||||
@ -1155,7 +1180,20 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void selectBoard(String selectBoard) {
|
||||||
|
String[] split = selectBoard.split(":");
|
||||||
|
Preferences.set("target_package", split[0]);
|
||||||
|
Preferences.set("target_platform", split[1]);
|
||||||
|
Preferences.set("board", split[2]);
|
||||||
|
onBoardOrPortChange();
|
||||||
|
Sketch.buildSettingChanged();
|
||||||
|
rebuildImportMenu(Editor.importMenu);
|
||||||
|
rebuildExamplesMenu(Editor.examplesMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void rebuildProgrammerMenu(JMenu menu) {
|
public void rebuildProgrammerMenu(JMenu menu) {
|
||||||
menu.removeAll();
|
menu.removeAll();
|
||||||
ButtonGroup group = new ButtonGroup();
|
ButtonGroup group = new ButtonGroup();
|
||||||
|
Reference in New Issue
Block a user