mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03: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:
@ -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
|
||||
|
Reference in New Issue
Block a user