Skip to content

Commit c5154a7

Browse files
author
jantje
committed
#1339 boardsmanager now has a platform and platform version
regression testing works
1 parent 1fd4470 commit c5154a7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1262
-1191
lines changed

io.sloeber.core/META-INF/MANIFEST.MF

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Export-Package: cc.arduino.packages;x-internal:=true,
3333
io.sloeber.core;x-friends:="io.sloeber.tests",
3434
io.sloeber.core.api,
3535
io.sloeber.core.api.Json,
36-
io.sloeber.core.api.Json.packages,
3736
io.sloeber.core.builder;x-internal:=true,
3837
io.sloeber.core.common;x-friends:="io.sloeber.tests",
3938
io.sloeber.core.communication;x-internal:=true,

io.sloeber.core/src/io/sloeber/core/Activator.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@
4141
import org.osgi.service.prefs.Preferences;
4242

4343
import cc.arduino.packages.discoverers.SloeberNetworkDiscovery;
44-
import io.sloeber.core.api.PackageManager;
44+
import io.sloeber.core.api.BoardsManager;
4545
import io.sloeber.core.common.Common;
4646
import io.sloeber.core.common.ConfigurationPreferences;
4747
import io.sloeber.core.common.InstancePreferences;
4848
import io.sloeber.core.listeners.ConfigurationChangeListener;
4949
import io.sloeber.core.listeners.IndexerListener;
5050
import io.sloeber.core.listeners.resourceChangeListener;
51+
import io.sloeber.core.tools.PackageManager;
5152

