use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.
the class BoardDescription method getEnVarPlatformInfo.
private Map<String, String> getEnVarPlatformInfo() {
Map<String, String> ret = new HashMap<>();
if (myReferencedPlatformUpload != null) {
ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformUpload));
}
if (myReferencedPlatformVariant != null) {
ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformVariant));
}
if (myReferencedPlatformCore != null) {
ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformCore));
}
IPath referencingPlatformPath = getreferencingPlatformPath();
ArduinoPlatformVersion referencingPlatform = BoardsManager.getPlatform(referencingPlatformPath);
if (referencingPlatform == null) {
// there is no need to specify tool path as they do not use them
return ret;
}
ArduinoPlatformVersion latestArduinoPlatform = BoardsManager.getNewestInstalledPlatform(Const.ARDUINO, referencingPlatform.getArchitecture());
if (latestArduinoPlatform != null) {
ret.putAll(getEnvVarPlatformFileTools(latestArduinoPlatform));
}
if (myReferencedPlatformCore == null) {
// there is no referenced core so no need to do smart stuff
ret.putAll(getEnvVarPlatformFileTools(referencingPlatform));
return ret;
}
boolean jsonBasedPlatformManagement = !Preferences.getUseArduinoToolSelection();
if (jsonBasedPlatformManagement) {
// overrule the Arduino IDE way of working and use the json refereced tools
ret.putAll(getEnvVarPlatformFileTools(referencingPlatform));
return ret;
}
// standard arduino IDE way
ret.putAll(getEnvVarPlatformFileTools(referencingPlatform));
ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformCore));
return ret;
}
use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.
the class BoardDescription method getArduinoPlatformPath.
/*
* get the latest installed arduino platform with the same architecture. This is
* the platform to use the programmers.txt if no other programmers.txt are
* found.
*/
public IPath getArduinoPlatformPath() {
updateWhenDirty();
ArduinoPlatform platform = BoardsManager.getPlatform(VendorArduino, getArchitecture());
if (platform == null) {
return null;
}
ArduinoPlatformVersion platformVersion = platform.getNewestInstalled();
if (platformVersion == null) {
return null;
}
return platformVersion.getInstallPath();
}
use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method getEnvironmentVariables.
/**
* If something has been installed or deinstalled update the global variables
* with references to the installed stuff this to support platforms that do not
* explicitly define tools or platform dependencies Like private hardware
*/
public static Map<String, String> getEnvironmentVariables() {
if (!envVarsNeedUpdating) {
return myWorkbenchEnvironmentVariables;
}
myWorkbenchEnvironmentVariables.clear();
ArduinoPlatformVersion latestAvrPlatform = getNewestInstalledPlatform(Const.ARDUINO, Const.AVR);
ArduinoPlatformVersion latestSamdPlatform = getNewestInstalledPlatform(Const.ARDUINO, Const.SAMD);
ArduinoPlatformVersion latestSamPlatform = getNewestInstalledPlatform(Const.ARDUINO, Const.SAM);
if (latestSamdPlatform != null) {
myWorkbenchEnvironmentVariables.putAll(getEnvVarPlatformFileTools(latestSamdPlatform));
}
if (latestSamPlatform != null) {
myWorkbenchEnvironmentVariables.putAll(getEnvVarPlatformFileTools(latestSamPlatform));
}
if (latestAvrPlatform != null) {
myWorkbenchEnvironmentVariables.putAll(getEnvVarPlatformFileTools(latestAvrPlatform));
}
envVarsNeedUpdating = false;
return myWorkbenchEnvironmentVariables;
}
use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.
the class PlatformSelectionPage method updateInstallation.
protected IStatus updateInstallation(IProgressMonitor monitor) {
List<ArduinoPlatformVersion> platformsToInstall = new LinkedList<>();
List<ArduinoPlatformVersion> platformsToRemove = new LinkedList<>();
for (TreeMap<String, TreeMap<String, InstallableVersion[]>> packageIndex : myShownPlatforms.values()) {
for (TreeMap<String, InstallableVersion[]> arduinoPackage : packageIndex.values()) {
for (InstallableVersion[] versions : arduinoPackage.values()) {
for (InstallableVersion version : versions) {
if (version.isInstalled() != version.mustBeInstalled()) {
if (version.mustBeInstalled()) {
platformsToInstall.add(version.getPlatform());
} else {
platformsToRemove.add(version.getPlatform());
}
}
}
}
}
}
MultiStatus status = new MultiStatus(PLUGIN_ID, 0, Messages.ui_installing_platforms, null);
BoardsManager.updatePlatforms(platformsToInstall, platformsToRemove, monitor, status);
return status;
}
use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method getNewestBoardIDFromBoardsManager.
private static BoardDescription getNewestBoardIDFromBoardsManager(String jsonFileName, String packageName, String architectureName, String boardID, Map<String, String> options) {
ArduinoPackage thePackage = getPackage(jsonFileName, packageName);
if (thePackage == null) {
// fail("failed to find package:" + this.mPackageName);
return null;
}
ArduinoPlatform platform = thePackage.getPlatform(architectureName);
if (platform == null) {
// package:" + this.mPackageName);
return null;
}
ArduinoPlatformVersion platformVersion = platform.getNewestVersion();
java.io.File boardsFile = platformVersion.getBoardsFile();
BoardDescription boardid = new BoardDescription(boardsFile, boardID, options);
return boardid;
}
Aggregations