Skip to content

Commit 1debc34

Browse files
committed
#1278 failed on Linux
Actually it seems like the code to prioritize the arduino provided platforms never was added Now I prioritize the latest arduino maintainer platform with architectures sam samd and avr
1 parent 2d720d9 commit 1debc34

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

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

+26
Original file line numberDiff line numberDiff line change
@@ -881,12 +881,38 @@ public static Map<String, String> getEnvironmentVariables() {
881881
return myWorkbenchEnvironmentVariables;
882882
}
883883
myWorkbenchEnvironmentVariables.clear();
884+
ArduinoPlatform latestAvrPlatform=null;
885+
ArduinoPlatform latestSamdPlatform=null;
886+
ArduinoPlatform latestSamPlatform=null;
884887
for (ArduinoPlatform curPlatform : InternalPackageManager.getInstalledPlatforms()) {
885888
Package pkg = curPlatform.getParent();
886889
if (pkg != null) {
887890
myWorkbenchEnvironmentVariables.putAll(Helpers.getEnvVarPlatformFileTools(curPlatform, false));
891+
if(Const.ARDUINO.equalsIgnoreCase(pkg.getMaintainer())){
892+
switch (curPlatform.getArchitecture()) {
893+
case Const.AVR:
894+
latestAvrPlatform=curPlatform;
895+
break;
896+
case Const.SAM:
897+
latestSamPlatform=curPlatform;
898+
break;
899+
case Const.SAMD:
900+
latestSamdPlatform=curPlatform;
901+
break;
902+
}
903+
}
888904
}
889905
}
906+
907+
if( latestSamdPlatform!=null) {
908+
myWorkbenchEnvironmentVariables.putAll(Helpers.getEnvVarPlatformFileTools(latestSamdPlatform, false));
909+
}
910+
if( latestSamPlatform!=null) {
911+
myWorkbenchEnvironmentVariables.putAll(Helpers.getEnvVarPlatformFileTools(latestSamPlatform, false));
912+
}
913+
if( latestAvrPlatform!=null) {
914+
myWorkbenchEnvironmentVariables.putAll(Helpers.getEnvVarPlatformFileTools(latestAvrPlatform, false));
915+
}
890916
platformsDirty = false;
891917
return myWorkbenchEnvironmentVariables;
892918
}

io.sloeber.core/src/io/sloeber/core/common/Const.java

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ public class Const {
110110

111111
public static final String SLOEBER_OBJCOPY = ENV_KEY_SLOEBER_START + "objcopy";
112112

113+
public static final String AVR = "avr";
114+
public static final String SAM = "sam";
115+
public static final String SAMD = "samd";
116+
113117

114118

115119

io.sloeber.core/src/io/sloeber/core/txt/TxtFile.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public String getArchitecture() {
156156
IPath platformFile = new Path(this.mLoadedTxtFile.toString().trim());
157157
String architecture = platformFile.removeLastSegments(1).lastSegment();
158158
if (architecture == null) {// for error conditions
159-
architecture = "avr"; //$NON-NLS-1$
159+
architecture = Const.AVR;
160160
}
161161
if (architecture.contains(Const.DOT)) { // This is a version number so
162162
// package

0 commit comments

Comments
 (0)