Search in sources :

Example 1 with ArduinoPlatformVersion

use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.

the class BoardDescription method getEnVarPlatformInfo.

private Map<String, String> getEnVarPlatformInfo() {
    Map<String, String> ret = new HashMap<>();
    if (myReferencedPlatformUpload != null) {
        ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformUpload));
    }
    if (myReferencedPlatformVariant != null) {
        ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformVariant));
    }
    if (myReferencedPlatformCore != null) {
        ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformCore));
    }
    IPath referencingPlatformPath = getreferencingPlatformPath();
    ArduinoPlatformVersion referencingPlatform = BoardsManager.getPlatform(referencingPlatformPath);
    if (referencingPlatform == null) {
        // there is no need to specify tool path as they do not use them
        return ret;
    }
    ArduinoPlatformVersion latestArduinoPlatform = BoardsManager.getNewestInstalledPlatform(Const.ARDUINO, referencingPlatform.getArchitecture());
    if (latestArduinoPlatform != null) {
        ret.putAll(getEnvVarPlatformFileTools(latestArduinoPlatform));
    }
    if (myReferencedPlatformCore == null) {
        // there is no referenced core so no need to do smart stuff
        ret.putAll(getEnvVarPlatformFileTools(referencingPlatform));
        return ret;
    }
    boolean jsonBasedPlatformManagement = !Preferences.getUseArduinoToolSelection();
    if (jsonBasedPlatformManagement) {
        // overrule the Arduino IDE way of working and use the json refereced tools
        ret.putAll(getEnvVarPlatformFileTools(referencingPlatform));
        return ret;
    }
    // standard arduino IDE way
    ret.putAll(getEnvVarPlatformFileTools(referencingPlatform));
    ret.putAll(getEnvVarPlatformFileTools(myReferencedPlatformCore));
    return ret;
}
Also used : ArduinoPlatformVersion(io.sloeber.core.api.Json.ArduinoPlatformVersion) IPath(org.eclipse.core.runtime.IPath) HashMap(java.util.HashMap)

Example 2 with ArduinoPlatformVersion

use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.

the class BoardDescription method getArduinoPlatformPath.

/*
     * get the latest installed arduino platform with the same architecture. This is
     * the platform to use the programmers.txt if no other programmers.txt are
     * found.
     */
public IPath getArduinoPlatformPath() {
    updateWhenDirty();
    ArduinoPlatform platform = BoardsManager.getPlatform(VendorArduino, getArchitecture());
    if (platform == null) {
        return null;
    }
    ArduinoPlatformVersion platformVersion = platform.getNewestInstalled();
    if (platformVersion == null) {
        return null;
    }
    return platformVersion.getInstallPath();
}
Also used : ArduinoPlatformVersion(io.sloeber.core.api.Json.ArduinoPlatformVersion) ArduinoPlatform(io.sloeber.core.api.Json.ArduinoPlatform)

Example 3 with ArduinoPlatformVersion

use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.

the class BoardsManager method getEnvironmentVariables.

/**
 * If something has been installed or deinstalled update the global variables
 * with references to the installed stuff this to support platforms that do not
 * explicitly define tools or platform dependencies Like private hardware
 */
public static Map<String, String> getEnvironmentVariables() {
    if (!envVarsNeedUpdating) {
        return myWorkbenchEnvironmentVariables;
    }
    myWorkbenchEnvironmentVariables.clear();
    ArduinoPlatformVersion latestAvrPlatform = getNewestInstalledPlatform(Const.ARDUINO, Const.AVR);
    ArduinoPlatformVersion latestSamdPlatform = getNewestInstalledPlatform(Const.ARDUINO, Const.SAMD);
    ArduinoPlatformVersion latestSamPlatform = getNewestInstalledPlatform(Const.ARDUINO, Const.SAM);
    if (latestSamdPlatform != null) {
        myWorkbenchEnvironmentVariables.putAll(getEnvVarPlatformFileTools(latestSamdPlatform));
    }
    if (latestSamPlatform != null) {
        myWorkbenchEnvironmentVariables.putAll(getEnvVarPlatformFileTools(latestSamPlatform));
    }
    if (latestAvrPlatform != null) {
        myWorkbenchEnvironmentVariables.putAll(getEnvVarPlatformFileTools(latestAvrPlatform));
    }
    envVarsNeedUpdating = false;
    return myWorkbenchEnvironmentVariables;
}
Also used : ArduinoPlatformVersion(io.sloeber.core.api.Json.ArduinoPlatformVersion)

