Skip to content

Commit 7cd2a0a

Browse files
author
jantje
committed
Do not install deprecated platforms during testing
1 parent 93d6265 commit 7cd2a0a

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public static void setPackageURLs(HashSet<String> packageUrls, boolean forceDown
162162
* the platforms after this platform are skipped
163163
*/
164164
public static void installsubsetOfLatestPlatforms(int fromIndex, int toIndex) {
165+
String DEPRECATED = "DEPRECATED"; //$NON-NLS-1$
165166
if (!isReady()) {
166167
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, BoardsManagerIsBussy, new Exception()));
167168
return;
@@ -173,11 +174,21 @@ public static void installsubsetOfLatestPlatforms(int fromIndex, int toIndex) {
173174
for (ArduinoPackage curPackage : allPackages) {
174175
Collection<ArduinoPlatform> latestPlatforms = curPackage.getPlatforms();
175176
for (ArduinoPlatform curPlatform : latestPlatforms) {
176-
if (currPlatformIndex > fromIndex) {
177-
install(curPlatform.getNewestVersion(), monitor);
177+
if (!curPlatform.getName().toUpperCase().contains(DEPRECATED)) {
178+
if (currPlatformIndex > fromIndex) {
179+
ArduinoPlatformVersion latestPlatformVersion = curPlatform.getNewestVersion();
180+
if (!latestPlatformVersion.getName().toUpperCase().contains(DEPRECATED)) {
181+
install(latestPlatformVersion, monitor);
182+
} else {
183+
System.out.println("skipping platform " + latestPlatformVersion.toString()); //$NON-NLS-1$
184+
}
185+
}
186+
if (currPlatformIndex++ > toIndex) {
187+
return;
188+
}
189+
} else {
190+
System.out.println("skipping platform " + curPlatform.toString()); //$NON-NLS-1$
178191
}
179-
if (currPlatformIndex++ > toIndex)
180-
return;
181192
}
182193
}
183194
}
@@ -219,12 +230,12 @@ private static IStatus install(ArduinoPlatformVersion platformVersion, IProgress
219230
String version = platformVersion.getVersion().toString();
220231
// Check if we're installed already
221232
if (platformVersion.isInstalled()) {
222-
System.out.println("reusing platform " + name + " " + architecture + "(" + version + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
233+
System.out.println("reusing platform " + platformVersion.toString()); //$NON-NLS-1$
223234
return Status.OK_STATUS;
224235
}
225236

226237
// Download platform archive
227-
System.out.println("start installing platform " + name + " " + architecture + "(" + version + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
238+
System.out.println("start installing platform " + platformVersion.toString()); //$NON-NLS-1$
228239

229240
MyMultiStatus mstatus = new MyMultiStatus("Failed to install " + platformVersion.getName()); //$NON-NLS-1$
230241
mstatus.addErrors(PackageManager.downloadAndInstall(platformVersion, forceDownload, monitor));
@@ -269,7 +280,7 @@ private static IStatus install(ArduinoPlatformVersion platformVersion, IProgress
269280

270281
WorkAround.applyKnownWorkArounds(platformVersion);
271282

272-
System.out.println("done installing platform " + name + " " + architecture + "(" + version + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
283+
System.out.println("done installing platform " + platformVersion.toString()); //$NON-NLS-1$
273284
return mstatus;
274285
}
275286

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
package io.sloeber.core.api.Json;
99

1010
import static io.sloeber.core.Gson.GsonConverter.*;
11+
import static io.sloeber.core.common.Const.*;
1112

1213
import java.util.Collection;
1314
import java.util.Collections;
@@ -115,4 +116,8 @@ public ArduinoPlatformVersion getNewestInstalled() {
115116
return null;
116117
}
117118

119+
@Override
120+
public String toString() {
121+
return name + SPACE + architecture;
122+
}
118123
}

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.google.gson.JsonParseException;
2222

2323
import io.sloeber.core.api.VersionNumber;
24-
import io.sloeber.core.common.Const;
24+
import static io.sloeber.core.common.Const.*;
2525

2626
public class ArduinoPlatformVersion extends ArduinoInstallable implements Comparable<ArduinoPlatformVersion> {
2727

@@ -86,11 +86,11 @@ public boolean isInstalled() {
8686
}
8787

8888
public File getBoardsFile() {
89-
return getInstallPath().append(Const.BOARDS_FILE_NAME).toFile();
89+
return getInstallPath().append(BOARDS_FILE_NAME).toFile();
9090
}
9191

9292
public File getPlatformFile() {
93-
return getInstallPath().append(Const.PLATFORM_FILE_NAME).toFile();
93+
return getInstallPath().append(PLATFORM_FILE_NAME).toFile();
9494
}
9595

9696
@Override
@@ -101,7 +101,7 @@ public IPath getInstallPath() {
101101
public List<IPath> getIncludePath() {
102102
IPath installPath = getInstallPath();
103103
return Arrays.asList(installPath.append("cores/{build.core}"), //$NON-NLS-1$
104-
installPath.append(Const.VARIANTS_FOLDER_NAME + "/{build.variant}")); //$NON-NLS-1$
104+
installPath.append(VARIANTS_FOLDER_NAME + "/{build.variant}")); //$NON-NLS-1$
105105
}
106106

107107
@Override
@@ -158,4 +158,9 @@ public int compareTo(ArduinoPlatformVersion o) {
158158
return name.compareTo(o.getName());
159159
}
160160

161+
@Override
162+
public String toString() {
163+
return name + SPACE + architecture + '(' + version + ')';
164+
}
165+
161166
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class Const {
2525
public static final String EMPTY = "";
2626
public static final String NEWLINE = "\n";
2727
public static final String EQUAL = "=";
28+
public static final String SPACE = " ";
2829

2930
// arduino txt basic keys
3031
public static final String VARIANT = "variant";

0 commit comments

Comments
 (0)