Search in sources :

Example 11 with CodeDescriptor

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

the class RegressionTest method is_extern_C_taken_into_account.

/**
 * If a .ino file is defining defines before including a include this should
 * be handled properly by the ino to cpp parser
 * @throws Exception
 */
@SuppressWarnings("static-method")
@Test
public void is_extern_C_taken_into_account() throws Exception {
    PackageManager.installLatestPlatform("package_index.json", "arduino", "Arduino AVR Boards");
    Map<String, String> unoOptions = new HashMap<>();
    BoardDescriptor unoBoardid = PackageManager.getBoardDescriptor("package_index.json", "arduino", "Arduino AVR Boards", "uno", unoOptions);
    IProject theTestProject = null;
    String projectName = "defines_and_includes";
    IPath templateFolder = Shared.getTemplateFolder(projectName);
    CodeDescriptor codeDescriptor = CodeDescriptor.createCustomTemplate(templateFolder);
    NullProgressMonitor monitor = new NullProgressMonitor();
    try {
        theTestProject = unoBoardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, new CompileOptions(null), monitor);
        // for the indexer
        Shared.waitForAllJobsToFinish();
        theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
        if (Shared.hasBuildErrors(theTestProject)) {
            fail("Failed to compile the project:" + projectName + " defines have not been taken into account properly.");
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed to create the project:" + projectName);
        return;
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IPath(org.eclipse.core.runtime.IPath) HashMap(java.util.HashMap) CompileOptions(io.sloeber.core.api.CompileOptions) BoardDescriptor(io.sloeber.core.api.BoardDescriptor) CodeDescriptor(io.sloeber.core.api.CodeDescriptor) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) Test(org.junit.Test)

Aggregations

CodeDescriptor (io.sloeber.core.api.CodeDescriptor)11 IPath (org.eclipse.core.runtime.IPath)9 BoardDescriptor (io.sloeber.core.api.BoardDescriptor)8 CoreException (org.eclipse.core.runtime.CoreException)7 CompileOptions (io.sloeber.core.api.CompileOptions)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 IProject (org.eclipse.core.resources.IProject)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 LinkedList (java.util.LinkedList)4 Map (java.util.Map)4 TreeMap (java.util.TreeMap)4 Parameters (org.junit.runners.Parameterized.Parameters)4 MCUBoard (io.sloeber.providers.MCUBoard)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ICProjectDescription (org.eclipse.cdt.core.settings.model.ICProjectDescription)1 IStatus (org.eclipse.core.runtime.IStatus)1 Path (org.eclipse.core.runtime.Path)1 Status (org.eclipse.core.runtime.Status)1