Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use latest melange version

* [Releng] Change Melange update site to 2018-01-19 build
* use new location of nebula update site
* replace printStacktrace by proper log
* manage multiple call to builder due to duplicated melange files

- ignore melange files in target folder, we should consider only those
outside bin folder (in model or src folders for exmaple)
 contributes to
eclipse-gemoc/gemoc-studio-modeldebugging#25 and
diverse-project/melange#105

* remove jenkins file that is not supposed to be executed

only the one in gemoc-studio is supposed to run

Signed-off-by: dvojtise <[email protected]>
  • Loading branch information
dvojtise authored Feb 17, 2018
1 parent 684d79b commit 8bd5638
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.emf.ecoretools.design.ui,
org.eclipse.gemoc.commons.eclipse.pde,
org.jdom2;bundle-version="2.0.6",
org.eclipse.gemoc.xdsmlframework.ide.ui;bundle-version="2.4.0"
org.eclipse.gemoc.xdsmlframework.ide.ui;bundle-version="2.4.0",
org.eclipse.core.jobs,
org.eclipse.jdt.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,28 @@
import java.util.Map;

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.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ICoreRunnable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.gemoc.commons.eclipse.pde.manifest.ManifestChanger;
import org.eclipse.gemoc.execution.sequential.javaxdsml.api.extensions.languages.SequentialLanguageDefinitionExtensionPoint;
import org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.Activator;
import org.eclipse.gemoc.xdsmlframework.api.extensions.languages.LanguageDefinitionExtensionPoint;
import org.eclipse.gemoc.xdsmlframework.ide.ui.builder.pde.PluginXMLHelper;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.jdom2.Element;
import org.osgi.framework.BundleException;

