use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileArduinoIDEExamplesOnTeensyTest method BuildAndVerify.
public void BuildAndVerify(BoardDescriptor boardDescriptor) {
IProject theTestProject = null;
NullProgressMonitor monitor = new NullProgressMonitor();
String projectName = String.format("%05d_:%s_%s", new Integer(mCounter++), this.myName, boardDescriptor.getBoardID());
try {
theTestProject = boardDescriptor.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), this.myCodeDescriptor, new CompileOptions(null), monitor);
// for the indexer
Shared.waitForAllJobsToFinish();
} catch (Exception e) {
e.printStackTrace();
totalFails++;
fail("Failed to create the project:" + projectName);
return;
}
try {
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// try again because the libraries may not yet been added
// for the indexer
Shared.waitForAllJobsToFinish();
try {
// seen sometimes the libs were still not
Thread.sleep(3000);
// added
} catch (InterruptedException e) {
// ignore
}
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// give up
totalFails++;
fail("Failed to compile the project:" + projectName + " build errors");
} else {
theTestProject.delete(true, null);
}
} else {
theTestProject.delete(true, null);
}
} catch (CoreException e) {
e.printStackTrace();
totalFails++;
fail("Failed to compile the project:" + projectName + " exception");
}
}
use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileExamplesTest method BuildAndVerify.
public void BuildAndVerify(BoardDescriptor boardid, CodeDescriptor codeDescriptor) {
IProject theTestProject = null;
NullProgressMonitor monitor = new NullProgressMonitor();
String projectName = String.format("%05d_%s", new Integer(mCounter++), this.myName);
try {
theTestProject = boardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, new CompileOptions(null), monitor);
// for the indexer
Shared.waitForAllJobsToFinish();
} catch (Exception e) {
e.printStackTrace();
totalFails++;
fail("Failed to create the project:" + projectName);
return;
}
try {
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// try again because the libraries may not yet been added
// for the indexer
Shared.waitForAllJobsToFinish();
try {
// seen sometimes the libs were still not
Thread.sleep(3000);
// added
} catch (InterruptedException e) {
// ignore
}
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// give up
totalFails++;
fail("Failed to compile the project:" + projectName + " build errors");
} else {
theTestProject.delete(true, null);
}
} else {
theTestProject.delete(true, null);
}
} catch (CoreException e) {
e.printStackTrace();
totalFails++;
try {
theTestProject.close(null);
} catch (@SuppressWarnings("unused") CoreException e1) {
// fully ignore
}
fail("Failed to compile the project:" + projectName + " exception");
}
}
use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileJantjesBoardsTest method BuildAndVerify.
public void BuildAndVerify(BoardDescriptor boardDescriptor) {
IProject theTestProject = null;
NullProgressMonitor monitor = new NullProgressMonitor();
String projectName = String.format("%05d_:%s_%s", new Integer(mCounter++), this.myName, boardDescriptor.getBoardID());
try {
theTestProject = boardDescriptor.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), this.myCodeDescriptor, new CompileOptions(null), monitor);
// for the indexer
Shared.waitForAllJobsToFinish();
} catch (Exception e) {
e.printStackTrace();
totalFails++;
fail("Failed to create the project:" + projectName);
return;
}
try {
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// try again because the libraries may not yet been added
// for the indexer
Shared.waitForAllJobsToFinish();
try {
// seen sometimes the libs were still not
Thread.sleep(3000);
// added
} catch (InterruptedException e) {
// ignore
}
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// give up
totalFails++;
fail("Failed to compile the project:" + projectName + " build errors");
} else {
theTestProject.delete(true, null);
}
} else {
theTestProject.delete(true, null);
}
} catch (CoreException e) {
e.printStackTrace();
totalFails++;
fail("Failed to compile the project:" + projectName + " exception");
}
}
use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileLibraryExamplesTest method BuildAndVerify.
public void BuildAndVerify(BoardDescriptor boardid, CodeDescriptor codeDescriptor) {
IProject theTestProject = null;
NullProgressMonitor monitor = new NullProgressMonitor();
String projectName = String.format("%05d_%1.100s", new Integer(myCounter), myExample.getFQN());
try {
theTestProject = boardid.createProject(projectName, null, ConfigurationDescriptor.getDefaultDescriptors(), codeDescriptor, new CompileOptions(null), monitor);
// for the indexer
Shared.waitForAllJobsToFinish();
} catch (Exception e) {
e.printStackTrace();
myTotalFails++;
fail("Failed to create the project:" + projectName);
return;
}
try {
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// try again because the libraries may not yet been added
// for the indexer
Shared.waitForAllJobsToFinish();
try {
// seen sometimes the libs were still not
Thread.sleep(3000);
// added
} catch (InterruptedException e) {
// ignore
}
theTestProject.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
if (Shared.hasBuildErrors(theTestProject)) {
// give up
myTotalFails++;
theTestProject.close(null);
fail("Failed to compile the project:" + projectName + " build errors");
} else {
theTestProject.delete(true, null);
}
} else {
theTestProject.delete(true, null);
}
} catch (CoreException e) {
e.printStackTrace();
myTotalFails++;
fail("Failed to compile the project:" + projectName + " exception");
}
}
use of io.sloeber.core.api.CompileOptions 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