Search in sources :

Example 11 with BoardDescription

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

the class RegressionTest method rename_Configuration.

/**
 * Does Sloeber still compile after a configuration renamen
 *
 * @throws Exception
 */
@Test
public void rename_Configuration() throws Exception {
    BoardDescription unoBoardid = Arduino.uno().getBoardDescriptor();
    IProject theTestProject = null;
    String projectName = "rename_Configuration";
    CodeDescription codeDescriptor = CodeDescription.createDefaultIno();
    NullProgressMonitor monitor = new NullProgressMonitor();
    theTestProject = SloeberProject.createArduinoProject(projectName, null, unoBoardid, codeDescriptor, new CompileDescription(), new NullProgressMonitor());
    // for the indexer
    Shared.waitForAllJobsToFinish();
    theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
    if (Shared.hasBuildErrors(theTestProject)) {
        fail("Failed to compile the project before config rename");
    }
    CCorePlugin cCorePlugin = CCorePlugin.getDefault();
    ICProjectDescription prjCDesc = cCorePlugin.getProjectDescription(theTestProject);
    ICConfigurationDescription activeConfig = prjCDesc.getActiveConfiguration();
    activeConfig.setName("renamedConfig");
    cCorePlugin.setProjectDescription(theTestProject, prjCDesc);
    // for the indexer
    Shared.waitForAllJobsToFinish();
    theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
    if (Shared.hasBuildErrors(theTestProject)) {
        fail("Failed to compile the project after config rename");
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ICProjectDescription(org.eclipse.cdt.core.settings.model.ICProjectDescription) BoardDescription(io.sloeber.core.api.BoardDescription) CCorePlugin(org.eclipse.cdt.core.CCorePlugin) CodeDescription(io.sloeber.core.api.CodeDescription) CompileDescription(io.sloeber.core.api.CompileDescription) ICConfigurationDescription(org.eclipse.cdt.core.settings.model.ICConfigurationDescription) IProject(org.eclipse.core.resources.IProject) Test(org.junit.Test)

Example 12 with BoardDescription

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

the class RegressionTestFailingOnTravis method redirectedJson.

/**
 * Test wether a platform json redirect is handled properly
 * https://github.com/jantje/arduino-eclipse-plugin/issues/393
 */
@SuppressWarnings("static-method")
@Test
public void redirectedJson() {
    // this board references to arduino avr so install that one to
    Arduino.installLatestAVRBoards();
    BoardsManager.installLatestPlatform("package_talk2.wisen.com_index.json", "Talk2", "avr");
    Map<String, String> options = new HashMap<>();
    options.put("mhz", "16MHz");
    BoardDescription boardid = BoardsManager.getBoardDescription("package_talk2.wisen.com_index.json", "Talk2", "avr", "whispernode", options);
    if (boardid == null) {
        fail("redirect Json ");
        return;
    }
    if (!Shared.BuildAndVerify("redirect_json", boardid, CodeDescription.createDefaultIno(), new CompileDescription())) {
        fail(Shared.getLastFailMessage());
    }
}
Also used : BoardDescription(io.sloeber.core.api.BoardDescription) HashMap(java.util.HashMap) CompileDescription(io.sloeber.core.api.CompileDescription) Test(org.junit.Test)

Example 13 with BoardDescription

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

the class OpenSerialMonitorHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(// $NON-NLS-1$
        "io.sloeber.ui.monitor.views.SerialMonitor");
        // find all projects
        IProject[] SelectedProjects = ProjectExplorerListener.getSelectedProjects();
        // on
        if ((SelectedProjects.length > 0) && (MyPreferences.getOpenSerialWithMonitor() == true)) {
            for (IProject curproject : SelectedProjects) {
                int baud = Sketch.getCodeBaudRate(curproject);
                if (baud > 0) {
                    SloeberProject sProject = SloeberProject.getSloeberProject(curproject);
                    if (sProject != null) {
                        ICConfigurationDescription activeConf = CoreModel.getDefault().getProjectDescription(curproject).getActiveConfiguration();
                        BoardDescription boardDescription = sProject.getBoardDescription(activeConf.getName(), false);
                        String comPort = boardDescription.getUploadPort();
                        if (!comPort.isEmpty()) {
                            io.sloeber.ui.monitor.SerialConnection.add(comPort, baud);
                        }
                    }
                }
            }
        }
    } catch (PartInitException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : BoardDescription(io.sloeber.core.api.BoardDescription) SloeberProject(io.sloeber.core.api.SloeberProject) ICConfigurationDescription(org.eclipse.cdt.core.settings.model.ICConfigurationDescription) PartInitException(org.eclipse.ui.PartInitException) IProject(org.eclipse.core.resources.IProject)

Example 14 with BoardDescription

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

the class BoardSelectionPage method updateSloeber.

@Override
protected void updateSloeber(ICConfigurationDescription confDesc) {
    BoardDescription theObjectToStore = (BoardDescription) getDescription(confDesc);
    mySloeberProject.setBoardDescription(confDesc.getName(), theObjectToStore, true);
}
Also used : BoardDescription(io.sloeber.core.api.BoardDescription)

Example 15 with BoardDescription

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

the class BoardSelectionPage method getBoardFromScreen.

public BoardDescription getBoardFromScreen() {
    BoardDescription boardDesc = (BoardDescription) getDescription(getConfdesc());
    String selectedText = myControlBoardsTxtFile.getText().trim();
    boardDesc.setreferencingBoardsFile(myAllBoardsFiles.get(selectedText));
    boardDesc.setUploadPort(myControlUploadPort.getText());
    boardDesc.setProgrammer(myControlUploadProtocol.getText());
    boardDesc.setBoardName(mycontrolBoardName.getText());
    boardDesc.setOptions(getOptions(boardDesc));
    return boardDesc;
}
Also used : BoardDescription(io.sloeber.core.api.BoardDescription)

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