Search in sources :

Example 26 with BoardDescription

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

the class RegressionTest method create_CPP_based_Sloeber_Project.

@Test
public void create_CPP_based_Sloeber_Project() throws Exception {
    BoardDescription unoBoardid = Arduino.uno().getBoardDescriptor();
    IProject theTestProject = null;
    String projectName = "createCPPProject";
    CodeDescription codeDescriptor = CodeDescription.createDefaultCPP();
    try {
        theTestProject = SloeberProject.createArduinoProject(projectName, null, unoBoardid, codeDescriptor, new CompileDescription(), new NullProgressMonitor());
        // for the indexer
        Shared.waitForAllJobsToFinish();
        theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
        if (Shared.hasBuildErrors(theTestProject)) {
            fail("Failed to compile the project:" + projectName + " CPP project no longer work");
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed to create the project:" + projectName);
        return;
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) BoardDescription(io.sloeber.core.api.BoardDescription) CodeDescription(io.sloeber.core.api.CodeDescription) CompileDescription(io.sloeber.core.api.CompileDescription) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) Test(org.junit.Test)

Example 27 with BoardDescription

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

the class RegressionTest method closeProjectRemovesPropertiesSloeber.

@Test
public void closeProjectRemovesPropertiesSloeber() throws Exception {
    String DummyData = "a object";
    String projectName = "closeProjectRemovesPropertiesSloeber";
    QualifiedName qualifiedName = new QualifiedName("io.sloebertest", projectName);
    BoardDescription unoBoardid = Arduino.uno().getBoardDescriptor();
    CodeDescription codeDescriptor = new CodeDescription(CodeDescription.CodeTypes.defaultCPP);
    CompileDescription inCompileDescription = getBunkersCompileDescription();
    IProject project = SloeberProject.createArduinoProject(projectName, null, unoBoardid, codeDescriptor, inCompileDescription, new NullProgressMonitor());
    // Read the data we want to test
    // for the indexer
    Shared.waitForAllJobsToFinish();
    // project.open(null);
    project.setSessionProperty(qualifiedName, DummyData);
    project.close(null);
    project.open(null);
    Object projData = project.getSessionProperty(qualifiedName);
    if (projData != null) {
        fail("non persistent projectdescription properties behave persistent during project close open in Sloeber");
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) BoardDescription(io.sloeber.core.api.BoardDescription) CodeDescription(io.sloeber.core.api.CodeDescription) QualifiedName(org.eclipse.core.runtime.QualifiedName) CompileDescription(io.sloeber.core.api.CompileDescription) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 28 with BoardDescription

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

the class CreateAndCompileExamplesTest method examples.

@SuppressWarnings("rawtypes")
@Parameters(name = "{0}")
public static Collection examples() {
    WaitForInstallerToFinish();
    Preferences.setUseBonjour(false);
    MCUBoard[] myBoards = { Arduino.leonardo(), Arduino.uno(), Arduino.esplora(), Adafruit.feather(), Arduino.adafruitnCirquitPlayground(), ESP8266.nodeMCU(), Arduino.primo(), Arduino.mega2560Board(), Arduino.gemma(), Arduino.zeroProgrammingPort(), Arduino.mkrfox1200(), Arduino.due() };
    LinkedList<Object[]> examples = new LinkedList<>();
    TreeMap<String, IPath> exampleFolders = LibraryManager.getAllLibraryExamples();
    for (Map.Entry<String, IPath> curexample : exampleFolders.entrySet()) {
        ArrayList<IPath> paths = new ArrayList<>();
        paths.add(new Path(curexample.getValue().toString()));
        CodeDescription codeDescriptor = CodeDescription.createExample(false, paths);
        String fqn = curexample.getKey();
        Example example = new Example(fqn, curexample.getValue());
        // with the current amount of examples only do one
        MCUBoard board = Example.pickBestBoard(example, myBoards);
        if (board != null) {
            BoardDescription curBoard = board.getBoardDescriptor();
            if (curBoard != null) {
                Object[] theData = new Object[] { Shared.getCounterName(fqn.trim()), curBoard, codeDescriptor };
                examples.add(theData);
            }
        }
    }
    return examples;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) BoardDescription(io.sloeber.core.api.BoardDescription) CodeDescription(io.sloeber.core.api.CodeDescription) MCUBoard(io.sloeber.providers.MCUBoard) Map(java.util.Map) TreeMap(java.util.TreeMap) Parameters(org.junit.runners.Parameterized.Parameters)

Example 29 with BoardDescription

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

the class Arduino method getAllmBedBoardNames.

private static List<String> getAllmBedBoardNames() {
    List<String> ret = new LinkedList<>();
    ArduinoPackage arduinoPkg = BoardsManager.getPackageByProvider(providerArduino);
    for (ArduinoPlatform curPlatform : arduinoPkg.getPlatforms()) {
        if (curPlatform.getArchitecture().equals(MBEDArchitectureName)) {
            ArduinoPlatformVersion curPlatformVersion = curPlatform.getNewestInstalled();
            if (curPlatformVersion != null) {
                List<BoardDescription> boardDescriptions = BoardDescription.makeBoardDescriptors(curPlatformVersion.getBoardsFile());
                for (BoardDescription curBoardDesc : boardDescriptions) {
                    ret.add(curBoardDesc.getBoardName());
                }
            }
        }
    }
    return ret;
}
Also used : ArduinoPlatformVersion(io.sloeber.core.api.Json.ArduinoPlatformVersion) BoardDescription(io.sloeber.core.api.BoardDescription) ArduinoPlatform(io.sloeber.core.api.Json.ArduinoPlatform) ArduinoPackage(io.sloeber.core.api.Json.ArduinoPackage) LinkedList(java.util.LinkedList)

Example 30 with BoardDescription

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

the class MCUBoard method getAllBoards.

public static List<MCUBoard> getAllBoards(String provider, MCUBoard creator) {
    List<MCUBoard> ret = new LinkedList<>();
    ArduinoPackage arduinoPkg = BoardsManager.getPackageByProvider(provider);
    for (ArduinoPlatform curPlatform : arduinoPkg.getPlatforms()) {
        ArduinoPlatformVersion curPlatformVersion = curPlatform.getNewestInstalled();
        if (curPlatformVersion != null) {
            List<BoardDescription> boardDescriptions = BoardDescription.makeBoardDescriptors(curPlatformVersion.getBoardsFile());
            for (BoardDescription curBoardDesc : boardDescriptions) {
                ret.add(creator.createMCUBoard(curBoardDesc));
            }
        }
    }
    return ret;
}
Also used : ArduinoPlatformVersion(io.sloeber.core.api.Json.ArduinoPlatformVersion) BoardDescription(io.sloeber.core.api.BoardDescription) ArduinoPlatform(io.sloeber.core.api.Json.ArduinoPlatform) ArduinoPackage(io.sloeber.core.api.Json.ArduinoPackage) LinkedList(java.util.LinkedList)

Aggregations

BoardDescription (io.sloeber.core.api.BoardDescription)30 CodeDescription (io.sloeber.core.api.CodeDescription)16 Test (org.junit.Test)15 CompileDescription (io.sloeber.core.api.CompileDescription)13 IProject (org.eclipse.core.resources.IProject)13 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)12 IPath (org.eclipse.core.runtime.IPath)10 CoreException (org.eclipse.core.runtime.CoreException)7 SloeberProject (io.sloeber.core.api.SloeberProject)6 ArrayList (java.util.ArrayList)5 LinkedList (java.util.LinkedList)4 ICConfigurationDescription (org.eclipse.cdt.core.settings.model.ICConfigurationDescription)4 ICProjectDescription (org.eclipse.cdt.core.settings.model.ICProjectDescription)4 File (java.io.File)3 Parameters (org.junit.runners.Parameterized.Parameters)3 ArduinoPackage (io.sloeber.core.api.Json.ArduinoPackage)2 ArduinoPlatform (io.sloeber.core.api.Json.ArduinoPlatform)2 ArduinoPlatformVersion (io.sloeber.core.api.Json.ArduinoPlatformVersion)2 MCUBoard (io.sloeber.providers.MCUBoard)2 URL (java.net.URL)2