1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-13 10:29:35 +01:00

Boards tools are resolved using informations from package_index.json

This commit is contained in:
Cristian Maglie 2016-08-02 12:12:00 +02:00
parent 8efed7f2d2
commit 2c6f6e76c4
2 changed files with 21 additions and 0 deletions

View File

@ -439,4 +439,12 @@ public class ContributionsIndexer {
return platformOptional.orElse(null);
}
public ContributedPlatform getContributedPlaform(TargetPlatform targetPlatform) {
for (ContributedPlatform plat : getInstalledPlatforms()) {
if (plat.getInstalledFolder().equals(targetPlatform.getFolder()))
return plat;
}
return null;
}
}

View File

@ -6,6 +6,7 @@ import cc.arduino.UploaderUtils;
import cc.arduino.contributions.GPGDetachedSignatureVerifier;
import cc.arduino.contributions.SignatureVerificationFailedException;
import cc.arduino.contributions.libraries.LibrariesIndexer;
import cc.arduino.contributions.packages.ContributedPlatform;
import cc.arduino.contributions.packages.ContributedTool;
import cc.arduino.contributions.packages.ContributionsIndexer;
import cc.arduino.files.DeleteFilesOnShutdown;
@ -160,6 +161,18 @@ public class BaseNoGui {
}
}
prefs.put("name", extendedName);
// Resolve tools needed for this board
ContributedPlatform platform = indexer.getContributedPlaform(getTargetPlatform());
if (platform != null) {
String prefix = "runtime.tools.";
for (ContributedTool tool : platform.getResolvedTools()) {
File folder = tool.getDownloadableContribution(getPlatform()).getInstalledFolder();
String toolPath = folder.getAbsolutePath();
PreferencesData.set(prefix + tool.getName() + ".path", toolPath);
PreferencesData.set(prefix + tool.getName() + "-" + tool.getVersion() + ".path", toolPath);
}
}
return prefs;
}