From aa654ba24203c6252ff9516ef1ddf78549a1406b Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Tue, 6 Oct 2015 10:16:41 +0200 Subject: [PATCH] Updating arduino-builder to 1.0.0-beta24 --- arduino-core/src/cc/arduino/Compiler.java | 32 ++++++++++++++++--- ...o-builder-linux32-1.0.0-beta23.tar.bz2.sha | 1 - ...o-builder-linux32-1.0.0-beta24.tar.bz2.sha | 1 + ...o-builder-linux64-1.0.0-beta23.tar.bz2.sha | 1 - ...o-builder-linux64-1.0.0-beta24.tar.bz2.sha | 1 + ...no-builder-macosx-1.0.0-beta23.tar.bz2.sha | 1 - ...no-builder-macosx-1.0.0-beta24.tar.bz2.sha | 1 + ...duino-builder-windows-1.0.0-beta23.zip.sha | 1 - ...duino-builder-windows-1.0.0-beta24.zip.sha | 1 + build/build.xml | 2 +- 10 files changed, 32 insertions(+), 10 deletions(-) delete mode 100644 build/arduino-builder-linux32-1.0.0-beta23.tar.bz2.sha create mode 100644 build/arduino-builder-linux32-1.0.0-beta24.tar.bz2.sha delete mode 100644 build/arduino-builder-linux64-1.0.0-beta23.tar.bz2.sha create mode 100644 build/arduino-builder-linux64-1.0.0-beta24.tar.bz2.sha delete mode 100644 build/arduino-builder-macosx-1.0.0-beta23.tar.bz2.sha create mode 100644 build/arduino-builder-macosx-1.0.0-beta24.tar.bz2.sha delete mode 100644 build/arduino-builder-windows-1.0.0-beta23.zip.sha create mode 100644 build/arduino-builder-windows-1.0.0-beta24.zip.sha diff --git a/arduino-core/src/cc/arduino/Compiler.java b/arduino-core/src/cc/arduino/Compiler.java index 41dfc47dd..06c5be7d7 100644 --- a/arduino-core/src/cc/arduino/Compiler.java +++ b/arduino-core/src/cc/arduino/Compiler.java @@ -30,9 +30,11 @@ package cc.arduino; import cc.arduino.i18n.I18NAwareMessageConsumer; +import cc.arduino.packages.BoardPort; import org.apache.commons.exec.CommandLine; import org.apache.commons.exec.DefaultExecutor; import org.apache.commons.exec.PumpStreamHandler; +import org.apache.commons.lang3.StringUtils; import processing.app.*; import processing.app.debug.*; import processing.app.helpers.PreferencesMap; @@ -128,13 +130,14 @@ public class Compiler implements MessageConsumer { TargetPlatform platform = board.getContainerPlatform(); TargetPackage aPackage = platform.getContainerPackage(); + String vidpid = VIDPID(); - PreferencesMap prefs = loadPreferences(board, platform, aPackage); + PreferencesMap prefs = loadPreferences(board, platform, aPackage, vidpid); MessageConsumerOutputStream out = new MessageConsumerOutputStream(new ProgressAwareMessageConsumer(new I18NAwareMessageConsumer(System.out), progListener), "\n"); MessageConsumerOutputStream err = new MessageConsumerOutputStream(new I18NAwareMessageConsumer(System.err, Compiler.this), "\n"); - callArduinoBuilder(board, platform, aPackage, BuilderAction.COMPILE, new PumpStreamHandler(out, err)); + callArduinoBuilder(board, platform, aPackage, vidpid, BuilderAction.COMPILE, new PumpStreamHandler(out, err)); out.flush(); err.flush(); @@ -152,12 +155,27 @@ public class Compiler implements MessageConsumer { return sketch.getName() + ".ino"; } - private PreferencesMap loadPreferences(TargetBoard board, TargetPlatform platform, TargetPackage aPackage) throws RunnerException, IOException { + private String VIDPID() { + BoardPort boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port")); + if (boardPort == null) { + return ""; + } + + String vid = boardPort.getPrefs().get("vid"); + String pid = boardPort.getPrefs().get("pid"); + if (StringUtils.isEmpty(vid) || StringUtils.isEmpty(pid)) { + return ""; + } + + return vid.toUpperCase() + "_" + pid.toUpperCase(); + } + + private PreferencesMap loadPreferences(TargetBoard board, TargetPlatform platform, TargetPackage aPackage, String vidpid) throws RunnerException, IOException { ByteArrayOutputStream stdout = new ByteArrayOutputStream(); ByteArrayOutputStream stderr = new ByteArrayOutputStream(); MessageConsumerOutputStream err = new MessageConsumerOutputStream(new I18NAwareMessageConsumer(new PrintStream(stderr), Compiler.this), "\n"); try { - callArduinoBuilder(board, platform, aPackage, BuilderAction.DUMP_PREFS, new PumpStreamHandler(stdout, err)); + callArduinoBuilder(board, platform, aPackage, vidpid, BuilderAction.DUMP_PREFS, new PumpStreamHandler(stdout, err)); } catch (RunnerException e) { System.err.println(new String(stderr.toByteArray())); throw e; @@ -167,7 +185,7 @@ public class Compiler implements MessageConsumer { return prefs; } - private void callArduinoBuilder(TargetBoard board, TargetPlatform platform, TargetPackage aPackage, BuilderAction action, PumpStreamHandler streamHandler) throws RunnerException { + private void callArduinoBuilder(TargetBoard board, TargetPlatform platform, TargetPackage aPackage, String vidpid, BuilderAction action, PumpStreamHandler streamHandler) throws RunnerException { File executable = BaseNoGui.getContentFile("arduino-builder"); CommandLine commandLine = new CommandLine(executable); commandLine.addArgument(action.value, false); @@ -197,6 +215,10 @@ public class Compiler implements MessageConsumer { String fqbn = Stream.of(aPackage.getId(), platform.getId(), board.getId(), boardOptions(board)).filter(s -> !s.isEmpty()).collect(Collectors.joining(":")); commandLine.addArgument("-fqbn=" + fqbn, false); + if (!"".equals(vidpid)) { + commandLine.addArgument("-vid-pid=" + vidpid, false); + } + commandLine.addArgument("-ide-version=" + BaseNoGui.REVISION, false); commandLine.addArgument("-build-path", false); commandLine.addArgument("\"" + buildPath + "\"", false); diff --git a/build/arduino-builder-linux32-1.0.0-beta23.tar.bz2.sha b/build/arduino-builder-linux32-1.0.0-beta23.tar.bz2.sha deleted file mode 100644 index 14dc528e8..000000000 --- a/build/arduino-builder-linux32-1.0.0-beta23.tar.bz2.sha +++ /dev/null @@ -1 +0,0 @@ -23ba6fb0969cf81bafb1d3c37b9d491e332fae71 diff --git a/build/arduino-builder-linux32-1.0.0-beta24.tar.bz2.sha b/build/arduino-builder-linux32-1.0.0-beta24.tar.bz2.sha new file mode 100644 index 000000000..5c09eaad1 --- /dev/null +++ b/build/arduino-builder-linux32-1.0.0-beta24.tar.bz2.sha @@ -0,0 +1 @@ +d8c3e22428fa0953038f2ac21cd7be6d614fee30 diff --git a/build/arduino-builder-linux64-1.0.0-beta23.tar.bz2.sha b/build/arduino-builder-linux64-1.0.0-beta23.tar.bz2.sha deleted file mode 100644 index 0e99c9d89..000000000 --- a/build/arduino-builder-linux64-1.0.0-beta23.tar.bz2.sha +++ /dev/null @@ -1 +0,0 @@ -c2e8bf47d10112f1145976792032121041735414 diff --git a/build/arduino-builder-linux64-1.0.0-beta24.tar.bz2.sha b/build/arduino-builder-linux64-1.0.0-beta24.tar.bz2.sha new file mode 100644 index 000000000..317154324 --- /dev/null +++ b/build/arduino-builder-linux64-1.0.0-beta24.tar.bz2.sha @@ -0,0 +1 @@ +329b5e616165fa5cf7414a75f5e544d598dc944f diff --git a/build/arduino-builder-macosx-1.0.0-beta23.tar.bz2.sha b/build/arduino-builder-macosx-1.0.0-beta23.tar.bz2.sha deleted file mode 100644 index 1bbe20b31..000000000 --- a/build/arduino-builder-macosx-1.0.0-beta23.tar.bz2.sha +++ /dev/null @@ -1 +0,0 @@ -725c998d08c73fb292fbd558106494acf7d1f9cf diff --git a/build/arduino-builder-macosx-1.0.0-beta24.tar.bz2.sha b/build/arduino-builder-macosx-1.0.0-beta24.tar.bz2.sha new file mode 100644 index 000000000..cddfb7a92 --- /dev/null +++ b/build/arduino-builder-macosx-1.0.0-beta24.tar.bz2.sha @@ -0,0 +1 @@ +d8f371c06abce0a177101a16ed90d8e3ee989d37 diff --git a/build/arduino-builder-windows-1.0.0-beta23.zip.sha b/build/arduino-builder-windows-1.0.0-beta23.zip.sha deleted file mode 100644 index 36f4da551..000000000 --- a/build/arduino-builder-windows-1.0.0-beta23.zip.sha +++ /dev/null @@ -1 +0,0 @@ -f54e4dc2d71a2f1e0141afee7f28f9d896c11593 diff --git a/build/arduino-builder-windows-1.0.0-beta24.zip.sha b/build/arduino-builder-windows-1.0.0-beta24.zip.sha new file mode 100644 index 000000000..3e063c9c2 --- /dev/null +++ b/build/arduino-builder-windows-1.0.0-beta24.zip.sha @@ -0,0 +1 @@ +5efc19b5245b994f71ceae41f9da4c4aab67bd16 diff --git a/build/build.xml b/build/build.xml index 217f4fa6e..78ba5029c 100644 --- a/build/build.xml +++ b/build/build.xml @@ -71,7 +71,7 @@ - +