Search in sources :

Example 6 with CompilerOptions

use of org.erlide.core.builder.CompilerOptions in project erlide_eclipse by erlang.

the class CompileAction method run.

@Override
public void run() {
    final AbstractErlangEditor editor = (AbstractErlangEditor) getSite().getPage().getActiveEditor();
    final IErlModule module = editor.getModule();
    if (module == null) {
        return;
    }
    final IResource resource = module.getResource();
    final IProject project = resource.getProject();
    if (project == null) {
        return;
    }
    final IErlProject eproject = ErlangEngine.getInstance().getModelUtilService().getProject(module);
    if (eproject == null) {
        return;
    }
    final IOtpRpc b = BackendCore.getBuildBackend(eproject);
    final BuildResource bres = new BuildResource(resource);
    final CompilerOptions prefs = new CompilerOptions(project);
    prefs.load();
    final OtpErlangList compilerOptions = prefs.export();
    final IErlProject erlProject = ErlangEngine.getInstance().getModel().getErlangProject(project);
    if ("erl".equals(resource.getFileExtension())) {
        helper.compileErl(project, bres, erlProject.getProperties().getOutputDir().toString(), b, compilerOptions);
    }
    if ("yrl".equals(resource.getFileExtension())) {
        helper.compileYrl(project, bres, b, compilerOptions);
    }
    final ErlEditorActionBarContributor status = (ErlEditorActionBarContributor) editor.getEditorSite().getActionBarContributor();
    status.displayMessage(String.format("File '%s' was compiled.", resource.getName()));
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) IErlModule(org.erlide.engine.model.root.IErlModule) CompilerOptions(org.erlide.core.builder.CompilerOptions) ErlEditorActionBarContributor(org.erlide.ui.editors.erl.ErlEditorActionBarContributor) IResource(org.eclipse.core.resources.IResource) IProject(org.eclipse.core.resources.IProject) BuildResource(org.erlide.core.builder.BuildResource) AbstractErlangEditor(org.erlide.ui.editors.erl.AbstractErlangEditor) IOtpRpc(org.erlide.runtime.rpc.IOtpRpc)

Example 7 with CompilerOptions

use of org.erlide.core.builder.CompilerOptions in project erlide_eclipse by erlang.

the class CompilerOptionsTest method test_8.

@Test
public void test_8() {
    final CompilerOptions prefs = new CompilerOptions();
    prefs.setBooleanOption(CompilerOptions.WARN_EXPORT_ALL, true);
    final String actual = prefs.export().toString();
    final String expect = "[" + CompilerOptionsTest.DEF_VALUES.substring(2) + "]";
    Assert.assertEquals(expect, actual);
}
Also used : CompilerOptions(org.erlide.core.builder.CompilerOptions) Test(org.junit.Test)

Example 8 with CompilerOptions

use of org.erlide.core.builder.CompilerOptions in project erlide_eclipse by erlang.

the class CompilerOptionsTest method test_10.

@Test
public void test_10() {
    final CompilerOptions prefs = new CompilerOptions();
    prefs.setPathOption(CompilerOptions.INCLUDE_DIRS, parseIncludes(""));
    final String actual = prefs.export().toString();
    final String expect = "[" + CompilerOptionsTest.DEF_VALUES + "]";
    Assert.assertEquals(expect, actual);
}
Also used : CompilerOptions(org.erlide.core.builder.CompilerOptions) Test(org.junit.Test)

Example 9 with CompilerOptions

use of org.erlide.core.builder.CompilerOptions in project erlide_eclipse by erlang.

the class CompilerOptionsTest method test_0.

@Test
public void test_0() {
    final CompilerOptions prefs = new CompilerOptions();
    final String actual = prefs.export().toString();
    final String expect = "[" + CompilerOptionsTest.DEF_VALUES + "]";
    Assert.assertEquals(expect, actual);
}
Also used : CompilerOptions(org.erlide.core.builder.CompilerOptions) Test(org.junit.Test)

Example 10 with CompilerOptions

use of org.erlide.core.builder.CompilerOptions in project erlide_eclipse by erlang.

the class CompilerOptionsTest method test_11.

@Test
public void test_11() {
    final CompilerOptions prefs = new CompilerOptions();
    prefs.setPathOption(CompilerOptions.INCLUDE_DIRS, parseIncludes("/tmp/x"));
    final String actual = prefs.export().toString();
    final String expect = "[{i,\"/tmp/x\"}," + CompilerOptionsTest.DEF_VALUES + "]";
    Assert.assertEquals(expect, actual);
}
Also used : CompilerOptions(org.erlide.core.builder.CompilerOptions) Test(org.junit.Test)

Aggregations

CompilerOptions (org.erlide.core.builder.CompilerOptions)16 Test (org.junit.Test)13 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)1 IProject (org.eclipse.core.resources.IProject)1 IResource (org.eclipse.core.resources.IResource)1 BuildResource (org.erlide.core.builder.BuildResource)1 IErlModule (org.erlide.engine.model.root.IErlModule)1 IErlProject (org.erlide.engine.model.root.IErlProject)1 IOtpRpc (org.erlide.runtime.rpc.IOtpRpc)1 AbstractErlangEditor (org.erlide.ui.editors.erl.AbstractErlangEditor)1 ErlEditorActionBarContributor (org.erlide.ui.editors.erl.ErlEditorActionBarContributor)1