Skip to content

Commit 5df1340

Browse files
author
jantje
committed
#1412 was fixed in a previous change but here I fix finding the tool
1 parent 4b6659d commit 5df1340

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

io.sloeber.core/src/io/sloeber/core/api/BoardsManager.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,13 @@ private static IStatus install(ArduinoPlatformVersion platformVersion, IProgress
243243

244244
ArduinoPackage referencingPkg = platformVersion.getParent().getParent();
245245
for (ArduinoPlatformTooldDependency toolDependency : platformVersion.getToolsDependencies()) {
246-
//TODO make sure that tools from other providers are installed
247-
ArduinoPackage pkg = referencingPkg;
248-
ArduinoPlatformToolVersion tool = pkg.getTool(toolDependency.getName(), toolDependency.getVersion());
246+
ArduinoPlatformToolVersion tool = referencingPkg.getTool(toolDependency.getName(),
247+
toolDependency.getVersion());
249248
if (tool == null) {
250-
//maybe these are referenced tools
251-
pkg = getPackageByProvider(toolDependency.getPackager());
249+
//this is a tool provided by another platform
250+
//and the referencing platform does not specify the installable info
251+
//This means the package file of the referencing platform needs to be provided
252+
ArduinoPackage pkg = getPackageByProvider(toolDependency.getPackager());
252253
if (pkg != null) {
253254
tool = pkg.getTool(toolDependency.getName(), toolDependency.getVersion());
254255
}

io.sloeber.core/src/io/sloeber/core/api/Json/ArduinoPlatformToolVersion.java

+31-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class ArduinoPlatformToolVersion extends Node {
2828
private List<ArduinpPlatformToolSystem> mySystems = new ArrayList<>();
2929

3030
private transient ArduinoPlatformTool myParentTool;
31+
private transient IPath myInstallPath = null;
3132

3233
@SuppressWarnings("nls")
3334
public ArduinoPlatformToolVersion(JsonElement json, ArduinoPlatformTool tool) {
@@ -64,8 +65,37 @@ public List<ArduinpPlatformToolSystem> getSystems() {
6465
return mySystems;
6566
}
6667

68+
/**
69+
* This method is fucking wierd ...
70+
* but I can't help it...
71+
* The problem is that the tool depency references a packager (which is part of
72+
* the install path)
73+
* but the tool itself doe not
74+
* So to know where to install there are 2 options
75+
* 1) install in the local platform (resulting in tool duplication)
76+
* 2) search the dependency tree for the tooldepency and use the installpath
77+
* from there
78+
*
79+
* @return
80+
*/
6781
public IPath getInstallPath() {
68-
return myParentTool.getInstallPath().append(getID());
82+
if (myInstallPath != null) {
83+
return myInstallPath;
84+
}
85+
ArduinoPackage pkg = myParentTool.getPackage();
86+
for (ArduinoPlatform curPlatform : pkg.getPlatforms()) {
87+
for (ArduinoPlatformVersion curplatformVersion : curPlatform.getVersions()) {
88+
for (ArduinoPlatformTooldDependency curTooldependency : curplatformVersion.getToolsDependencies()) {
89+
if (curTooldependency.getName().equals(myParentTool.getName())
90+
&& curTooldependency.getVersion().compareTo(myVersion) == 0) {
91+
myInstallPath = curTooldependency.getInstallPath();
92+
return myInstallPath;
93+
}
94+
}
95+
}
96+
}
97+
myInstallPath = myParentTool.getInstallPath().append(getID());
98+
return myInstallPath;
6999

70100
}
71101

0 commit comments

Comments
 (0)