Expand Down Expand Up @@ -67,10 +73,13 @@ public boolean visit(IResourceDelta delta) throws CoreException {

class GemocSequentialLanguageResourceVisitor implements IResourceVisitor {
public boolean visit(IResource resource) {

updateProjectPluginConfiguration(resource);
checkConsistency(resource);
//return true to continue visiting children.
return true;
if (resource instanceof IFolder || resource instanceof IProject)
return true;
else return false;
}
}

Expand Down Expand Up @@ -107,38 +116,53 @@ public void checkConsistency(IResource resource){
* @param resource
*/
private void updateProjectPluginConfiguration(IResource resource) {

if (resource instanceof IFile
&& resource.getFileExtension().equals("melange")) {

IFile file = (IFile) resource;
IProject project = file.getProject();
// try {
try {
IJavaProject javaProject = (IJavaProject) project.getNature(JavaCore.NATURE_ID);
if(javaProject.getOutputLocation().isPrefixOf(file.getFullPath())){
// ignore melange files in target folder, we should consider only those outside it (in model or src folders for exmaple)
return;
};
} catch (CoreException e) {
Activator.error(e.getMessage(), e);
}
if (file.exists()) {

//Load .melange file
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
ResourceSet rs = new ResourceSetImpl();
Resource res = rs.getResource(uri, true);
ModelTypingSpace root = (ModelTypingSpace)res.getContents().get(0);
String packageName = root.getName();

//Browse declared Languages
for (fr.inria.diverse.melange.metamodel.melange.Element element : root.getElements()) {
if(element instanceof Language){
Language language = (Language) element;
// update entry in plugin.xml
setPluginLanguageNameAndFilePath(project, file, packageName+"."+language.getName());
Job job = Job.create("Update GEMOC Project Plugin Configuration of "+project.getName(), (ICoreRunnable) monitor -> {
//Load .melange file
URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
ResourceSet rs = new ResourceSetImpl();
Resource res = rs.getResource(uri, true);
ModelTypingSpace root = (ModelTypingSpace)res.getContents().get(0);
String packageName = root.getName();

//Browse declared Languages
for (fr.inria.diverse.melange.metamodel.melange.Element element : root.getElements()) {
if(element instanceof Language){
Language language = (Language) element;
// update entry in plugin.xml
setPluginLanguageNameAndFilePath(project, file, packageName+"."+language.getName());
}
}
}

//Use default model loader
updateModelLoaderClass(project, null);
ManifestChanger manifestChanger = new ManifestChanger(project);
try {
manifestChanger.addPluginDependency(org.eclipse.gemoc.executionframework.extensions.sirius.Activator.PLUGIN_ID);
manifestChanger.commit();
} catch (BundleException | IOException | CoreException e) {
e.printStackTrace();
}

//Use default model loader
updateModelLoaderClass(project, null);
ManifestChanger manifestChanger = new ManifestChanger(project);
try {
manifestChanger.addPluginDependency(org.eclipse.gemoc.executionframework.extensions.sirius.Activator.PLUGIN_ID);
manifestChanger.commit();
} catch (BundleException | IOException | CoreException e) {
Activator.error(e.getMessage(), e);
}
});
// lock the whole project
job.setRule(project);
// Start the Job
job.schedule(500);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
import org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.Activator;
import org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.templates.SequentialSingleLanguageTemplate;
import org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.wizards.CreateDSAWizardContextActionDSAK3;
import org.eclipse.gemoc.xdsmlframework.ide.ui.commands.AbstractMelangeSelectHandler;
Expand Down Expand Up @@ -119,7 +120,7 @@ protected void updateMelange(ExecutionEvent event, Language language, Set<String
}

} catch (IOException e) {
e.printStackTrace();
Activator.error(e.getMessage(), e);
}
}

Expand All @@ -130,7 +131,7 @@ protected void waitForAutoBuild() {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
wasInterrupted = false;
} catch (OperationCanceledException e) {
e.printStackTrace();
Activator.warn(e.getMessage(), e);
} catch (InterruptedException e) {
wasInterrupted = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.Activator;
import org.eclipse.gemoc.xdsmlframework.ide.ui.commands.AbstractMelangeSelectHandler;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateDomainModelWizardContextAction;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateDomainModelWizardContextAction.CreateDomainModelAction;
//import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
import org.eclipse.gemoc.xdsmlframework.ide.ui.commands.AbstractMelangeSelectHandler;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateDomainModelWizardContextAction;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateDomainModelWizardContextAction.CreateDomainModelAction;
//import org.eclipse.jface.dialogs.MessageDialog;

import fr.inria.diverse.melange.metamodel.melange.Language;

Expand Down Expand Up @@ -90,7 +90,6 @@ else if(nodesOp.isEmpty()){ //no operators, search for '{'
}
else{
String melangeWSLocation = language.eResource().getURI().toPlatformString(true);
URI uri = language.eResource().getURI();
String melangeLocation =ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()+melangeWSLocation;
List<String> lines;
try {
Expand All @@ -103,7 +102,7 @@ else if(nodesOp.isEmpty()){ //no operators, search for '{'
length = 0;
newRegion = "\n\tsyntax \""+ecoreURI+"\"\n\t";
} catch (IOException e) {
e.printStackTrace();
Activator.error(e.getMessage(), e);
}
}
}
Expand All @@ -126,7 +125,6 @@ else if(nodesOp.isEmpty()){ //no operators, search for '{'
try {
//Load Melange file
String melangeWSLocation = language.eResource().getURI().toPlatformString(true);
URI uri = language.eResource().getURI();
String melangeLocation =ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()+melangeWSLocation;
List<String> lines = Files.readAllLines(Paths.get(melangeLocation));

Expand All @@ -140,7 +138,7 @@ else if(nodesOp.isEmpty()){ //no operators, search for '{'
//Write new content
Files.write(Paths.get(melangeLocation), newContent.toString().getBytes());
} catch (IOException e) {
e.printStackTrace();
Activator.error(e.getMessage(), e);
}
}
}
Expand All @@ -153,7 +151,7 @@ protected void waitForAutoBuild() {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
wasInterrupted = false;
} catch (OperationCanceledException e) {
e.printStackTrace();
Activator.warn(e.getMessage(), e);
} catch (InterruptedException e) {
wasInterrupted = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.Activator;
import org.eclipse.gemoc.xdsmlframework.ide.ui.commands.AbstractMelangeSelectHandler;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction.CreateEditorProjectAction;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
import org.eclipse.gemoc.xdsmlframework.ide.ui.commands.AbstractMelangeSelectHandler;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction.CreateEditorProjectAction;

import fr.inria.diverse.melange.metamodel.melange.Language;

Expand Down Expand Up @@ -109,7 +109,6 @@ protected void updateMelange(ExecutionEvent event, Language language, String sir
try {
//Load Melange file
String melangeWSLocation = language.eResource().getURI().toPlatformString(true);
URI uri = language.eResource().getURI();
String melangeLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()+melangeWSLocation;
List<String> lines = Files.readAllLines(Paths.get(melangeLocation));

Expand Down Expand Up @@ -137,7 +136,7 @@ protected void waitForAutoBuild() {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
wasInterrupted = false;
} catch (OperationCanceledException e) {
e.printStackTrace();
Activator.warn(e.getMessage(), e);
} catch (InterruptedException e) {
wasInterrupted = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.Activator;
import org.eclipse.gemoc.xdsmlframework.ide.ui.commands.AbstractMelangeSelectHandler;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction.CreateEditorProjectAction;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.nodemodel.util.NodeModelUtils;
import org.eclipse.xtext.resource.XtextResource;
import org.eclipse.xtext.ui.editor.XtextEditor;
import org.eclipse.xtext.ui.editor.model.IXtextDocument;
import org.eclipse.xtext.ui.editor.utils.EditorUtils;
import org.eclipse.gemoc.xdsmlframework.ide.ui.commands.AbstractMelangeSelectHandler;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction;
import org.eclipse.gemoc.xdsmlframework.ide.ui.xdsml.wizards.CreateEditorProjectWizardContextAction.CreateEditorProjectAction;

import fr.inria.diverse.melange.metamodel.melange.Language;

Expand Down Expand Up @@ -110,7 +110,6 @@ protected void updateMelange(ExecutionEvent event, Language language, String xte
try {
//Load Melange file
String melangeWSLocation = language.eResource().getURI().toPlatformString(true);
URI uri = language.eResource().getURI();
String melangeLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()+melangeWSLocation;
List<String> lines = Files.readAllLines(Paths.get(melangeLocation));

Expand All @@ -124,7 +123,7 @@ protected void updateMelange(ExecutionEvent event, Language language, String xte
//Write new content
Files.write(Paths.get(melangeLocation), newContent.toString().getBytes());
} catch (IOException e) {
e.printStackTrace();
Activator.error(e.getMessage(), e);
}
}

Expand All @@ -138,7 +137,7 @@ protected void waitForAutoBuild() {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
wasInterrupted = false;
} catch (OperationCanceledException e) {
e.printStackTrace();
Activator.warn(e.getMessage(), e);
} catch (InterruptedException e) {
wasInterrupted = true;
}
Expand Down

0 comments on commit 8bd5638

Please sign in to comment.