use of io.sloeber.core.api.Json.ArduinoPlatformTooldDependency in project arduino-eclipse-plugin by Sloeber.
the class BoardDescription method getEnvVarPlatformFileTools.
/**
* This method only returns environment variables with and without version
* number
* These are purely based on the tool dependencies
*
* @param platformVersion
* @return environment variables pointing to the tools used by the platform
*/
private static Map<String, String> getEnvVarPlatformFileTools(ArduinoPlatformVersion platformVersion) {
HashMap<String, String> vars = new HashMap<>();
for (ArduinoPlatformTooldDependency tool : platformVersion.getToolsDependencies()) {
IPath installPath = tool.getInstallPath();
if (installPath.toFile().exists()) {
String value = installPath.toOSString();
String keyString = RUNTIME_TOOLS + tool.getName() + tool.getVersion() + DOT_PATH;
vars.put(keyString, value);
keyString = RUNTIME_TOOLS + tool.getName() + '-' + tool.getVersion() + DOT_PATH;
vars.put(keyString, value);
keyString = RUNTIME_TOOLS + tool.getName() + DOT_PATH;
vars.put(keyString, value);
}
}
return vars;
}
use of io.sloeber.core.api.Json.ArduinoPlatformTooldDependency in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method install.
@SuppressWarnings("nls")
private static IStatus install(ArduinoPlatformVersion platformVersion, IProgressMonitor monitor) {
boolean forceDownload = false;
String name = platformVersion.getName();
String architecture = platformVersion.getArchitecture();
String version = platformVersion.getVersion().toString();
// Check if we're installed already
if (platformVersion.isInstalled()) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.println("reusing platform " + name + " " + architecture + "(" + version + ")");
return Status.OK_STATUS;
}
// Download platform archive
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.println("start installing platform " + name + " " + architecture + "(" + version + ")");
// $NON-NLS-1$
MyMultiStatus mstatus = new MyMultiStatus("Failed to install " + platformVersion.getName());
mstatus.addErrors(PackageManager.downloadAndInstall(platformVersion, forceDownload, monitor));
if (!mstatus.isOK()) {
// no use installing tools when the boards failed installing
return mstatus;
}
// keep a copy of the json file used at install
File packageFile = platformVersion.getParent().getParent().getPackageIndex().getJsonFile();
File copyToFile = platformVersion.getInstallPath().append(packageFile.getName()).toFile();
try {
Files.copy(packageFile.toPath(), copyToFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
ArduinoPackage referencingPkg = platformVersion.getParent().getParent();
for (ArduinoPlatformTooldDependency toolDependency : platformVersion.getToolsDependencies()) {
ArduinoPlatformToolVersion tool = referencingPkg.getTool(toolDependency.getName(), toolDependency.getVersion());
if (tool == null) {
// this is a tool provided by another platform
// and the referencing platform does not specify the installable info
// This means the package file of the referencing platform needs to be provided
ArduinoPackage pkg = getPackageByProvider(toolDependency.getPackager());
if (pkg != null) {
tool = pkg.getTool(toolDependency.getName(), toolDependency.getVersion());
}
}
if (tool == null) {
mstatus.add(new Status(IStatus.ERROR, Activator.getId(), Messages.Tool_no_valid_system.replace(Messages.KEY_TAG, toolDependency.getName())));
} else if (!tool.isInstalled()) {
ArduinoInstallable installable = tool.getInstallable();
if (installable != null) {
monitor.setTaskName(InstallProgress.getRandomMessage());
mstatus.addErrors(PackageManager.downloadAndInstall(installable, forceDownload, monitor));
}
}
}
WorkAround.applyKnownWorkArounds(platformVersion);
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
System.out.println("done installing platform " + name + " " + architecture + "(" + version + ")");
return mstatus;
}
use of io.sloeber.core.api.Json.ArduinoPlatformTooldDependency in project arduino-eclipse-plugin by Sloeber.
the class BoardsManager method getEnvVarPlatformFileTools.
private static Map<String, String> getEnvVarPlatformFileTools(ArduinoPlatformVersion platformVersion) {
HashMap<String, String> vars = new HashMap<>();
ArduinoPackage pkg = platformVersion.getParent().getParent();
for (ArduinoPlatformTooldDependency tool : platformVersion.getToolsDependencies()) {
ArduinoPlatformTool theTool = pkg.getTool(tool.getName());
if (theTool == null) {
// $NON-NLS-1$ //$NON-NLS-2$
System.err.println("Did not find " + tool.getName() + " in package with ID " + pkg.getID());
} else {
vars.putAll(theTool.getEnvVars(null));
}
}
return vars;
}
Aggregations