Search in sources :

Example 1 with ErlangProjectProperties

use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.

the class ErlideTestUtils method createErlProject.

public static IErlProject createErlProject(final IProject project) throws CoreException {
    final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    final IErlProject erlProject = ErlangEngine.getInstance().getModel().findProject(project);
    erlProject.getBuilderProperties().setBuilderTool(BuilderTool.INTERNAL);
    final ErlangProjectProperties prefs = erlProject.getProperties();
    final List<IPath> srcDirs = new ArrayList<>();
    srcDirs.add(new Path("src"));
    prefs.setSourceDirs(srcDirs);
    ErlideTestUtils.buildPaths(root, project, srcDirs);
    final List<IPath> includeDirs = new ArrayList<>();
    includeDirs.add(new Path("include"));
    ErlideTestUtils.buildPaths(root, project, includeDirs);
    prefs.setIncludeDirs(includeDirs);
    final IPath ebinDir = new Path("ebin");
    ErlideTestUtils.buildPaths(root, project, Lists.newArrayList(ebinDir));
    prefs.setOutputDir(ebinDir);
    ErlideTestUtils.projects.add(erlProject);
    return erlProject;
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IWorkspaceRoot(org.eclipse.core.resources.IWorkspaceRoot) IPath(org.eclipse.core.runtime.IPath) ErlangProjectProperties(org.erlide.engine.model.root.ErlangProjectProperties) ArrayList(java.util.ArrayList)

Example 2 with ErlangProjectProperties

use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.

the class ErlProjectPropertiesTest method equalsTest.

@Test
public void equalsTest() {
    final ErlangProjectProperties p1 = new ErlangProjectProperties();
    final ErlangProjectProperties p2 = new ErlangProjectProperties();
    assertThat(p2).isEqualTo(p1);
}
Also used : ErlangProjectProperties(org.erlide.engine.model.root.ErlangProjectProperties) Test(org.junit.Test)

Example 3 with ErlangProjectProperties

use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.

the class IErlProjectTest method setProperties.

// TODO check more properties than source dirs property
@Test
public void setProperties() throws Exception {
    final IErlProject aProject = ErlModelTestBase.projects[0];
    final Collection<IPath> sourceDirs = aProject.getProperties().getSourceDirs();
    try {
        final ErlangProjectProperties properties = aProject.getProperties();
        final IPath srcx = new Path("srcx");
        properties.setSourceDirs(Lists.newArrayList(srcx));
        aProject.setProperties(properties);
        final Collection<IPath> sourceDirs2 = aProject.getProperties().getSourceDirs();
        assertEquals(1, sourceDirs2.size());
        assertEquals(srcx, sourceDirs2.iterator().next());
    } finally {
        ((ErlProject) aProject).setSourceDirs(sourceDirs);
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) ErlangProjectProperties(org.erlide.engine.model.root.ErlangProjectProperties) ErlProject(org.erlide.engine.internal.model.root.ErlProject) IErlProject(org.erlide.engine.model.root.IErlProject) Test(org.junit.Test)

Example 4 with ErlangProjectProperties

use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.

the class RebarProjectConfigurationTest method configCanBeParsed.

@Override
@Test
public void configCanBeParsed() throws CoreException {
    project.setConfigType(ProjectConfigType.REBAR);
    project.storeAllProperties();
    setFileContent(ProjectConfigType.REBAR.getConfigName(), "");
    final IProjectConfigurator persister = ProjectConfiguratorFactory.getDefault().getConfig(project.getConfigType(), project);
    final ProjectConfigurationSerializer configurator = ((FileProjectConfigurator) persister).getSerializer();
    final ErlangProjectProperties expected = new ErlangProjectProperties();
    expected.setOutputDir(new Path("ebin"));
    final ErlangProjectProperties actual = configurator.decodeConfig("");
    assertThat(actual).isEqualTo(expected);
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) ProjectConfigurationSerializer(org.erlide.engine.model.root.ProjectConfigurationSerializer) IProjectConfigurator(org.erlide.engine.model.root.IProjectConfigurator) ErlangProjectProperties(org.erlide.engine.model.root.ErlangProjectProperties) FileProjectConfigurator(org.erlide.engine.model.root.FileProjectConfigurator) Test(org.junit.Test)

Example 5 with ErlangProjectProperties

use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.

the class EmakeConfiguratorTest method multipleIncludeDirectoriesShouldBeConfigured.

@Test
public void multipleIncludeDirectoriesShouldBeConfigured() {
    final StringConcatenation _builder = new StringConcatenation();
    _builder.append("{\'src1/*\',[debug_info,{i, \"myinclude\"}, {i, \"myinclude2\"}]}.");
    _builder.newLine();
    final String input = _builder.toString();
    final ErlangProjectProperties actual = configurator.decodeConfig(input);
    final Path _path = new Path("myinclude");
    final Path _path_1 = new Path("myinclude2");
    Truth.<IPath, Iterable<IPath>>assertThat(actual.getIncludeDirs()).containsAtLeastElementsIn(Collections.<Object>unmodifiableList(CollectionLiterals.<Object>newArrayList(_path, _path_1)));
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) ErlangProjectProperties(org.erlide.engine.model.root.ErlangProjectProperties) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Aggregations

ErlangProjectProperties (org.erlide.engine.model.root.ErlangProjectProperties)29 IPath (org.eclipse.core.runtime.IPath)21 Test (org.junit.Test)19 Path (org.eclipse.core.runtime.Path)18 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)10 IterableSubject (com.google.common.truth.IterableSubject)4 IErlProject (org.erlide.engine.model.root.IErlProject)4 IProjectConfigurator (org.erlide.engine.model.root.IProjectConfigurator)4 IProject (org.eclipse.core.resources.IProject)3 Subject (com.google.common.truth.Subject)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)2 CoreException (org.eclipse.core.runtime.CoreException)2 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)1 OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)1 IResource (org.eclipse.core.resources.IResource)1 ProjectScope (org.eclipse.core.resources.ProjectScope)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 IEclipsePreferences (org.eclipse.core.runtime.preferences.IEclipsePreferences)1