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);
}
use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.
the class InternalProjectConfigurationTest method outputPathShouldFollowPropertyChange.
@Test
public void outputPathShouldFollowPropertyChange() throws BackingStoreException {
final String expected = "hello/world";
final IProject wproject = project.getWorkspaceProject();
final IEclipsePreferences node = new ProjectScope(wproject).getNode("org.erlide.core");
node.put(ProjectPreferencesConstants.OUTPUT_DIR, expected);
node.flush();
final ErlangProjectProperties pp = project.getProperties();
final String actual = pp.getOutputDir().toPortableString();
assertThat(actual).isEqualTo(expected);
}
use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.
the class ErlProject method addExternals.
private void addExternals(final List<IErlElement> children) {
final ErlangProjectProperties myProperties = getProperties();
final String externalIncludes = myProperties.getExternalIncludes();
final String externalModules = myProperties.getExternalModules();
final Collection<IPath> includeDirs = myProperties.getIncludeDirs();
final List<String> projectIncludes = Lists.newArrayList();
for (final IPath path : new PathResolver().resolvePaths(includeDirs)) {
if (path.isAbsolute() && !fProject.getLocation().isPrefixOf(path)) {
final Collection<String> includes = ErlangEngine.getInstance().getOpenService().getIncludesInDir(path.toPortableString());
if (includes != null) {
for (final String include : includes) {
projectIncludes.add(path.append(include).toPortableString());
}
}
}
}
if (!externalIncludes.isEmpty() || !externalModules.isEmpty() || !projectIncludes.isEmpty()) {
final IErlExternalRoot external = new ErlExternalReferenceEntryList(this, "Externals", externalIncludes, projectIncludes, externalModules);
children.add(external);
}
}
use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.
the class ErlideTestUtils method createErlProject.
public static IErlProject createErlProject(final String name) throws CoreException {
final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
final IProject project2 = root.getProject(name);
try {
project2.delete(true, null);
} catch (final CoreException x) {
// ignore
}
final IErlProject erlProject = ErlangEngine.getInstance().getModel().newProject(name);
erlProject.getBuilderProperties().setBuilderTool(BuilderTool.INTERNAL);
final IProject project = erlProject.getWorkspaceProject();
final ErlangProjectProperties prefs = erlProject.getProperties();
final List<IPath> srcDirs = new ArrayList<>();
ErlideTestUtils.createFolder(project2, "src");
srcDirs.add(new Path("src"));
prefs.setSourceDirs(srcDirs);
ErlideTestUtils.buildPaths(root, project, srcDirs);
final List<IPath> includeDirs = new ArrayList<>();
ErlideTestUtils.createFolder(project2, "include");
includeDirs.add(new Path("include"));
ErlideTestUtils.buildPaths(root, project, includeDirs);
prefs.setIncludeDirs(includeDirs);
ErlideTestUtils.createFolder(project2, "ebin");
final IPath ebinDir = new Path("ebin");
ErlideTestUtils.buildPaths(root, project, Lists.newArrayList(ebinDir));
prefs.setOutputDir(ebinDir);
ErlideTestUtils.projects.add(erlProject);
return erlProject;
}
use of org.erlide.engine.model.root.ErlangProjectProperties in project erlide_eclipse by erlang.
the class RebarProjectConfigurationTest method propertiesShouldFollowConfigFileChange.
@Test
public void propertiesShouldFollowConfigFileChange() throws CoreException {
project.setConfigType(ProjectConfigType.REBAR);
final String cfgFile = ProjectConfigType.REBAR.getConfigName();
final String config = getFileContent(cfgFile);
final String config1 = config + "{erl_opts, [{i, \"myinclude\"}, " + "{src_dirs, [\"src\", \"src2\"]}]}.";
setFileContent(cfgFile, config1);
final ErlangProjectProperties p2 = project.getProperties();
final Collection<IPath> actualSources = p2.getSourceDirs();
assertThat(actualSources).hasSize(2);
assertThat(actualSources).contains(new Path("src2"));
final Collection<IPath> actualIncludes = p2.getIncludeDirs();
assertThat(actualIncludes).hasSize(1);
assertThat(actualIncludes).contains(new Path("myinclude"));
}
Aggregations