Skip to content

Commit 87e2e68

Browse files
author
Federico Fissore
committed
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)
1 parent 6d46bd0 commit 87e2e68

File tree

4 files changed

+17
-35
lines changed

4 files changed

+17
-35
lines changed

arduino-core/src/cc/arduino/contributions/packages/ContributedPackage.java

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,6 @@ public ContributedPlatform findPlatform(String architecture, String version) {
5959
return null;
6060
}
6161

62-
/**
63-
* Return the latest version available of a platform
64-
*
65-
* @param platform
66-
* @return
67-
*/
68-
public ContributedPlatform findPlatform(String platform) {
69-
VersionComparator version = new VersionComparator();
70-
ContributedPlatform found = null;
71-
for (ContributedPlatform p : getPlatforms()) {
72-
if (!p.getName().equals(platform))
73-
continue;
74-
if (found == null) {
75-
found = p;
76-
continue;
77-
}
78-
if (version.compare(p.getParsedVersion(), found.getParsedVersion()) > 0)
79-
found = p;
80-
}
81-
return found;
82-
}
83-
8462
public ContributedTool findTool(String name, String version) {
8563
for (ContributedTool tool : getTools()) {
8664
if (tool.getName().equals(name) && tool.getVersion().equals(version))

arduino-core/src/cc/arduino/contributions/packages/ContributionsIndex.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ public ContributedPackage findPackage(String packageName) {
5050
return null;
5151
}
5252

53-
public List<ContributedPlatform> findPlatforms(String packageName, final String platformName) {
54-
if (packageName == null || platformName == null) {
53+
public List<ContributedPlatform> findPlatforms(String packageName, final String platformArch) {
54+
if (packageName == null || platformArch == null) {
5555
return null;
5656

5757
}
@@ -62,19 +62,19 @@ public List<ContributedPlatform> findPlatforms(String packageName, final String
6262
Collection<ContributedPlatform> platforms = Collections2.filter(aPackage.getPlatforms(), new Predicate<ContributedPlatform>() {
6363
@Override
6464
public boolean apply(ContributedPlatform contributedPlatform) {
65-
return platformName.equals(contributedPlatform.getName());
65+
return platformArch.equals(contributedPlatform.getArchitecture());
6666
}
6767
});
6868
return Lists.newLinkedList(platforms);
6969
}
7070

71-
public ContributedPlatform findPlatform(String packageName, final String platformName, final String platformVersion) {
71+
public ContributedPlatform findPlatform(String packageName, final String platformArch, final String platformVersion) {
7272
if (platformVersion == null) {
7373
return null;
7474

7575
}
7676

77-
Collection<ContributedPlatform> platformsByName = findPlatforms(packageName, platformName);
77+
Collection<ContributedPlatform> platformsByName = findPlatforms(packageName, platformArch);
7878
if (platformsByName == null) {
7979
return null;
8080
}
@@ -92,8 +92,8 @@ public boolean apply(ContributedPlatform contributedPlatform) {
9292
return platforms.iterator().next();
9393
}
9494

95-
public ContributedPlatform getInstalled(String packageName, String platformName) {
96-
List<ContributedPlatform> installedPlatforms = new LinkedList<ContributedPlatform>(Collections2.filter(findPlatforms(packageName, platformName), new InstalledPredicate()));
95+
public ContributedPlatform getInstalled(String packageName, String platformArch) {
96+
List<ContributedPlatform> installedPlatforms = new LinkedList<ContributedPlatform>(Collections2.filter(findPlatforms(packageName, platformArch), new InstalledPredicate()));
9797
Collections.sort(installedPlatforms, new DownloadableContributionBuiltInAtTheBottomComparator());
9898

9999
if (installedPlatforms.isEmpty()) {

arduino-core/src/processing/app/helpers/CommandlineParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
public class CommandlineParser {
2020

2121
private enum ACTION {
22-
GUI, NOOP, VERIFY("--verify"), UPLOAD("--upload"), GET_PREF("--get-pref"), INSTALL_BOARD("--install-board"), INSTALL_LIBRARY("--install-library");
22+
GUI, NOOP, VERIFY("--verify"), UPLOAD("--upload"), GET_PREF("--get-pref"), INSTALL_BOARD("--install-boards"), INSTALL_LIBRARY("--install-library");
2323

2424
private final String value;
2525

@@ -58,7 +58,7 @@ private void parseArguments(String[] args) {
5858
actions.put("--verify", ACTION.VERIFY);
5959
actions.put("--upload", ACTION.UPLOAD);
6060
actions.put("--get-pref", ACTION.GET_PREF);
61-
actions.put("--install-board", ACTION.INSTALL_BOARD);
61+
actions.put("--install-boards", ACTION.INSTALL_BOARD);
6262
actions.put("--install-library", ACTION.INSTALL_LIBRARY);
6363

6464
// Check if any files were passed in on the command line

build/shared/manpage.adoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ SYNOPSIS
2929

3030
*arduino* [*--get-pref* __preference__]
3131

32-
*arduino* [*--install-board* __package name__:__platform name__[:__version__]]
32+
*arduino* [*--install-boards* __package name__:__platform architecture__[:__version__]]
3333

3434
*arduino* [*--install-library* __library name__[:__version__]]
3535

@@ -68,7 +68,7 @@ ACTIONS
6868
stream. When the value does not exist, nothing is printed and
6969
the exit status is set (see EXIT STATUS below).
7070

71-
*--install-board* __package name__:__platform name__[:__version__]::
71+
*--install-boards* __package name__:__platform architecture__[:__version__]::
7272
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.
7373

7474
*--install-library* __library name__[:__version__]::
@@ -249,7 +249,11 @@ Change the selected board and build path and do nothing else.
249249

250250
Install latest SAM board support
251251

252-
arduino --install-board "arduino:Arduino SAM Boards (32-bits ARM Cortex-M3)"
252+
arduino --install-boards "arduino:sam"
253+
254+
Install AVR board support, 1.6.2
255+
256+
arduino --install-boards "arduino:avr:1.6.2"
253257

254258
Install Bridge library version 1.0.0
255259

@@ -285,7 +289,7 @@ HISTORY
285289
Introduced *--save-prefs*.
286290
287291
1.6.4::
288-
Introduced *--install-board* and *--install-library*.
292+
Introduced *--install-boards* and *--install-library*.
289293
290294
{empty}::
291295
*--pref* options are now not saved to the preferences file, just

0 commit comments

Comments
 (0)