use of io.sloeber.core.api.CodeDescription in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method issue555.
/**
* make sure when switching between a board with variant file and without the
* build still succeeds
*/
@Test
public void issue555() {
if (MySystem.getTeensyPlatform().isEmpty()) {
// skip test due to no teensy install folder provided
// do not fail as this will always fail on travis
System.out.println("skipping the test because teensy is not installed.");
return;
}
System.out.println("Teensy is installed at " + MySystem.getTeensyPlatform());
BoardDescription unoBoardid = Arduino.uno().getBoardDescriptor();
BoardDescription teensyBoardid = Teensy.Teensy3_1().getBoardDescriptor();
IProject theTestProject = null;
CodeDescription codeDescriptor = CodeDescription.createDefaultIno();
String projectName = "issue555";
NullProgressMonitor monitor = new NullProgressMonitor();
try {
theTestProject = SloeberProject.createArduinoProject(projectName, null, unoBoardid, codeDescriptor, new CompileDescription(), monitor);
// for the indexer
Shared.waitForAllJobsToFinish();
} catch (Exception e) {
e.printStackTrace();
fail("Failed to create the project:" + projectName);
return;
}
try {
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
fail("Failed to compile the project:" + projectName + " as uno build errors");
}
} catch (CoreException e) {
e.printStackTrace();
fail("Failed to compile the project:" + unoBoardid.getBoardName() + " as uno exception");
}
SloeberProject arduinoProject = SloeberProject.getSloeberProject(theTestProject);
ICProjectDescription cProjectDescription = CCorePlugin.getDefault().getProjectDescription(theTestProject);
arduinoProject.setBoardDescription(cProjectDescription.getActiveConfiguration().getName(), teensyBoardid, true);
Shared.waitForAllJobsToFinish();
try {
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
Shared.waitForAllJobsToFinish();
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
fail("Failed to compile the project:" + projectName + " as teensy");
}
}
} catch (CoreException e) {
e.printStackTrace();
fail("Failed to compile the project:" + unoBoardid.getBoardName() + " as teensy exception");
}
}
use of io.sloeber.core.api.CodeDescription in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method are_defines_before_includes_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
*/
@Test
public void are_defines_before_includes_taken_into_account() throws Exception {
BoardDescription unoBoardid = Arduino.uno().getBoardDescriptor();
IProject theTestProject = null;
String projectName = "defines_and_includes";
IPath templateFolder = Shared.getTemplateFolder(projectName);
CodeDescription codeDescriptor = CodeDescription.createCustomTemplate(templateFolder);
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:" + projectName + " defines have not been taken into account properly.");
}
}
use of io.sloeber.core.api.CodeDescription 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");
}
}
use of io.sloeber.core.api.CodeDescription in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest method examples.
@SuppressWarnings("rawtypes")
@Parameters(name = " {0}")
public static Collection examples() {
Shared.waitForAllJobsToFinish();
Preferences.setUseBonjour(false);
LinkedList<Object[]> examples = new LinkedList<>();
List<MCUBoard> allBoards = Arduino.getAllBoards();
TreeMap<String, IPath> exampleFolders = LibraryManager.getAllArduinoIDEExamples();
for (Map.Entry<String, IPath> curexample : exampleFolders.entrySet()) {
String fqn = curexample.getKey().trim();
IPath examplePath = curexample.getValue();
Example example = new Example(fqn, examplePath);
if (!skipExample(example)) {
ArrayList<IPath> paths = new ArrayList<>();
paths.add(examplePath);
CodeDescription codeDescriptor = CodeDescription.createExample(false, paths);
for (MCUBoard curboard : allBoards) {
if (curboard.isExampleSupported(example)) {
String projectName = Shared.getProjectName(codeDescriptor, example, curboard);
Object[] theData = new Object[] { projectName, codeDescriptor, curboard };
examples.add(theData);
}
}
}
}
return examples;
}
use of io.sloeber.core.api.CodeDescription in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileArduinoIDEExamplesonJantjesBoardsTest method examples.
@SuppressWarnings("rawtypes")
@Parameters(name = "{0}")
public static Collection examples() {
Preferences.setUseBonjour(false);
String[] packageUrlsToAdd = { Jantje.additionalJsonURL };
BoardsManager.addPackageURLs(new HashSet<>(Arrays.asList(packageUrlsToAdd)), true);
Jantje.installLatestLocalDebugBoards();
Shared.waitForAllJobsToFinish();
List<MCUBoard> allBoards = Jantje.getAllBoards();
LinkedList<Object[]> examples = new LinkedList<>();
TreeMap<String, IPath> exampleFolders = LibraryManager.getAllArduinoIDEExamples();
for (Map.Entry<String, IPath> curexample : exampleFolders.entrySet()) {
String fqn = curexample.getKey().trim();
IPath examplePath = curexample.getValue();
Example example = new Example(fqn, examplePath);
if (!skipExample(example)) {
ArrayList<IPath> paths = new ArrayList<>();
paths.add(examplePath);
CodeDescription codeDescriptor = CodeDescription.createExample(false, paths);
for (MCUBoard curboard : allBoards) {
if (curboard.isExampleSupported(example)) {
Object[] theData = new Object[] { Shared.getCounterName(codeDescriptor.getExampleName()), codeDescriptor, curboard.getBoardDescriptor() };
examples.add(theData);
}
}
}
}
return examples;
}
Aggregations