Search in sources :

Example 16 with CompileOptions

use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.

the class RegressionTest method is_extern_C_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
 */
@SuppressWarnings("static-method")
@Test
public void is_extern_C_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 = "defines_and_includes";
    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 + " defines have not been taken into account properly.");
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed to create the project:" + projectName);
        return;
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IPath(org.eclipse.core.runtime.IPath) HashMap(java.util.HashMap) CompileOptions(io.sloeber.core.api.CompileOptions) BoardDescriptor(io.sloeber.core.api.BoardDescriptor) CodeDescriptor(io.sloeber.core.api.CodeDescriptor) IProject(org.eclipse.core.resources.IProject) CoreException(org.eclipse.core.runtime.CoreException) Test(org.junit.Test)

Example 17 with CompileOptions

use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.

the class CompileProperties method createControls.

@Override
public void createControls(Composite parent, ICPropertyProvider provider) {
    super.createControls(parent, provider);
    this.myCompileOptions = new CompileOptions(getConfdesc());
    GridLayout theGridLayout = new GridLayout();
    theGridLayout.numColumns = 2;
    this.usercomp.setLayout(theGridLayout);
    // checkbox show all warnings => Set WARNING_LEVEL=wall else
    // WARNING_LEVEL=$ARDUINO_WARNING_LEVEL
    this.myWarningLevel = new Button(this.usercomp, SWT.CHECK);
    this.myWarningLevel.setText(Messages.ui_show_all_warnings);
    this.myWarningLevel.setEnabled(true);
    this.myWarningLevel.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
    // checkbox show alternative size
    this.mySizeCommand = new Button(this.usercomp, SWT.CHECK);
    this.mySizeCommand.setText(Messages.ui_Alternative_size);
    this.mySizeCommand.setEnabled(true);
    this.mySizeCommand.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
    ;
    createLine(this.usercomp, 2);
    this.myCAndCppCommand = makeOptionField(Messages.ui_Apend_c_cpp, Messages.ui_append_c_cpp_text);
    this.myCppCommand = makeOptionField(Messages.ui_append_cpp, Messages.ui_append_cpp_text);
    this.myCCommand = makeOptionField(Messages.ui_append_c, Messages.ui_append_c_text);
    this.myAssemblyCommand = makeOptionField(Messages.ui_Apend_assembly, Messages.ui_append_assembly_text);
    this.myArchiveCommand = makeOptionField(Messages.ui_Apend_archive, Messages.ui_append_archive_text);
    this.myLinkCommand = makeOptionField(Messages.ui_Apend_link, Messages.ui_append_link_text);
    this.myAllCommand = makeOptionField(Messages.ui_Apend_all, Messages.ui_append_all_text);
    theGridLayout = new GridLayout();
    theGridLayout.numColumns = 2;
    this.usercomp.setLayout(theGridLayout);
    updateScreenData();
    setVisible(true);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) CompileOptions(io.sloeber.core.api.CompileOptions)

Example 18 with CompileOptions

use of io.sloeber.core.api.CompileOptions in project arduino-eclipse-plugin by Sloeber.

the class CompileProperties method performDefaults.

@Override
protected void performDefaults() {
    this.myCompileOptions = new CompileOptions(null);
    updateScreenData();
}
Also used : CompileOptions(io.sloeber.core.api.CompileOptions)

Aggregations

CompileOptions (io.sloeber.core.api.CompileOptions)18 CoreException (org.eclipse.core.runtime.CoreException)14 IProject (org.eclipse.core.resources.IProject)11 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)11 BoardDescriptor (io.sloeber.core.api.BoardDescriptor)6 CodeDescriptor (io.sloeber.core.api.CodeDescriptor)6 Test (org.junit.Test)6 HashMap (java.util.HashMap)5 IPath (org.eclipse.core.runtime.IPath)5 IOException (java.io.IOException)2 ICProjectDescription (org.eclipse.cdt.core.settings.model.ICProjectDescription)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 FileNotFoundException (java.io.FileNotFoundException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 IEnvironmentVariable (org.eclipse.cdt.core.envvar.IEnvironmentVariable)1 IEnvironmentVariableManager (org.eclipse.cdt.core.envvar.IEnvironmentVariableManager)1 ICConfigurationDescription (org.eclipse.cdt.core.settings.model.ICConfigurationDescription)1