Skip to content

Commit

Permalink
#1339 boardsmanager now has a platform and platform version
Browse files Browse the repository at this point in the history
regression testing works
  • Loading branch information
jantje committed Nov 25, 2021
1 parent 1fd4470 commit c5154a7
Show file tree
Hide file tree
Showing 48 changed files with 1,262 additions and 1,191 deletions.
1 change: 0 additions & 1 deletion io.sloeber.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Export-Package: cc.arduino.packages;x-internal:=true,
io.sloeber.core;x-friends:="io.sloeber.tests",
io.sloeber.core.api,
io.sloeber.core.api.Json,
io.sloeber.core.api.Json.packages,
io.sloeber.core.builder;x-internal:=true,
io.sloeber.core.common;x-friends:="io.sloeber.tests",
io.sloeber.core.communication;x-internal:=true,
Expand Down
7 changes: 4 additions & 3 deletions io.sloeber.core/src/io/sloeber/core/Activator.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
import org.osgi.service.prefs.Preferences;

import cc.arduino.packages.discoverers.SloeberNetworkDiscovery;
import io.sloeber.core.api.PackageManager;
import io.sloeber.core.api.BoardsManager;
import io.sloeber.core.common.Common;
import io.sloeber.core.common.ConfigurationPreferences;
import io.sloeber.core.common.InstancePreferences;
import io.sloeber.core.listeners.ConfigurationChangeListener;
import io.sloeber.core.listeners.IndexerListener;
import io.sloeber.core.listeners.resourceChangeListener;
import io.sloeber.core.tools.PackageManager;

