use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class ArduinoLanguageProvider method getCompilerCommand.
@Override
protected String getCompilerCommand(String languageId) {
String compilerCommand = new String();
ICProjectDescription prjDesc = CoreModel.getDefault().getProjectDescription(this.currentProject);
if (prjDesc == null)
return compilerCommand;
IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
ICConfigurationDescription confDesc = prjDesc.getActiveConfiguration();
String recipeKey = new String();
String extraOptions = new String();
CompileOptions compileOptions = new CompileOptions(confDesc);
if (languageId.equals("org.eclipse.cdt.core.gcc")) {
recipeKey = Common.get_ENV_KEY_RECIPE(Const.ACTION_C_to_O);
extraOptions = compileOptions.get_C_CompileOptions();
} else if (languageId.equals("org.eclipse.cdt.core.g++")) {
recipeKey = Common.get_ENV_KEY_RECIPE(Const.ACTION_CPP_to_O);
extraOptions = compileOptions.get_CPP_CompileOptions();
} else {
ManagedBuilderCorePlugin.error("Unable to find compiler command for language " + languageId + " in toolchain=" + getToolchainId());
}
extraOptions = extraOptions + " " + compileOptions.get_C_andCPP_CompileOptions() + " " + compileOptions.get_All_CompileOptions();
try {
compilerCommand = envManager.getVariable(recipeKey + Const.DOT + "1", confDesc, false).getValue();
compilerCommand = compilerCommand + envManager.getVariable(recipeKey + Const.DOT + "2", confDesc, false).getValue();
compilerCommand = compilerCommand + envManager.getVariable(recipeKey + Const.DOT + "3", confDesc, false).getValue();
} catch (Exception e) {
compilerCommand = new String();
}
compilerCommand = compilerCommand + ' ' + extraOptions;
return compilerCommand.replaceAll(" -o ", " ");
}
use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class CompileProperties method updateData.
@Override
protected void updateData(ICResourceDescription cfg) {
this.myCompileOptions = new CompileOptions(getConfdesc());
updateScreenData();
}
use of io.sloeber.core.api.CompileOptions 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.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class CompileAndUpload method testExamples.
@Test
public void testExamples() {
IPath templateFolder = Shared.getTemplateFolder("fastBlink");
CompileOptions compileOptions = new CompileOptions(null);
compileOptions.set_C_andCPP_CompileOptions("-DINTERVAL=" + interval);
Build_Verify_upload(CodeDescriptor.createCustomTemplate(templateFolder), compileOptions);
}
use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.
the class CreateAndCompileArduinoIDEExamplesOnAVRHardwareTest 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");
}
}
Aggregations