use of io.sloeber.core.api.CodeDescriptor in project arduino-eclipse-plugin by Sloeber.
the class NewSketchWizard method createProjectWrapper.
protected void createProjectWrapper(IProgressMonitor monitor) {
BoardDescriptor boardID = this.mArduinoPage.getBoardID();
CodeDescriptor codeDescription = this.mNewArduinoSketchWizardCodeSelectionPage.getCodeDescription();
try {
this.mProject = boardID.createProject(this.mWizardPage.getProjectName(), (!this.mWizardPage.useDefaults()) ? this.mWizardPage.getLocationURI() : null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescription, new CompileOptions(null), monitor);
} catch (Exception e) {
this.mProject = null;
Activator.log(new Status(IStatus.ERROR, Activator.getId(), Messages.ui_new_sketch_error_failed_to_create_project, e));
}
}
use of io.sloeber.core.api.CodeDescriptor in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest method examples.
@SuppressWarnings("rawtypes")
@Parameters(name = "{index}: {0}")
public static Collection examples() {
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 CreateAndCompileArduinoIDEExamplesOnTeensyTest method examples.
@SuppressWarnings("rawtypes")
@Parameters(name = "{index}: {0}")
public static Collection examples() {
installAdditionalBoards();
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 CreateAndCompileLibraryExamplesTest method testExamples.
@Test
public void testExamples() {
if (myTotalFails > maxFails) {
// failing is annoying when doing fixing
return;
}
if (skipAtStart >= myCounter++) {
// skip these
return;
}
if (!myBoardID.isExampleSupported(myExample)) {
fail("Trying to run a test on unsoprted board");
return;
}
ArrayList<IPath> paths = new ArrayList<>();
paths.add(myExample.getPath());
CodeDescriptor codeDescriptor = CodeDescriptor.createExample(false, paths);
Map<String, String> boardOptions = myBoardID.getBoardOptions(myExample);
BoardDescriptor boardDescriptor = myBoardID.getBoardDescriptor();
boardDescriptor.setOptions(boardOptions);
BuildAndVerify(myBoardID.getBoardDescriptor(), codeDescriptor);
}
use of io.sloeber.core.api.CodeDescriptor in project arduino-eclipse-plugin by Sloeber.
the class RegressionTest method are_jantjes_options_taken_into_account.
/**
* This test will fail if the arduino compile option are not taken into
* account To do sa a bunch of defines are added to the command line and the
* code checks whether these defines are set properly
* @throws Exception
*/
@SuppressWarnings("static-method")
@Test
public void are_jantjes_options_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 = "are_defines_found";
IPath templateFolder = Shared.getTemplateFolder(projectName);
CodeDescriptor codeDescriptor = CodeDescriptor.createCustomTemplate(templateFolder);
NullProgressMonitor monitor = new NullProgressMonitor();
try {
CompileOptions compileOptions = new CompileOptions(null);
compileOptions.set_C_andCPP_CompileOptions("-DTEST_C_CPP");
compileOptions.set_C_CompileOptions("-DTEST_C");
compileOptions.set_CPP_CompileOptions("-DTEST_CPP");
theTestProject = unoBoardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, compileOptions, monitor);
ICProjectDescription prjCDesc = CoreModel.getDefault().getProjectDescription(theTestProject);
CoreModel.getDefault().getProjectDescriptionManager().setProjectDescription(theTestProject, prjCDesc, true, null);
// for the indexer
Shared.waitForAllJobsToFinish();
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
fail("Failed to compile the project:" + projectName + " The defines have not been taken into account properly");
}
} catch (Exception e) {
e.printStackTrace();
fail("Failed to create the project:" + projectName);
return;
}
}
Aggregations