Skip to content

Commit 28fd371

Browse files
authored
Merge pull request #753 from Sloeber/release_4.1
Release 4.1
2 parents 4fdcbc5 + f149c19 commit 28fd371

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

io.sloeber.core/src/io/sloeber/core/managers/Manager.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ public static IPath getPlatformInstallPath(String vendor, String architecture) {
307307

308308
for (PackageIndex index : getPackageIndices()) {
309309
for (Package pkg : index.getPackages()) {
310-
for (ArduinoPlatform curPlatform : pkg.getInstalledPlatforms()) {
310+
for (ArduinoPlatform curPlatform : pkg.getLatestInstalledPlatforms()) {
311311
if (architecture.equalsIgnoreCase(curPlatform.getArchitecture())
312312
&& (vendor.equalsIgnoreCase(pkg.getName()))) {
313313
return new org.eclipse.core.runtime.Path(curPlatform.getInstallPath().toString());
@@ -337,6 +337,18 @@ public static ArduinoPlatform getPlatform(File platformTxt) {
337337
return null;
338338
}
339339

340+
static public List<ArduinoPlatform> getLatestInstalledPlatforms() {
341+
List<ArduinoPlatform> platforms = new ArrayList<>();
342+
for (PackageIndex index : getPackageIndices()) {
343+
for (Package pkg : index.getPackages()) {
344+
345+
platforms.addAll(pkg.getLatestInstalledPlatforms());
346+
347+
}
348+
}
349+
return platforms;
350+
}
351+
340352
static public List<ArduinoPlatform> getInstalledPlatforms() {
341353
List<ArduinoPlatform> platforms = new ArrayList<>();
342354
for (PackageIndex index : getPackageIndices()) {
@@ -353,7 +365,7 @@ static public List<Board> getInstalledBoards() {
353365
List<Board> boards = new ArrayList<>();
354366
for (PackageIndex index : getPackageIndices()) {
355367
for (Package pkg : index.getPackages()) {
356-
for (ArduinoPlatform platform : pkg.getInstalledPlatforms()) {
368+
for (ArduinoPlatform platform : pkg.getLatestInstalledPlatforms()) {
357369
boards.addAll(platform.getBoards());
358370
}
359371
}

io.sloeber.core/src/io/sloeber/core/managers/Package.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import java.util.Collection;
1111
import java.util.Collections;
1212
import java.util.HashMap;
13+
import java.util.LinkedList;
1314
import java.util.List;
1415
import java.util.Map;
1516

@@ -86,7 +87,7 @@ public Collection<ArduinoPlatform> getLatestPlatforms() {
8687
* @return the installed platforms but only one for each platform (the one
8788
* with the highest version number)
8889
*/
89-
public Collection<ArduinoPlatform> getInstalledPlatforms() {
90+
public Collection<ArduinoPlatform> getLatestInstalledPlatforms() {
9091
Map<String, ArduinoPlatform> platformMap = new HashMap<>();
9192
for (ArduinoPlatform platform : this.platforms) {
9293
if (platform.isInstalled()) {
@@ -99,6 +100,22 @@ public Collection<ArduinoPlatform> getInstalledPlatforms() {
99100
return Collections.unmodifiableCollection(platformMap.values());
100101
}
101102

103+
/**
104+
* This method looks up the installed platforms So if you have 2 arduino avr
105+
* platform versions installed you will get back 2.
106+
*
107+
* @return all the installed platforms
108+
*/
109+
public List<ArduinoPlatform> getInstalledPlatforms() {
110+
List<ArduinoPlatform> platformMap = new LinkedList<>();
111+
for (ArduinoPlatform platform : this.platforms) {
112+
if (platform.isInstalled()) {
113+
platformMap.add(platform);
114+
}
115+
}
116+
return platformMap;
117+
}
118+
102119
public ArduinoPlatform getLatestPlatform(String platformName) {
103120
ArduinoPlatform foundPlatform = null;
104121
for (ArduinoPlatform platform : this.platforms) {

io.sloeber.core/src/io/sloeber/core/tools/Helpers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ private static void setTheEnvironmentVariablesAddThePlatformInfo(IContributedEnv
718718
addPlatformFileTools(platform, contribEnv, confDesc);
719719
}
720720

721-
// by adding the referencenced platform after the real platform
721+
// add the referenced platform before the real platform
722722
platform = Manager.getPlatform(new Path(referenceCoredPlatformFileName).append(PLATFORM_FILE_NAME).toFile());
723723
if (platform != null) {
724724
addPlatformFileTools(platform, contribEnv, confDesc);

io.sloeber.product/arduino.product

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ rights to a jury trial in any resulting litigation.&lt;/p&gt;
368368
<repository location="http://download.eclipse.org/releases/neon" enabled="true" />
369369
<repository location="http://eclipse.baeyens.it/update/V4/nightly" enabled="false" />
370370
<repository location="http://eclipse.baeyens.it/update/V4/stable" enabled="true" />
371+
<repository location="http://download.eclipse.org/nebula/snapshot" enabled="true" />
372+
<repository location="http://gnuarmeclipse.sourceforge.net/updates" enabled="true" />
371373
</repositories>
372374

373375
<preferencesInfo>

0 commit comments

Comments
 (0)