use of io.sloeber.core.api.CodeDescriptor in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method are_defines_before_includes_taken_into_account.
/**
* If a .ino file is including a include using extern C is this handled
* properly by the ino to cpp parser
* @throws Exception
*/
@SuppressWarnings("static-method")
@Test
public void are_defines_before_includes_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 = "externc";
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 + " extern \"C\" has not been taken into account properly.");
}
} catch (Exception e) {
e.printStackTrace();
fail("Failed to create the project:" + projectName);
return;
}
}
use of io.sloeber.core.api.CodeDescriptor 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
*/
@SuppressWarnings("static-method")
@Test
public void issue555() {
if (MySystem.getTeensyPlatform().isEmpty()) {
// do not fail as this will always fail on travis
return;
}
Map<String, String> unoOptions = new HashMap<>();
BoardDescriptor unoBoardid = PackageManager.getBoardDescriptor("package_index.json", "arduino", "Arduino AVR Boards", "uno", unoOptions);
Map<String, String> teensyOptions = new HashMap<>();
teensyOptions.put("usb", "serial");
teensyOptions.put("speed", "96");
teensyOptions.put("keys", "en-us");
BoardDescriptor teensyBoardid = PackageManager.getBoardDescriptor("local", MySystem.getTeensyBoard_txt(), "", "teensy31", teensyOptions);
IProject theTestProject = null;
CodeDescriptor codeDescriptor = CodeDescriptor.createDefaultIno();
String projectName = "issue555";
NullProgressMonitor monitor = new NullProgressMonitor();
try {
theTestProject = unoBoardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, new CompileOptions(null), 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 teensy build errors");
}
} catch (CoreException e) {
e.printStackTrace();
fail("Failed to compile the project:" + unoBoardid.getBoardName() + " as uno exception");
}
teensyBoardid.configureProject(theTestProject, monitor);
Shared.waitForAllJobsToFinish();
try {
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.CodeDescriptor in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileExamplesTest method examples.
@SuppressWarnings("rawtypes")
@Parameters(name = "{index}: {0}")
public static Collection examples() {
WaitForInstallerToFinish();
MCUBoard[] myBoards = { Arduino.leonardo(), Arduino.uno(), Arduino.esplora(), Adafruit.feather(), Arduino.adafruitnCirquitPlayground(), ESP8266.nodeMCU(), Arduino.primo(), Arduino.getMega2560Board(), Arduino.gemma(), Arduino.zero(), 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()));
CodeDescriptor codeDescriptor = CodeDescriptor.createExample(false, paths);
String fqn = curexample.getKey();
String libName = "";
if (examples.size() == 82) {
// use this for debugging based on the
// project number
// use this to put breakpoint
int a = 0;
a = a + 1;
}
try {
libName = fqn.split(" ")[0].trim();
} catch (Exception e) {
// ignore error
}
Examples example = new Examples(fqn, libName, curexample.getValue());
// with the current amount of examples only do one
BoardDescriptor curBoard = Examples.pickBestBoard(example, myBoards).getBoardDescriptor();
if (curBoard != null) {
Object[] theData = new Object[] { fqn.trim(), curBoard, codeDescriptor };
examples.add(theData);
}
}
return examples;
}
use of io.sloeber.core.api.CodeDescriptor in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileJantjesBoardsTest method examples.
@SuppressWarnings("rawtypes")
@Parameters(name = "{index}: {0}")
public static Collection examples() {
String[] packageUrlsToAdd = { "https://raw.githubusercontent.com/jantje/hardware/master/package_jantje_index.json" };
PackageManager.addPackageURLs(new HashSet<>(Arrays.asList(packageUrlsToAdd)), true);
PackageManager.installLatestPlatform(Jantje.getJsonFileName(), Jantje.getPackageName(), Jantje.getPlatformName());
Shared.waitForAllJobsToFinish();
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();
Examples example = new Examples(fqn, null, examplePath);
if (!skipExample(example)) {
ArrayList<IPath> paths = new ArrayList<>();
paths.add(examplePath);
CodeDescriptor codeDescriptor = CodeDescriptor.createExample(false, paths);
Object[] theData = new Object[] { "Example:" + fqn, codeDescriptor, example };
examples.add(theData);
}
}
return examples;
}
use of io.sloeber.core.api.CodeDescriptor in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method issue687.
/**
* support void loop{};
* @throws Exception
*/
@SuppressWarnings("static-method")
@Test
public void issue687() 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 = "issue687";
IPath templateFolder = Shared.getTemplateFolder(projectName);
CodeDescriptor codeDescriptor = CodeDescriptor.createCustomTemplate(templateFolder);
try {
theTestProject = unoBoardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, new CompileOptions(null), 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 + " issue687 is not fixed");
}
} catch (Exception e) {
e.printStackTrace();
fail("Failed to create the project:" + projectName);
return;
}
}
Aggregations