Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2019-09-02 13:44:41 +0000
committerJan Belle2019-09-24 15:12:34 +0000
commit95ed7880f6542578133a3ebbfdf3ff4b504ede33 (patch)
tree75085292ef12e650e9b751306f4f820015562e22
parentbb887f9cae8ccb28da86cb0a1a6263420592e23f (diff)
downloadorg.eclipse.etrice-95ed7880f6542578133a3ebbfdf3ff4b504ede33.tar.gz
org.eclipse.etrice-95ed7880f6542578133a3ebbfdf3ff4b504ede33.tar.xz
org.eclipse.etrice-95ed7880f6542578133a3ebbfdf3ff4b504ede33.zip
[generator.launch] Fix dependency inference when using modelpath
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathDescription.java23
-rw-r--r--plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathManager.java3
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java2
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java11
-rw-r--r--plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchHelper.xtend55
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF3
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/.project0
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/Dep.room5
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/.project0
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/modelpath1
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Dep.room10
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/NotMapped.room6
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Physical.etphys25
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/System.etmap6
-rw-r--r--tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/launch/TestGeneratorLaunchHelper.xtend68
15 files changed, 149 insertions, 69 deletions
diff --git a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathDescription.java b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathDescription.java
index e784a61aa..2419b1e9c 100644
--- a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathDescription.java
+++ b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathDescription.java
@@ -24,8 +24,8 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
@@ -39,11 +39,11 @@ import org.eclipse.core.runtime.Path;
*/
public class ModelPathDescription {
- private final List<IFolder> sourceDirectories;
+ private final List<IContainer> sourceDirectories;
private final List<IProject> projectDependencies;
private final List<IMarker> problemMarkers;
- private ModelPathDescription(List<IFolder> sourceDirectories, List<IProject> projectDependencies, List<IMarker> problemMarkers) {
+ private ModelPathDescription(List<IContainer> sourceDirectories, List<IProject> projectDependencies, List<IMarker> problemMarkers) {
this.sourceDirectories = sourceDirectories;
this.projectDependencies = projectDependencies;
@@ -53,7 +53,7 @@ public class ModelPathDescription {
/**
* @return the list of source directories
*/
- public List<IFolder> getSourceDirectories() {
+ public List<IContainer> getSourceDirectories() {
return sourceDirectories;
}
@@ -101,7 +101,7 @@ public class ModelPathDescription {
private IFile file;
private IProject project;
private IWorkspaceRoot root;
- private List<IFolder> srcDirs;
+ private List<IContainer> srcDirs;
private List<IProject> projects;
private List<IMarker> problemMarkers;
private int lineNumber;
@@ -168,11 +168,16 @@ public class ModelPathDescription {
return;
}
- IFolder dir = project.getFolder(str);
- if(!dir.exists()) {
- addProblemMarker(IMarker.SEVERITY_WARNING, "directory " + dir.getFullPath() + " doesn't exist");
+ try {
+ IContainer dir = project.getFolder(str);
+ if(!dir.exists()) {
+ addProblemMarker(IMarker.SEVERITY_WARNING, "directory " + dir.getFullPath() + " doesn't exist");
+ }
+ srcDirs.add(dir);
+ }
+ catch(IllegalArgumentException e) {
+ addProblemMarker(IMarker.SEVERITY_ERROR, str + " is not a valid directory");
}
- srcDirs.add(dir);
}
private void parseProject(String str) throws CoreException {
diff --git a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathManager.java b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathManager.java
index c46d5b2da..2531cc93c 100644
--- a/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathManager.java
+++ b/plugins/org.eclipse.etrice.core.common.ui/src/org/eclipse/etrice/core/common/ui/modelpath/ModelPathManager.java
@@ -25,7 +25,6 @@ import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -179,7 +178,7 @@ public class ModelPathManager implements IResourceChangeListener {
* @param project a project
* @return a list of source directories
*/
- private List<IFolder> getSourceDirectories(IProject project) {
+ private List<IContainer> getSourceDirectories(IProject project) {
return getModelPathDescription(project)
.map(ModelPathDescription::getSourceDirectories)
.orElse(Collections.emptyList());
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
index 530a17dd2..68c07653b 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorConfigTab.java
@@ -163,7 +163,7 @@ public abstract class GeneratorConfigTab extends AbstractLaunchConfigurationTab
createSeparator(mainComposite, 2);
- generateDepsWithinProject = createCheckButton(mainComposite, "generate all .etmap dependencies within project");
+ generateDepsWithinProject = createCheckButton(mainComposite, "generate all dependencies within project");
generateDepsWithinProject.setToolTipText("this options automatically generates all referenced model files in this project");
generateDepsWithinProject.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false, 2, 1));
generateDepsWithinProject.addSelectionListener(new UpdateConfig());
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
index 373011b33..d9e4e78db 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchConfigurationDelegate.java
@@ -14,6 +14,7 @@
package org.eclipse.etrice.generator.launch;
+import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -86,7 +87,7 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
// constructing program arguments
StringBuffer argString = new StringBuffer();
- addModels(configuration, entry.getValue(), argString);
+ addModels(configuration, entry.getKey(), entry.getValue(), argString);
addArguments(configuration, entry.getKey(), argString);
addModelpath(entry.getKey(), argString);
String[] args = splitCommandLine(argString.toString());
@@ -157,10 +158,10 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
return new ConsoleOutput(out);
}
- protected void addModels(ILaunchConfiguration configuration, List<String> models, StringBuffer argString) throws CoreException {
+ protected void addModels(ILaunchConfiguration configuration, IProject project, Iterable<String> models, StringBuffer argString) throws CoreException {
if(configuration.getAttribute(GeneratorConfigTab.GEN_DEPS_WITHIN_PROJECT, true)) {
- // generate all dependencies within project for .etmap
- models = Lists.newArrayList(GeneratorLaunchHelper.getAllDependenciesWithinProjects(models));
+ // generate all dependencies within project
+ models = GeneratorLaunchHelper.getAllDependenciesWithinProject(project, models);
}
for(String model : models) {
argString.append(" \""+model+"\"");
@@ -242,7 +243,7 @@ public abstract class GeneratorLaunchConfigurationDelegate extends AbstractJavaL
.toArray(size -> new String[size]);
if(paths.length > 0) {
- String modelpathArg = String.join(";", paths);
+ String modelpathArg = String.join(File.pathSeparator, paths);
argString.append(" -modelpath \"").append(modelpathArg).append('"');
}
}
diff --git a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchHelper.xtend b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchHelper.xtend
index b36048ff5..98cb365f1 100644
--- a/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchHelper.xtend
+++ b/plugins/org.eclipse.etrice.generator.launch/src/org/eclipse/etrice/generator/launch/GeneratorLaunchHelper.xtend
@@ -15,68 +15,51 @@
package org.eclipse.etrice.generator.launch
import com.google.inject.Inject
-import com.google.inject.Provider
-import java.nio.file.Paths
import java.util.Collection
+import org.eclipse.core.resources.IProject
import org.eclipse.core.resources.ResourcesPlugin
import org.eclipse.core.runtime.Path
import org.eclipse.emf.common.util.URI
-import org.eclipse.emf.ecore.resource.ResourceSet
-import org.eclipse.emf.ecore.util.EcoreUtil
import org.eclipse.etrice.core.common.scoping.ModelLocator
import org.eclipse.etrice.core.ui.RoomUiModule
-import org.eclipse.etrice.generator.fsm.base.FileSystemHelpers
+import org.eclipse.xtext.ui.resource.XtextResourceSetProvider
+import org.eclipse.emf.ecore.util.EcoreUtil
class GeneratorLaunchHelper {
- @Inject Provider<ResourceSet> resourceSetProvider
+ @Inject XtextResourceSetProvider resourceSetProvider
@Inject ModelLocator modelLocator
/**
- * @return all transitive dependencies from .etmap files within their projects
+ * @return all transitive dependencies from files within the project
*/
- static def Collection<String> getAllDependenciesWithinProjects(Iterable<String> models) {
+ static def Iterable<String> getAllDependenciesWithinProject(IProject project, Iterable<String> models) {
val helper = new GeneratorLaunchHelper => [
RoomUiModule.injector.injectMembers(it)
]
newLinkedHashSet => [
addAll(models)
- addAll(models.map[helper.getAllDependencies(it)].flatten)
+ addAll(helper.getAllDependencies(project, models))
]
}
- def getAllDependencies(String filePath) {
- val uri = URI.createURI(modelLocator.resolve(filePath, null)?:"")
- if(!"etmap".equalsIgnoreCase(uri?.fileExtension))
- return emptyList
-
- val rs = resourceSetProvider.get
- val res = try { rs.getResource(uri, true) } catch(RuntimeException e) {}
- if(res?.contents?.head === null)
- return emptyList
-
- val projectURI = FileSystemHelpers::getProjectURI(res.contents.head)
- if(projectURI === null || !projectURI.isFile || projectURI.relative)
- return emptyList
+ def getAllDependencies(IProject project, Iterable<String> models) {
+ val ws = ResourcesPlugin.workspace.root
+ val rs = resourceSetProvider.get(project)
- val projectPath = Paths.get(projectURI.toFileString)
+ models.map[filePath | URI.createURI(modelLocator.resolve(filePath, null)?:"")]
+ .forEach[uri | try { rs.getResource(uri, true) } catch(RuntimeException e) {}]
EcoreUtil.resolveAll(rs)
+
rs.resources.map [
- switch it : URI {
- case isPlatformResource: {
- val platformMember = ResourcesPlugin.workspace.root.findMember(new Path(toPlatformString(false)))
- val location = platformMember?.location?.toOSString
- if(location !== null && Paths.get(location).startsWith(projectPath))
- location
- }
- case isFile: {
- if(Paths.get(toFileString).startsWith(projectPath))
- toFileString
- }
- }
- ].filterNull
+ switch it : URI {
+ case isPlatformResource: ws.findMember(new Path(toPlatformString(false)))
+ case isFile: ws.getFileForLocation(new Path(toFileString))
+ }].filterNull
+ .filter[file | file.project.equals(project)]
+ .map[location?.toOSString].filterNull
}
def static groupByProject(Collection<String> files) {
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
index 02c3759cf..a54e8e156 100644
--- a/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.etrice.core.fsm;bundle-version="2.0.0",
org.eclipse.graphiti;bundle-version="0.8.0",
org.eclipse.etrice.core.room.tests;bundle-version="2.0.0",
org.eclipse.etrice.core.genmodel.fsm;bundle-version="2.0.0",
- org.eclipse.etrice.generator.base;bundle-version="2.0.0
+ org.eclipse.etrice.generator.base;bundle-version="2.0.0",
+ org.eclipse.core.resources
Import-Package: org.eclipse.xtext.xbase.lib
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/.project b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/.project
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/.project
+++ /dev/null
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/Dep.room b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/Dep.room
index 87a69b85c..151ac6462 100644
--- a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/Dep.room
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/Dep.room
@@ -1,7 +1,7 @@
RoomModel Dep {
+ import model "platform:/resource/project1/Dep2.room"
import model "../project2/ModelDep.room"
- import model "platform:/resource/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/ModelDep2.room"
- import model "platform:/resource/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project1/Dep2.room"
+ import model "platform:/resource/project2/ModelDep.room"
LogicalSystem logicalSystem {
SubSystemRef subSys : SubSystem
@@ -9,7 +9,6 @@ RoomModel Dep {
SubSystemClass SubSystem {
ActorRef ref1 : ModelDep.ModelDep
- ActorRef ref2 : ModelDep2.ModelDep2
ActorRef ref3 : Dep2.Dep2
}
} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/.project b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/.project
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/.project
+++ /dev/null
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/modelpath b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/modelpath
new file mode 100644
index 000000000..40b9aef90
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/modelpath
@@ -0,0 +1 @@
+srcDir src \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Dep.room b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Dep.room
new file mode 100644
index 000000000..6d4d8cb4b
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Dep.room
@@ -0,0 +1,10 @@
+RoomModel Dep {
+
+ LogicalSystem logicalSystem {
+ SubSystemRef subSys : SubSystem
+ }
+
+ SubSystemClass SubSystem {
+
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/NotMapped.room b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/NotMapped.room
new file mode 100644
index 000000000..6277f7207
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/NotMapped.room
@@ -0,0 +1,6 @@
+RoomModel NotMapped {
+
+ ActorClass NotMapped {
+
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Physical.etphys b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Physical.etphys
new file mode 100644
index 000000000..a81a83deb
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/Physical.etphys
@@ -0,0 +1,25 @@
+PhysicalModel Physical {
+
+ PhysicalSystem PhysSys1 {
+ NodeRef nodeRef1 : NodeClass1
+ }
+
+ NodeClass NodeClass1 {
+ runtime = RuntimeClass1
+ priomin = -10
+ priomax = 10
+
+ DefaultThread PhysicalThread1 {
+ execmode = blocked
+ prio = 0
+ stacksize = 1024
+ msgblocksize = 32
+ msgpoolsize = 10
+ }
+ }
+
+ RuntimeClass RuntimeClass1 {
+ model = multiThreaded
+ }
+
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/System.etmap b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/System.etmap
new file mode 100644
index 000000000..a9c703137
--- /dev/null
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/models/generatorLaunchHelper/project2/src/System.etmap
@@ -0,0 +1,6 @@
+MappingModel SystemMapping {
+
+ Mapping Dep.logicalSystem -> Physical.PhysSys1 {
+ SubSystemMapping subSys -> nodeRef1 {}
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/launch/TestGeneratorLaunchHelper.xtend b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/launch/TestGeneratorLaunchHelper.xtend
index 2fbad9fe4..1a0a70a45 100644
--- a/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/launch/TestGeneratorLaunchHelper.xtend
+++ b/tests/org.eclipse.etrice.ui.behavior.tests/src/org/eclipse/etrice/ui/launch/TestGeneratorLaunchHelper.xtend
@@ -19,36 +19,80 @@ import org.junit.Test
import static org.eclipse.etrice.generator.launch.GeneratorLaunchHelper.*
import static org.junit.Assert.*
+import org.eclipse.core.resources.ResourcesPlugin
+import org.eclipse.core.runtime.Path
+import org.junit.BeforeClass
+import org.junit.AfterClass
+import java.nio.file.Files
class TestGeneratorLaunchHelper {
- private def get(Iterable<String> list) {
- getAllDependenciesWithinProjects(list).toList
+ static val basePath = Paths.get('models', 'generatorLaunchHelper')
+ static val projects = #['project1', 'project2']
+
+ @BeforeClass
+ def static void createProjects() {
+ projects.forEach[ projectName |
+ val project = ResourcesPlugin.workspace.root.getProject(projectName)
+ val description = ResourcesPlugin.workspace.newProjectDescription(projectName) => [
+ location = new Path(basePath.resolve(projectName).toAbsolutePath.toString)
+ ]
+ project.create(description, null)
+ project.open(null)
+ ]
}
@Test
def void notExisting() {
- #[] => [models|assertEquals(models, get(models))]
-// #[''] => [models|assertEquals(models, get(models))]
- #['1', '.0+/`}]"'] => [models|assertEquals(models, get(models))]
- #['1.room', '2.etphys', '3.etmap', '4.etconfig', '5.unknown'] => [models|assertEquals(models, get(models))]
+ #[] => [models|assertEquals(models, get('project2', models))]
+ #[''] => [models|assertEquals(models, get('project2', models))]
+ #['1', '.0+/`}]"'] => [models|assertEquals(models, get('project2', models))]
+ #['1.room', '2.etphys', '3.etmap', '4.etconfig', '5.unknown'] => [models|assertEquals(models, get('project2', models))]
}
@Test
- def void project() {
- val (String) => String toAbsolutePath = [file| Paths.get('models/generatorLaunchHelper', file).toAbsolutePath.toString]
-
+ def void projectURI() {
assertEquals(
#[
'project1/System.etmap',
'project1/NotMapped.room',
'project1/Physical.etphys',
- 'project1/Dep.room'
- ].map[toAbsolutePath.apply(it)], get(
+ 'project1/Dep.room',
+ 'project1/NotMappedDep.room',
+ 'project1/Dep2.room'
+ ].map[toAbsolutePath], get('project1',
#[
'project1/System.etmap',
'project1/NotMapped.room'
- ].map[toAbsolutePath.apply(it)]))
+ ].map[toAbsolutePath]))
}
+
+ @Test
+ def void projectModelpath() {
+ assertEquals(#[
+ 'project2/src/System.etmap',
+ 'project2//src/Dep.room',
+ 'project2/src/Physical.etphys'
+ ].map[toAbsolutePath], get('project2', #[
+ 'project2/src/System.etmap'
+ ].map[toAbsolutePath])
+ )
+ }
+
+ @AfterClass
+ def static void deleteProjects() {
+ projects.forEach[ projectName |
+ ResourcesPlugin.workspace.root.getProject(projectName).delete(false, false, null)
+ Files.delete(basePath.resolve(projectName + '/.project'))
+ ]
+ }
+
+ private def get(String project, Iterable<String> list) {
+ getAllDependenciesWithinProject(ResourcesPlugin.workspace.root.getProject(project), list).toList
+ }
+
+ private def toAbsolutePath(String file) {
+ basePath.resolve(file).toAbsolutePath.toString
+ }
}

Back to the top