Example 4 with ArduinoPlatformVersion

use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.

the class PlatformSelectionPage method updateInstallation.

protected IStatus updateInstallation(IProgressMonitor monitor) {
    List<ArduinoPlatformVersion> platformsToInstall = new LinkedList<>();
    List<ArduinoPlatformVersion> platformsToRemove = new LinkedList<>();
    for (TreeMap<String, TreeMap<String, InstallableVersion[]>> packageIndex : myShownPlatforms.values()) {
        for (TreeMap<String, InstallableVersion[]> arduinoPackage : packageIndex.values()) {
            for (InstallableVersion[] versions : arduinoPackage.values()) {
                for (InstallableVersion version : versions) {
                    if (version.isInstalled() != version.mustBeInstalled()) {
                        if (version.mustBeInstalled()) {
                            platformsToInstall.add(version.getPlatform());
                        } else {
                            platformsToRemove.add(version.getPlatform());
                        }
                    }
                }
            }
        }
    }
    MultiStatus status = new MultiStatus(PLUGIN_ID, 0, Messages.ui_installing_platforms, null);
    BoardsManager.updatePlatforms(platformsToInstall, platformsToRemove, monitor, status);
    return status;
}
Also used : ArduinoPlatformVersion(io.sloeber.core.api.Json.ArduinoPlatformVersion) MultiStatus(org.eclipse.core.runtime.MultiStatus) TreeMap(java.util.TreeMap) LinkedList(java.util.LinkedList)

Example 5 with ArduinoPlatformVersion

use of io.sloeber.core.api.Json.ArduinoPlatformVersion in project arduino-eclipse-plugin by Sloeber.

the class BoardsManager method getNewestBoardIDFromBoardsManager.

private static BoardDescription getNewestBoardIDFromBoardsManager(String jsonFileName, String packageName, String architectureName, String boardID, Map<String, String> options) {
    ArduinoPackage thePackage = getPackage(jsonFileName, packageName);
    if (thePackage == null) {
        // fail("failed to find package:" + this.mPackageName);
        return null;
    }
    ArduinoPlatform platform = thePackage.getPlatform(architectureName);
    if (platform == null) {
        // package:" + this.mPackageName);
        return null;
    }
    ArduinoPlatformVersion platformVersion = platform.getNewestVersion();
    java.io.File boardsFile = platformVersion.getBoardsFile();
    BoardDescription boardid = new BoardDescription(boardsFile, boardID, options);
    return boardid;
}
Also used : ArduinoPlatformVersion(io.sloeber.core.api.Json.ArduinoPlatformVersion) ArduinoPlatform(io.sloeber.core.api.Json.ArduinoPlatform) ArduinoPackage(io.sloeber.core.api.Json.ArduinoPackage) File(java.io.File)

Aggregations

ArduinoPlatformVersion (io.sloeber.core.api.Json.ArduinoPlatformVersion)10 ArduinoPlatform (io.sloeber.core.api.Json.ArduinoPlatform)6 ArduinoPackage (io.sloeber.core.api.Json.ArduinoPackage)5 LinkedList (java.util.LinkedList)3 MultiStatus (org.eclipse.core.runtime.MultiStatus)3 BoardDescription (io.sloeber.core.api.BoardDescription)2 MyMultiStatus (io.sloeber.core.tools.MyMultiStatus)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 ArduinoPlatformPackageIndex (io.sloeber.core.api.Json.ArduinoPlatformPackageIndex)1 File (java.io.File)1 HashMap (java.util.HashMap)1 TreeMap (java.util.TreeMap)1 IPath (org.eclipse.core.runtime.IPath)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 CellLabelProvider (org.eclipse.jface.viewers.CellLabelProvider)1 CheckStateChangedEvent (org.eclipse.jface.viewers.CheckStateChangedEvent)1 CheckboxTreeViewer (org.eclipse.jface.viewers.CheckboxTreeViewer)1