mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Preliminary command line support to boards manager and library manager
This commit is contained in:
parent
643d9515ac
commit
09255254d7
@ -28,20 +28,20 @@
|
|||||||
*/
|
*/
|
||||||
package cc.arduino.contributions.libraries.ui;
|
package cc.arduino.contributions.libraries.ui;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import processing.app.BaseNoGui;
|
|
||||||
import processing.app.helpers.FileUtils;
|
|
||||||
import cc.arduino.contributions.libraries.ContributedLibrary;
|
import cc.arduino.contributions.libraries.ContributedLibrary;
|
||||||
import cc.arduino.contributions.libraries.LibrariesIndexer;
|
import cc.arduino.contributions.libraries.LibrariesIndexer;
|
||||||
import cc.arduino.contributions.packages.DownloadableContributionsDownloader;
|
import cc.arduino.contributions.packages.DownloadableContributionsDownloader;
|
||||||
import cc.arduino.utils.ArchiveExtractor;
|
import cc.arduino.utils.ArchiveExtractor;
|
||||||
import cc.arduino.utils.MultiStepProgress;
|
import cc.arduino.utils.MultiStepProgress;
|
||||||
import cc.arduino.utils.Progress;
|
import cc.arduino.utils.Progress;
|
||||||
|
import processing.app.BaseNoGui;
|
||||||
|
import processing.app.helpers.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
public class LibraryInstaller {
|
public class LibraryInstaller {
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ public class LibraryInstaller {
|
|||||||
outputFile.delete();
|
outputFile.delete();
|
||||||
if (!tmpFile.renameTo(outputFile))
|
if (!tmpFile.renameTo(outputFile))
|
||||||
throw new Exception(
|
throw new Exception(
|
||||||
_("An error occurred while updating libraries index!"));
|
_("An error occurred while updating libraries index!"));
|
||||||
|
|
||||||
// Step 2: Rescan index
|
// Step 2: Rescan index
|
||||||
rescanLibraryIndex(progress);
|
rescanLibraryIndex(progress);
|
||||||
@ -133,20 +133,18 @@ public class LibraryInstaller {
|
|||||||
|
|
||||||
// Step 3: Remove replaced library and move installed one to the correct location
|
// Step 3: Remove replaced library and move installed one to the correct location
|
||||||
// TODO: Fix progress bar...
|
// TODO: Fix progress bar...
|
||||||
if (replacedLib != null && !replacedLib.isReadOnly()) {
|
remove(replacedLib);
|
||||||
remove(replacedLib);
|
|
||||||
}
|
|
||||||
File destFolder = new File(libsFolder, lib.getName().replaceAll(" ", "_"));
|
File destFolder = new File(libsFolder, lib.getName().replaceAll(" ", "_"));
|
||||||
tmpFolder.renameTo(destFolder);
|
tmpFolder.renameTo(destFolder);
|
||||||
progress.stepDone();
|
progress.stepDone();
|
||||||
|
|
||||||
// Step 4: Rescan index
|
// Step 4: Rescan index
|
||||||
rescanLibraryIndex(progress);
|
rescanLibraryIndex(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove(ContributedLibrary lib) throws IOException {
|
public void remove(ContributedLibrary lib) throws IOException {
|
||||||
if (lib.isReadOnly()) {
|
if (lib == null || lib.isReadOnly()) {
|
||||||
throw new IllegalArgumentException("Can't delete a built-in library");
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final MultiStepProgress progress = new MultiStepProgress(2);
|
final MultiStepProgress progress = new MultiStepProgress(2);
|
||||||
|
@ -22,9 +22,17 @@
|
|||||||
|
|
||||||
package processing.app;
|
package processing.app;
|
||||||
|
|
||||||
|
import cc.arduino.contributions.VersionHelper;
|
||||||
|
import cc.arduino.contributions.libraries.ContributedLibrary;
|
||||||
|
import cc.arduino.contributions.libraries.LibrariesIndexer;
|
||||||
|
import cc.arduino.contributions.libraries.ui.LibraryInstaller;
|
||||||
import cc.arduino.contributions.libraries.ui.LibraryManagerUI;
|
import cc.arduino.contributions.libraries.ui.LibraryManagerUI;
|
||||||
import cc.arduino.packages.DiscoveryManager;
|
import cc.arduino.contributions.packages.ContributedPlatform;
|
||||||
|
import cc.arduino.contributions.packages.ContributionInstaller;
|
||||||
|
import cc.arduino.contributions.packages.ContributionsIndexer;
|
||||||
import cc.arduino.contributions.packages.ui.ContributionManagerUI;
|
import cc.arduino.contributions.packages.ui.ContributionManagerUI;
|
||||||
|
import cc.arduino.packages.DiscoveryManager;
|
||||||
|
import cc.arduino.utils.Progress;
|
||||||
import cc.arduino.view.SplashScreenHelper;
|
import cc.arduino.view.SplashScreenHelper;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.base.Predicates;
|
import com.google.common.base.Predicates;
|
||||||
@ -296,7 +304,78 @@ public class Base {
|
|||||||
// them.
|
// them.
|
||||||
Preferences.save();
|
Preferences.save();
|
||||||
|
|
||||||
if (parser.isVerifyOrUploadMode()) {
|
if (parser.isInstallBoard()) {
|
||||||
|
ContributionsIndexer indexer = new ContributionsIndexer(BaseNoGui.getSettingsFolder());
|
||||||
|
ContributionInstaller installer = new ContributionInstaller(indexer) {
|
||||||
|
private String lastStatus = "";
|
||||||
|
@Override
|
||||||
|
protected void onProgress(Progress progress) {
|
||||||
|
if (!lastStatus.equals(progress.getStatus())) {
|
||||||
|
System.out.println(progress.getStatus());
|
||||||
|
}
|
||||||
|
lastStatus = progress.getStatus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
installer.updateIndex();
|
||||||
|
indexer.parseIndex();
|
||||||
|
indexer.syncWithFilesystem(getHardwareFolder());
|
||||||
|
|
||||||
|
String[] boardToInstallParts = parser.getBoardToInstall().split(":");
|
||||||
|
|
||||||
|
ContributedPlatform selected = indexer.getIndex().findPlatform(boardToInstallParts[0], boardToInstallParts[1], VersionHelper.valueOf(boardToInstallParts[2]).toString());
|
||||||
|
if (selected == null) {
|
||||||
|
System.out.println(_("Selected board is not available"));
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ContributedPlatform installed = indexer.getIndex().getInstalled(boardToInstallParts[0], boardToInstallParts[1]);
|
||||||
|
|
||||||
|
if (!selected.isReadOnly()) {
|
||||||
|
installer.install(selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (installed != null && !installed.isReadOnly()) {
|
||||||
|
installer.remove(installed);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
|
|
||||||
|
} else if (parser.isInstallLibrary()) {
|
||||||
|
LibrariesIndexer indexer = new LibrariesIndexer(BaseNoGui.getSettingsFolder());
|
||||||
|
LibraryInstaller installer = new LibraryInstaller(indexer) {
|
||||||
|
private String lastStatus = "";
|
||||||
|
@Override
|
||||||
|
protected void onProgress(Progress progress) {
|
||||||
|
if (!lastStatus.equals(progress.getStatus())) {
|
||||||
|
System.out.println(progress.getStatus());
|
||||||
|
}
|
||||||
|
lastStatus = progress.getStatus();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
indexer.parseIndex();
|
||||||
|
BaseNoGui.onBoardOrPortChange();
|
||||||
|
indexer.setSketchbookLibrariesFolder(BaseNoGui.getSketchbookLibrariesFolder());
|
||||||
|
indexer.setLibrariesFolders(BaseNoGui.getLibrariesPath());
|
||||||
|
installer.updateIndex();
|
||||||
|
|
||||||
|
String[] libraryToInstallParts = parser.getLibraryToInstall().split(":");
|
||||||
|
|
||||||
|
ContributedLibrary selected = indexer.getIndex().find(libraryToInstallParts[0], VersionHelper.valueOf(libraryToInstallParts[1]).toString());
|
||||||
|
if (selected == null) {
|
||||||
|
System.out.println(_("Selected library is not available"));
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ContributedLibrary installed = indexer.getIndex().getInstalled(libraryToInstallParts[0]);
|
||||||
|
if (selected.isReadOnly()) {
|
||||||
|
installer.remove(installed);
|
||||||
|
} else {
|
||||||
|
installer.install(selected, installed);
|
||||||
|
}
|
||||||
|
|
||||||
|
System.exit(0);
|
||||||
|
|
||||||
|
} else if (parser.isVerifyOrUploadMode()) {
|
||||||
splashScreenHelper.close();
|
splashScreenHelper.close();
|
||||||
// Set verbosity for command line build
|
// Set verbosity for command line build
|
||||||
Preferences.set("build.verbose", "" + parser.isDoVerboseBuild());
|
Preferences.set("build.verbose", "" + parser.isDoVerboseBuild());
|
||||||
@ -1525,11 +1604,11 @@ public class Base {
|
|||||||
String complaining = I18n
|
String complaining = I18n
|
||||||
.format(
|
.format(
|
||||||
_("The sketch \"{0}\" cannot be used.\n"
|
_("The sketch \"{0}\" cannot be used.\n"
|
||||||
+ "Sketch names must contain only basic letters and numbers\n"
|
+ "Sketch names must contain only basic letters and numbers\n"
|
||||||
+ "(ASCII-only with no spaces, "
|
+ "(ASCII-only with no spaces, "
|
||||||
+ "and it cannot start with a number).\n"
|
+ "and it cannot start with a number).\n"
|
||||||
+ "To get rid of this message, remove the sketch from\n"
|
+ "To get rid of this message, remove the sketch from\n"
|
||||||
+ "{1}"), name, entry.getAbsolutePath());
|
+ "{1}"), name, entry.getAbsolutePath());
|
||||||
showMessage(_("Ignoring sketch with bad name"), complaining);
|
showMessage(_("Ignoring sketch with bad name"), complaining);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
|
|
||||||
package cc.arduino.contributions.libraries;
|
package cc.arduino.contributions.libraries;
|
||||||
|
|
||||||
|
import cc.arduino.contributions.DownloadableContributionBuiltInAtTheBottomComparator;
|
||||||
|
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.collect.Collections2;
|
import com.google.common.collect.Collections2;
|
||||||
|
|
||||||
@ -93,4 +95,15 @@ public abstract class LibrariesIndex {
|
|||||||
|
|
||||||
return types;
|
return types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ContributedLibrary getInstalled(String name) {
|
||||||
|
List<ContributedLibrary> installedReleases = new LinkedList<ContributedLibrary>(Collections2.filter(find(name), new InstalledPredicate()));
|
||||||
|
Collections.sort(installedReleases, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||||
|
|
||||||
|
if (installedReleases.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return installedReleases.get(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,9 @@ public class ContributionInstaller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> remove(ContributedPlatform platform) {
|
public List<String> remove(ContributedPlatform platform) {
|
||||||
|
if (platform == null || platform.isReadOnly()) {
|
||||||
|
return new LinkedList<String>();
|
||||||
|
}
|
||||||
List<String> errors = new LinkedList<String>();
|
List<String> errors = new LinkedList<String>();
|
||||||
FileUtils.recursiveDelete(platform.getInstalledFolder());
|
FileUtils.recursiveDelete(platform.getInstalledFolder());
|
||||||
platform.setInstalled(false);
|
platform.setInstalled(false);
|
||||||
|
@ -28,8 +28,15 @@
|
|||||||
*/
|
*/
|
||||||
package cc.arduino.contributions.packages;
|
package cc.arduino.contributions.packages;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import cc.arduino.contributions.DownloadableContributionBuiltInAtTheBottomComparator;
|
||||||
import java.util.List;
|
import cc.arduino.contributions.filters.InstalledPredicate;
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.base.Predicate;
|
||||||
|
import com.google.common.collect.Collections2;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public abstract class ContributionsIndex {
|
public abstract class ContributionsIndex {
|
||||||
|
|
||||||
@ -43,6 +50,69 @@ public abstract class ContributionsIndex {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ContributedPlatform> findPlatforms(String packageName, final String platformName) {
|
||||||
|
if (packageName == null || platformName == null) {
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
ContributedPackage aPackage = findPackage(packageName);
|
||||||
|
if (aPackage == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Collection<ContributedPlatform> platforms = Collections2.filter(aPackage.getPlatforms(), new Predicate<ContributedPlatform>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(ContributedPlatform contributedPlatform) {
|
||||||
|
return platformName.equals(contributedPlatform.getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return Lists.newLinkedList(platforms);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContributedPlatform findPlatform(String packageName, final String platformName, final String platformVersion) {
|
||||||
|
if (platformVersion == null) {
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<ContributedPlatform> platformsByName = findPlatforms(packageName, platformName);
|
||||||
|
if (platformsByName == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Collection<ContributedPlatform> platforms = Collections2.filter(platformsByName, new Predicate<ContributedPlatform>() {
|
||||||
|
@Override
|
||||||
|
public boolean apply(ContributedPlatform contributedPlatform) {
|
||||||
|
return platformVersion.equals(contributedPlatform.getParsedVersion());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (platforms.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return platforms.iterator().next();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContributedPlatform getInstalled(String packageName, String platformName) {
|
||||||
|
List<ContributedPlatform> installedPlatforms = new LinkedList<ContributedPlatform>(Collections2.filter(findPlatforms(packageName, platformName), new InstalledPredicate()));
|
||||||
|
Collections.sort(installedPlatforms, new DownloadableContributionBuiltInAtTheBottomComparator());
|
||||||
|
|
||||||
|
if (installedPlatforms.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return installedPlatforms.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ContributedPlatform> getPlatforms() {
|
||||||
|
return Lists.newLinkedList(Iterables.concat(Collections2.transform(getPackages(), new Function<ContributedPackage, List<ContributedPlatform>>() {
|
||||||
|
@Override
|
||||||
|
public List<ContributedPlatform> apply(ContributedPackage contributedPackage) {
|
||||||
|
return contributedPackage.getPlatforms();
|
||||||
|
}
|
||||||
|
})));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public ContributedTool findTool(String packageName, String name,
|
public ContributedTool findTool(String packageName, String name,
|
||||||
String version) {
|
String version) {
|
||||||
ContributedPackage pack = findPackage(packageName);
|
ContributedPackage pack = findPackage(packageName);
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
package processing.app.helpers;
|
package processing.app.helpers;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import processing.app.BaseNoGui;
|
import processing.app.BaseNoGui;
|
||||||
import processing.app.I18n;
|
import processing.app.I18n;
|
||||||
import processing.app.PreferencesData;
|
import processing.app.PreferencesData;
|
||||||
@ -16,9 +8,29 @@ import processing.app.debug.TargetPackage;
|
|||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
import processing.app.legacy.PApplet;
|
import processing.app.legacy.PApplet;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
public class CommandlineParser {
|
public class CommandlineParser {
|
||||||
|
|
||||||
protected static enum ACTION { GUI, NOOP, VERIFY, UPLOAD, GET_PREF };
|
private enum ACTION {
|
||||||
|
GUI, NOOP, VERIFY("--verify"), UPLOAD("--upload"), GET_PREF("--get-pref"), INSTALL_BOARD("--install-board"), INSTALL_LIBRARY("--install-library");
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
|
||||||
|
ACTION() {
|
||||||
|
this.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ACTION(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ACTION action = ACTION.GUI;
|
private ACTION action = ACTION.GUI;
|
||||||
private boolean doVerboseBuild = false;
|
private boolean doVerboseBuild = false;
|
||||||
@ -26,24 +38,28 @@ public class CommandlineParser {
|
|||||||
private boolean doUseProgrammer = false;
|
private boolean doUseProgrammer = false;
|
||||||
private boolean noUploadPort = false;
|
private boolean noUploadPort = false;
|
||||||
private boolean forceSavePrefs = false;
|
private boolean forceSavePrefs = false;
|
||||||
private String getPref = null;
|
private String getPref;
|
||||||
|
private String boardToInstall;
|
||||||
|
private String libraryToInstall;
|
||||||
private List<String> filenames = new LinkedList<String>();
|
private List<String> filenames = new LinkedList<String>();
|
||||||
|
|
||||||
public static CommandlineParser newCommandlineParser(String[] args) {
|
public static CommandlineParser newCommandlineParser(String[] args) {
|
||||||
return new CommandlineParser(args);
|
return new CommandlineParser(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandlineParser(String[] args) {
|
private CommandlineParser(String[] args) {
|
||||||
parseArguments(args);
|
parseArguments(args);
|
||||||
checkAction();
|
checkAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void parseArguments(String[] args) {
|
private void parseArguments(String[] args) {
|
||||||
// Map of possible actions and corresponding options
|
// Map of possible actions and corresponding options
|
||||||
final Map<String, ACTION> actions = new HashMap<String, ACTION>();
|
final Map<String, ACTION> actions = new HashMap<String, ACTION>();
|
||||||
actions.put("--verify", ACTION.VERIFY);
|
actions.put("--verify", ACTION.VERIFY);
|
||||||
actions.put("--upload", ACTION.UPLOAD);
|
actions.put("--upload", ACTION.UPLOAD);
|
||||||
actions.put("--get-pref", ACTION.GET_PREF);
|
actions.put("--get-pref", ACTION.GET_PREF);
|
||||||
|
actions.put("--install-board", ACTION.INSTALL_BOARD);
|
||||||
|
actions.put("--install-library", ACTION.INSTALL_LIBRARY);
|
||||||
|
|
||||||
// Check if any files were passed in on the command line
|
// Check if any files were passed in on the command line
|
||||||
for (int i = 0; i < args.length; i++) {
|
for (int i = 0; i < args.length; i++) {
|
||||||
@ -56,10 +72,25 @@ public class CommandlineParser {
|
|||||||
}
|
}
|
||||||
if (a == ACTION.GET_PREF) {
|
if (a == ACTION.GET_PREF) {
|
||||||
i++;
|
i++;
|
||||||
if (i >= args.length)
|
if (i >= args.length) {
|
||||||
BaseNoGui.showError(null, _("Argument required for --get-pref"), 3);
|
BaseNoGui.showError(null, I18n.format(_("Argument required for {0}"), a.value), 3);
|
||||||
|
}
|
||||||
getPref = args[i];
|
getPref = args[i];
|
||||||
}
|
}
|
||||||
|
if (a == ACTION.INSTALL_BOARD) {
|
||||||
|
i++;
|
||||||
|
if (i >= args.length) {
|
||||||
|
BaseNoGui.showError(null, I18n.format(_("Argument required for {0}"), a.value), 3);
|
||||||
|
}
|
||||||
|
boardToInstall = args[i];
|
||||||
|
}
|
||||||
|
if (a == ACTION.INSTALL_LIBRARY) {
|
||||||
|
i++;
|
||||||
|
if (i >= args.length) {
|
||||||
|
BaseNoGui.showError(null, I18n.format(_("Argument required for {0}"), a.value), 3);
|
||||||
|
}
|
||||||
|
libraryToInstall = args[i];
|
||||||
|
}
|
||||||
action = a;
|
action = a;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -164,7 +195,7 @@ public class CommandlineParser {
|
|||||||
filenames.add(args[i]);
|
filenames.add(args[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkAction() {
|
private void checkAction() {
|
||||||
if ((action == ACTION.UPLOAD || action == ACTION.VERIFY) && filenames.size() != 1)
|
if ((action == ACTION.UPLOAD || action == ACTION.VERIFY) && filenames.size() != 1)
|
||||||
BaseNoGui.showError(null, _("Must specify exactly one sketch file"), 3);
|
BaseNoGui.showError(null, _("Must specify exactly one sketch file"), 3);
|
||||||
@ -179,7 +210,7 @@ public class CommandlineParser {
|
|||||||
private void processBoardArgument(String selectBoard) {
|
private void processBoardArgument(String selectBoard) {
|
||||||
// No board selected? Nothing to do
|
// No board selected? Nothing to do
|
||||||
if (selectBoard == null)
|
if (selectBoard == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String[] split = selectBoard.split(":", 4);
|
String[] split = selectBoard.split(":", 4);
|
||||||
|
|
||||||
@ -251,27 +282,27 @@ public class CommandlineParser {
|
|||||||
public List<String> getFilenames() {
|
public List<String> getFilenames() {
|
||||||
return filenames;
|
return filenames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGetPrefMode() {
|
public boolean isGetPrefMode() {
|
||||||
return action == ACTION.GET_PREF;
|
return action == ACTION.GET_PREF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGuiMode() {
|
public boolean isGuiMode() {
|
||||||
return action == ACTION.GUI;
|
return action == ACTION.GUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNoOpMode() {
|
public boolean isNoOpMode() {
|
||||||
return action == ACTION.NOOP;
|
return action == ACTION.NOOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUploadMode() {
|
public boolean isUploadMode() {
|
||||||
return action == ACTION.UPLOAD;
|
return action == ACTION.UPLOAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVerifyMode() {
|
public boolean isVerifyMode() {
|
||||||
return action == ACTION.VERIFY;
|
return action == ACTION.VERIFY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVerifyOrUploadMode() {
|
public boolean isVerifyOrUploadMode() {
|
||||||
return isVerifyMode() || isUploadMode();
|
return isVerifyMode() || isUploadMode();
|
||||||
}
|
}
|
||||||
@ -284,4 +315,19 @@ public class CommandlineParser {
|
|||||||
return noUploadPort;
|
return noUploadPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInstallBoard() {
|
||||||
|
return action == ACTION.INSTALL_BOARD;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isInstallLibrary() {
|
||||||
|
return action == ACTION.INSTALL_LIBRARY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBoardToInstall() {
|
||||||
|
return this.boardToInstall;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLibraryToInstall() {
|
||||||
|
return libraryToInstall;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
2
build/linux/dist/arduino
vendored
2
build/linux/dist/arduino
vendored
@ -20,7 +20,7 @@ export LD_LIBRARY_PATH
|
|||||||
|
|
||||||
export PATH="${APPDIR}/java/bin:${PATH}"
|
export PATH="${APPDIR}/java/bin:${PATH}"
|
||||||
|
|
||||||
if [[ "$@" == *"--upload"* || "$@" == *"--verify"* || "$@" == *"--get-pref"* ]] ; then
|
if [[ "$@" == *"--upload"* || "$@" == *"--verify"* || "$@" == *"--get-pref"* || "$@" == *"--install-board"* || "$@" == *"--install-library"* ]] ; then
|
||||||
SPLASH=""
|
SPLASH=""
|
||||||
else
|
else
|
||||||
SPLASH="-splash:./lib/splash.png"
|
SPLASH="-splash:./lib/splash.png"
|
||||||
|
Loading…
Reference in New Issue
Block a user