mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-19 13:54:23 +01:00
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)
This commit is contained in:
parent
6d46bd0bde
commit
87e2e68b85
@ -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))
|
||||
|
@ -50,8 +50,8 @@ public abstract class ContributionsIndex {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<ContributedPlatform> findPlatforms(String packageName, final String platformName) {
|
||||
if (packageName == null || platformName == null) {
|
||||
public List<ContributedPlatform> findPlatforms(String packageName, final String platformArch) {
|
||||
if (packageName == null || platformArch == null) {
|
||||
return null;
|
||||
|
||||
}
|
||||
@ -62,19 +62,19 @@ public abstract class ContributionsIndex {
|
||||
Collection<ContributedPlatform> platforms = Collections2.filter(aPackage.getPlatforms(), new Predicate<ContributedPlatform>() {
|
||||
@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<ContributedPlatform> platformsByName = findPlatforms(packageName, platformName);
|
||||
Collection<ContributedPlatform> 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<ContributedPlatform> installedPlatforms = new LinkedList<ContributedPlatform>(Collections2.filter(findPlatforms(packageName, platformName), new InstalledPredicate()));
|
||||
public ContributedPlatform getInstalled(String packageName, String platformArch) {
|
||||
List<ContributedPlatform> installedPlatforms = new LinkedList<ContributedPlatform>(Collections2.filter(findPlatforms(packageName, platformArch), new InstalledPredicate()));
|
||||
Collections.sort(installedPlatforms, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||
|
||||
if (installedPlatforms.isEmpty()) {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user