5253
/**
5354
* generated code
@@ -213,7 +214,7 @@ private static void initializeImportantVariables() {
213214
InstancePreferences.setPrivateLibraryPaths(InstancePreferences.getPrivateLibraryPaths());
214215
InstancePreferences.setPrivateHardwarePaths(InstancePreferences.getPrivateHardwarePaths());
215216
InstancePreferences.setAutomaticallyImportLibraries(InstancePreferences.getAutomaticallyImportLibraries());
216-
PackageManager.setJsonURLs(PackageManager.getJsonURLs());
217+
BoardsManager.setJsonURLs(BoardsManager.getJsonURLs());
217218
}
218219

219220
private void runPluginCoreStartInstantiatorJob() {
@@ -251,7 +252,7 @@ protected IStatus run(IProgressMonitor monitor) {
251252

252253
installOtherStuff();
253254

254-
PackageManager.startup_Pluging(monitor);
255+
BoardsManager.startup_Pluging(monitor);
255256

256257
monitor.setTaskName("Done!");
257258
if (InstancePreferences.useBonjour()) {

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

+26-13
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
2323
import org.eclipse.core.runtime.preferences.InstanceScope;
2424

25-
import io.sloeber.core.api.Json.packages.ArduinoPlatform;
25+
import io.sloeber.core.api.Json.ArduinoPlatform;
26+
import io.sloeber.core.api.Json.ArduinoPlatformVersion;
2627
import io.sloeber.core.common.Common;
2728
import io.sloeber.core.common.ConfigurationPreferences;
2829
import io.sloeber.core.tools.Helpers;
@@ -193,8 +194,13 @@ private void ParseSection() {
193194
String refVendor = valueSplit[0];
194195
String actualValue = valueSplit[1];
195196
myBoardsCore = actualValue;
196-
myReferencedCorePlatformPath = PackageManager.getPlatformInstallPath(refVendor, architecture);
197-
if (this.myReferencedCorePlatformPath == null) {
197+
ArduinoPlatform platform = BoardsManager.getPlatform(refVendor, architecture);
198+
ArduinoPlatformVersion platformVersion = null;
199+
platformVersion = platform.getNewestInstalled();
200+
if (platformVersion != null) {
201+
myReferencedCorePlatformPath = platformVersion.getInstallPath();
202+
}
203+
if (myReferencedCorePlatformPath == null) {
198204
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
199205
Helpers_tool_reference_missing.replace(TOOL_TAG, core)
200206
.replace(FILE_TAG, getReferencingBoardsFile().toString())
@@ -207,8 +213,11 @@ private void ParseSection() {
207213
VersionNumber refVersion = new VersionNumber(valueSplit[2]);
208214
String actualValue = valueSplit[3];
209215
myBoardsCore = actualValue;
210-
myReferencedCorePlatformPath = PackageManager.getPlatformInstallPath(refVendor, refArchitecture,
216+
ArduinoPlatformVersion platformVersion = BoardsManager.getPlatform(refVendor, refArchitecture,
211217
refVersion);
218+
if (platformVersion != null) {
219+
myReferencedCorePlatformPath = platformVersion.getInstallPath();
220+
}
212221
if (this.myReferencedCorePlatformPath == null) {
213222
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
214223
Helpers_tool_reference_missing.replace(TOOL_TAG, core)
@@ -226,7 +235,7 @@ private void ParseSection() {
226235
String refVendor = valueSplit[0];
227236
String actualValue = valueSplit[1];
228237
this.myBoardsVariant = actualValue;
229-
this.myReferencedBoardVariantPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
238+
this.myReferencedBoardVariantPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
230239
architecture);
231240
if (this.myReferencedBoardVariantPlatformPath == null) {
232241
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
@@ -242,10 +251,10 @@ private void ParseSection() {
242251
String actualValue = valueSplit[3];
243252
this.myBoardsVariant = actualValue;
244253
if ("*".equals(refVersion)) { //$NON-NLS-1$
245-
this.myReferencedBoardVariantPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
254+
this.myReferencedBoardVariantPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
246255
refArchitecture);
247256
} else {
248-
this.myReferencedBoardVariantPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
257+
this.myReferencedBoardVariantPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
249258
refArchitecture, refVersion);
250259
}
251260
if (this.myReferencedBoardVariantPlatformPath == null) {
@@ -265,8 +274,7 @@ private void ParseSection() {
265274
String refVendor = valueSplit[0];
266275
String actualValue = valueSplit[1];
267276
this.myUploadTool = actualValue;
268-
this.myReferencedUploadToolPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
269-
architecture);
277+
this.myReferencedUploadToolPlatformPath = BoardsManager.getPlatformInstallPath(refVendor, architecture);
270278
if (this.myReferencedUploadToolPlatformPath == null) {
271279
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
272280
Helpers_tool_reference_missing.replace(TOOL_TAG, upload)
@@ -280,7 +288,7 @@ private void ParseSection() {
280288
VersionNumber refVersion = new VersionNumber(valueSplit[2]);
281289
String actualValue = valueSplit[3];
282290
this.myUploadTool = actualValue;
283-
this.myReferencedUploadToolPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
291+
this.myReferencedUploadToolPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
284292
refArchitecture, refVersion);
285293
if (this.myReferencedUploadToolPlatformPath == null) {
286294
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
@@ -668,7 +676,12 @@ public IPath getreferencedHardwarePath() {
668676
*/
669677
public IPath getArduinoPlatformPath() {
670678
updateWhenDirty();
671-
return PackageManager.getPlatformInstallPath(VendorArduino, getArchitecture());
679+
ArduinoPlatform platform = BoardsManager.getPlatform(VendorArduino, getArchitecture());
680+
if (platform == null) {
681+
return null;
682+
}
683+
ArduinoPlatformVersion platformVersion = platform.getNewestInstalled();
684+
return platformVersion.getInstallPath();
672685
}
673686

674687
/**
@@ -892,8 +905,8 @@ private Map<String, String> getEnVarPlatformInfo() {
892905
return new HashMap<>();
893906
}
894907

895-
ArduinoPlatform referencingPlatform = PackageManager.getPlatform(referencingPlatformPath);
896-
ArduinoPlatform referencedPlatform = PackageManager.getPlatform(referencedPlatformPath);
908+
ArduinoPlatformVersion referencingPlatform = BoardsManager.getPlatform(referencingPlatformPath);
909+
ArduinoPlatformVersion referencedPlatform = BoardsManager.getPlatform(referencedPlatformPath);
897910

898911
boolean jsonBasedPlatformManagement = !Preferences.getUseArduinoToolSelection();
899912
if (jsonBasedPlatformManagement) {

0 commit comments

Comments
 (0)