Skip to content

Commit 2c6f6e7

Browse files
committed
Boards tools are resolved using informations from package_index.json
1 parent 8efed7f commit 2c6f6e7

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

arduino-core/src/cc/arduino/contributions/packages/ContributionsIndexer.java

+8
Original file line numberDiff line numberDiff line change
@@ -439,4 +439,12 @@ public ContributedPlatform getPlatformByFolder(final File folder) {
439439

440440
return platformOptional.orElse(null);
441441
}
442+
443+
public ContributedPlatform getContributedPlaform(TargetPlatform targetPlatform) {
444+
for (ContributedPlatform plat : getInstalledPlatforms()) {
445+
if (plat.getInstalledFolder().equals(targetPlatform.getFolder()))
446+
return plat;
447+
}
448+
return null;
449+
}
442450
}

arduino-core/src/processing/app/BaseNoGui.java

+13
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import cc.arduino.contributions.GPGDetachedSignatureVerifier;
77
import cc.arduino.contributions.SignatureVerificationFailedException;
88
import cc.arduino.contributions.libraries.LibrariesIndexer;
9+
import cc.arduino.contributions.packages.ContributedPlatform;
910
import cc.arduino.contributions.packages.ContributedTool;
1011
import cc.arduino.contributions.packages.ContributionsIndexer;
1112
import cc.arduino.files.DeleteFilesOnShutdown;
@@ -160,6 +161,18 @@ static public PreferencesMap getBoardPreferences() {
160161
}
161162
}
162163
prefs.put("name", extendedName);
164+
165+
// Resolve tools needed for this board
166+
ContributedPlatform platform = indexer.getContributedPlaform(getTargetPlatform());
167+
if (platform != null) {
168+
String prefix = "runtime.tools.";
169+
for (ContributedTool tool : platform.getResolvedTools()) {
170+
File folder = tool.getDownloadableContribution(getPlatform()).getInstalledFolder();
171+
String toolPath = folder.getAbsolutePath();
172+
PreferencesData.set(prefix + tool.getName() + ".path", toolPath);
173+
PreferencesData.set(prefix + tool.getName() + "-" + tool.getVersion() + ".path", toolPath);
174+
}
175+
}
163176
return prefs;
164177
}
165178

0 commit comments

Comments
 (0)