From 87e2e68b85c1ca3337a9c572ba01308ef9a0c446 Mon Sep 17 00:00:00 2001 From: Federico Fissore Date: Thu, 9 Apr 2015 13:03:41 +0200 Subject: [PATCH] CLI: Board and Lib Manager, syntax change: --install-boards (plural) and arduino:avr:1.6.2 (with the arch, not the name of the selected platform) --- .../packages/ContributedPackage.java | 22 ------------------- .../packages/ContributionsIndex.java | 14 ++++++------ .../app/helpers/CommandlineParser.java | 4 ++-- build/shared/manpage.adoc | 12 ++++++---- 4 files changed, 17 insertions(+), 35 deletions(-) diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributedPackage.java b/arduino-core/src/cc/arduino/contributions/packages/ContributedPackage.java index d23ee16f9..18e8d58a5 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributedPackage.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributedPackage.java @@ -59,28 +59,6 @@ public abstract class ContributedPackage { return null; } - /** - * Return the latest version available of a platform - * - * @param platform - * @return - */ - public ContributedPlatform findPlatform(String platform) { - VersionComparator version = new VersionComparator(); - ContributedPlatform found = null; - for (ContributedPlatform p : getPlatforms()) { - if (!p.getName().equals(platform)) - continue; - if (found == null) { - found = p; - continue; - } - if (version.compare(p.getParsedVersion(), found.getParsedVersion()) > 0) - found = p; - } - return found; - } - public ContributedTool findTool(String name, String version) { for (ContributedTool tool : getTools()) { if (tool.getName().equals(name) && tool.getVersion().equals(version)) diff --git a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java index d7c19227c..6cb4391f6 100644 --- a/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java +++ b/arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java @@ -50,8 +50,8 @@ public abstract class ContributionsIndex { return null; } - public List findPlatforms(String packageName, final String platformName) { - if (packageName == null || platformName == null) { + public List findPlatforms(String packageName, final String platformArch) { + if (packageName == null || platformArch == null) { return null; } @@ -62,19 +62,19 @@ public abstract class ContributionsIndex { Collection platforms = Collections2.filter(aPackage.getPlatforms(), new Predicate() { @Override public boolean apply(ContributedPlatform contributedPlatform) { - return platformName.equals(contributedPlatform.getName()); + return platformArch.equals(contributedPlatform.getArchitecture()); } }); return Lists.newLinkedList(platforms); } - public ContributedPlatform findPlatform(String packageName, final String platformName, final String platformVersion) { + public ContributedPlatform findPlatform(String packageName, final String platformArch, final String platformVersion) { if (platformVersion == null) { return null; } - Collection platformsByName = findPlatforms(packageName, platformName); + Collection platformsByName = findPlatforms(packageName, platformArch); if (platformsByName == null) { return null; } @@ -92,8 +92,8 @@ public abstract class ContributionsIndex { return platforms.iterator().next(); } - public ContributedPlatform getInstalled(String packageName, String platformName) { - List installedPlatforms = new LinkedList(Collections2.filter(findPlatforms(packageName, platformName), new InstalledPredicate())); + public ContributedPlatform getInstalled(String packageName, String platformArch) { + List installedPlatforms = new LinkedList(Collections2.filter(findPlatforms(packageName, platformArch), new InstalledPredicate())); Collections.sort(installedPlatforms, new DownloadableContributionBuiltInAtTheBottomComparator()); if (installedPlatforms.isEmpty()) { diff --git a/arduino-core/src/processing/app/helpers/CommandlineParser.java b/arduino-core/src/processing/app/helpers/CommandlineParser.java index 892098555..d0e314bcd 100644 --- a/arduino-core/src/processing/app/helpers/CommandlineParser.java +++ b/arduino-core/src/processing/app/helpers/CommandlineParser.java @@ -19,7 +19,7 @@ import static processing.app.I18n._; public class CommandlineParser { private enum ACTION { - GUI, NOOP, VERIFY("--verify"), UPLOAD("--upload"), GET_PREF("--get-pref"), INSTALL_BOARD("--install-board"), INSTALL_LIBRARY("--install-library"); + GUI, NOOP, VERIFY("--verify"), UPLOAD("--upload"), GET_PREF("--get-pref"), INSTALL_BOARD("--install-boards"), INSTALL_LIBRARY("--install-library"); private final String value; @@ -58,7 +58,7 @@ public class CommandlineParser { actions.put("--verify", ACTION.VERIFY); actions.put("--upload", ACTION.UPLOAD); actions.put("--get-pref", ACTION.GET_PREF); - actions.put("--install-board", ACTION.INSTALL_BOARD); + actions.put("--install-boards", ACTION.INSTALL_BOARD); actions.put("--install-library", ACTION.INSTALL_LIBRARY); // Check if any files were passed in on the command line diff --git a/build/shared/manpage.adoc b/build/shared/manpage.adoc index 2f8abb52d..719e028e1 100644 --- a/build/shared/manpage.adoc +++ b/build/shared/manpage.adoc @@ -29,7 +29,7 @@ SYNOPSIS *arduino* [*--get-pref* __preference__] -*arduino* [*--install-board* __package name__:__platform name__[:__version__]] +*arduino* [*--install-boards* __package name__:__platform architecture__[:__version__]] *arduino* [*--install-library* __library name__[:__version__]] @@ -68,7 +68,7 @@ ACTIONS stream. When the value does not exist, nothing is printed and the exit status is set (see EXIT STATUS below). -*--install-board* __package name__:__platform name__[:__version__]:: +*--install-boards* __package name__:__platform architecture__[:__version__]:: Fetches available board support (platform) list and install the specified one, along with its related tools. If __version__ is omitted, the latest is installed. If a platform with the same version is already installed, nothing is installed and program exits with exit code 1. If a platform with a different version is already installed, it's replaced. *--install-library* __library name__[:__version__]:: @@ -249,7 +249,11 @@ Change the selected board and build path and do nothing else. Install latest SAM board support - arduino --install-board "arduino:Arduino SAM Boards (32-bits ARM Cortex-M3)" + arduino --install-boards "arduino:sam" + +Install AVR board support, 1.6.2 + + arduino --install-boards "arduino:avr:1.6.2" Install Bridge library version 1.0.0 @@ -285,7 +289,7 @@ HISTORY Introduced *--save-prefs*. 1.6.4:: - Introduced *--install-board* and *--install-library*. + Introduced *--install-boards* and *--install-library*. {empty}:: *--pref* options are now not saved to the preferences file, just