/**
* generated code
Expand Down Expand Up @@ -213,7 +214,7 @@ private static void initializeImportantVariables() {
InstancePreferences.setPrivateLibraryPaths(InstancePreferences.getPrivateLibraryPaths());
InstancePreferences.setPrivateHardwarePaths(InstancePreferences.getPrivateHardwarePaths());
InstancePreferences.setAutomaticallyImportLibraries(InstancePreferences.getAutomaticallyImportLibraries());
PackageManager.setJsonURLs(PackageManager.getJsonURLs());
BoardsManager.setJsonURLs(BoardsManager.getJsonURLs());
}

private void runPluginCoreStartInstantiatorJob() {
Expand Down Expand Up @@ -251,7 +252,7 @@ protected IStatus run(IProgressMonitor monitor) {

installOtherStuff();

PackageManager.startup_Pluging(monitor);
BoardsManager.startup_Pluging(monitor);

monitor.setTaskName("Done!");
if (InstancePreferences.useBonjour()) {
Expand Down
39 changes: 26 additions & 13 deletions io.sloeber.core/src/io/sloeber/core/api/BoardDescription.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;

import io.sloeber.core.api.Json.packages.ArduinoPlatform;
import io.sloeber.core.api.Json.ArduinoPlatform;
import io.sloeber.core.api.Json.ArduinoPlatformVersion;
import io.sloeber.core.common.Common;
import io.sloeber.core.common.ConfigurationPreferences;
import io.sloeber.core.tools.Helpers;
Expand Down Expand Up @@ -193,8 +194,13 @@ private void ParseSection() {
String refVendor = valueSplit[0];
String actualValue = valueSplit[1];
myBoardsCore = actualValue;
myReferencedCorePlatformPath = PackageManager.getPlatformInstallPath(refVendor, architecture);
if (this.myReferencedCorePlatformPath == null) {
ArduinoPlatform platform = BoardsManager.getPlatform(refVendor, architecture);
ArduinoPlatformVersion platformVersion = null;
platformVersion = platform.getNewestInstalled();
if (platformVersion != null) {
myReferencedCorePlatformPath = platformVersion.getInstallPath();
}
if (myReferencedCorePlatformPath == null) {
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
Helpers_tool_reference_missing.replace(TOOL_TAG, core)
.replace(FILE_TAG, getReferencingBoardsFile().toString())
Expand All @@ -207,8 +213,11 @@ private void ParseSection() {
VersionNumber refVersion = new VersionNumber(valueSplit[2]);
String actualValue = valueSplit[3];
myBoardsCore = actualValue;
myReferencedCorePlatformPath = PackageManager.getPlatformInstallPath(refVendor, refArchitecture,
ArduinoPlatformVersion platformVersion = BoardsManager.getPlatform(refVendor, refArchitecture,
refVersion);
if (platformVersion != null) {
myReferencedCorePlatformPath = platformVersion.getInstallPath();
}
if (this.myReferencedCorePlatformPath == null) {
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
Helpers_tool_reference_missing.replace(TOOL_TAG, core)
Expand All @@ -226,7 +235,7 @@ private void ParseSection() {
String refVendor = valueSplit[0];
String actualValue = valueSplit[1];
this.myBoardsVariant = actualValue;
this.myReferencedBoardVariantPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
this.myReferencedBoardVariantPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
architecture);
if (this.myReferencedBoardVariantPlatformPath == null) {
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
Expand All @@ -242,10 +251,10 @@ private void ParseSection() {
String actualValue = valueSplit[3];
this.myBoardsVariant = actualValue;
if ("*".equals(refVersion)) { //$NON-NLS-1$
this.myReferencedBoardVariantPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
this.myReferencedBoardVariantPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
refArchitecture);
} else {
this.myReferencedBoardVariantPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
this.myReferencedBoardVariantPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
refArchitecture, refVersion);
}
if (this.myReferencedBoardVariantPlatformPath == null) {
Expand All @@ -265,8 +274,7 @@ private void ParseSection() {
String refVendor = valueSplit[0];
String actualValue = valueSplit[1];
this.myUploadTool = actualValue;
this.myReferencedUploadToolPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
architecture);
this.myReferencedUploadToolPlatformPath = BoardsManager.getPlatformInstallPath(refVendor, architecture);
if (this.myReferencedUploadToolPlatformPath == null) {
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
Helpers_tool_reference_missing.replace(TOOL_TAG, upload)
Expand All @@ -280,7 +288,7 @@ private void ParseSection() {
VersionNumber refVersion = new VersionNumber(valueSplit[2]);
String actualValue = valueSplit[3];
this.myUploadTool = actualValue;
this.myReferencedUploadToolPlatformPath = PackageManager.getPlatformInstallPath(refVendor,
this.myReferencedUploadToolPlatformPath = BoardsManager.getPlatformInstallPath(refVendor,
refArchitecture, refVersion);
if (this.myReferencedUploadToolPlatformPath == null) {
Common.log(new Status(IStatus.ERROR, CORE_PLUGIN_ID,
Expand Down Expand Up @@ -668,7 +676,12 @@ public IPath getreferencedHardwarePath() {
*/
public IPath getArduinoPlatformPath() {
updateWhenDirty();
return PackageManager.getPlatformInstallPath(VendorArduino, getArchitecture());
ArduinoPlatform platform = BoardsManager.getPlatform(VendorArduino, getArchitecture());
if (platform == null) {
return null;
}
ArduinoPlatformVersion platformVersion = platform.getNewestInstalled();
return platformVersion.getInstallPath();
}

/**
Expand Down Expand Up @@ -892,8 +905,8 @@ private Map<String, String> getEnVarPlatformInfo() {
return new HashMap<>();
}

ArduinoPlatform referencingPlatform = PackageManager.getPlatform(referencingPlatformPath);
ArduinoPlatform referencedPlatform = PackageManager.getPlatform(referencedPlatformPath);
ArduinoPlatformVersion referencingPlatform = BoardsManager.getPlatform(referencingPlatformPath);
ArduinoPlatformVersion referencedPlatform = BoardsManager.getPlatform(referencedPlatformPath);

boolean jsonBasedPlatformManagement = !Preferences.getUseArduinoToolSelection();
if (jsonBasedPlatformManagement) {
Expand Down
Loading

0 comments on commit c5154a7

Please sign in to comment.