Bug 458751 - Make dependency to JDT optional
Summary: Make dependency to JDT optional
Status: CLOSED FIXED
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0.3   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.0.0M6   Edit
Assignee: Laurent Redor CLA
QA Contact: Laurent Redor CLA
URL:
Whiteboard:
Keywords: triaged
Depends on: 348922
Blocks:
  Show dependency tree
 
Reported: 2015-01-29 10:50 EST by Michael Keppler CLA
Modified: 2016-06-24 08:03 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Keppler CLA 2015-01-29 10:50:57 EST
sirius.ui has a required dependency to jdt.core. This is only to add the Sirius nature to a Java project. It would be nice to declare this dependency optional (and handle the missing class at runtime), as there are products, which want to use Sirius, but without any JDT dependency.
Comment 1 Maxime Porhel CLA 2015-02-02 08:45:46 EST
I found two other dependencies to jdt.core: 

 . org.eclipse.sirius.common.acceleo.mtl.ide: WorkspaceJavaImportHandler is used by the Acceleo MTL interpreter to manage Java services. This class is used to retrieve the Java services from the workspace, it allows the specififer to create is VSM (.odesign file) to test it without launching a runtime ("live editing mode") this plugins should not be required in a product using Sirius if this product does not allow its users to deal with VSMs. 

 . org.eclipse.sirius.common.xtext: XTextResourceSetFactory configures the resource set  and use several classes of jdt.core to compute the platform uri map. This plugin is the XText bridge. It currently provides:
   . a resource set factory to correctly setup the resourceSet when XText is used, 
   . a saving policy dedicated to Xtext aware sessions. It actually work around the bug #432795 by always adding options to ignore the concrete syntax validation of Xtext while saving.

We might also analyze the possibility to make the dependency between the Xtext bridge and jdt.core optional.
Comment 2 Cedric Brun CLA 2015-02-02 09:14:37 EST
If one use org.eclipse.sirius.common.acceleo.mtl then by transitivity org.eclipse.acceleo.engine and org.eclipse.acceleo.common will be part of the classpath. Both these plugins have an optional dependency to JDT and PDE. the dependency is optional but the code might fail when used within an Eclipse runtime and not in standalone. 
See Bug 348922.
Comment 3 Pierre-Charles David CLA 2015-02-03 07:42:59 EST
(In reply to Maxime Porhel from comment #1)
>  . org.eclipse.sirius.common.acceleo.mtl.ide: WorkspaceJavaImportHandler is
> used by the Acceleo MTL interpreter to manage Java services. This class is
> used to retrieve the Java services from the workspace, it allows the
> specififer to create is VSM (.odesign file) to test it without launching a
> runtime ("live editing mode") this plugins should not be required in a
> product using Sirius if this product does not allow its users to deal with
> VSMs. 

Note that this "magic" behavior does not work anyway with recent versions of Eclipse (starting from Luna), see https://bugs.eclipse.org/bugs/show_bug.cgi?id=419205.
Comment 4 Eclipse Genie CLA 2016-03-21 11:30:07 EDT
New Gerrit change created: https://git.eclipse.org/r/68926
Comment 7 Pierre-Charles David CLA 2016-03-22 09:23:36 EDT
So this it done in practice now, and Sirius 4.0M6 (the runtime part) should be able to work without the JDT:

% git grep -E "org\.eclipse\.(jdt|pde)" -- '**/MANIFEST.MF'
plugins/org.eclipse.sirius.common.acceleo.mtl.ide/META-INF/MANIFEST.MF: org.eclipse.jdt.core;bundle-version="3.5.0",
plugins/org.eclipse.sirius.common.xtext/META-INF/MANIFEST.MF: org.eclipse.jdt.core;bundle-version="3.8.1";resolution:=optional,
plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF: org.eclipse.pde.core;bundle-version="3.8.1"
plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF: org.eclipse.jdt.core,
plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF: org.eclipse.pde.core,
plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF: org.eclipse.pde.core.plugin
plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF: org.eclipse.jdt.ui,
plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF: org.eclipse.jdt;bundle-version="3.3.1",
plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF: org.eclipse.pde.ui,

The only remaining references/dependencies to JDT (or PDE for that matter) are:
* in the tests (that's OK);
* in the Xtext integration plug-in, which still depends on the JDT, but the plug-in is optional and the dependency itself is now optional too;
* in the specification environment org.eclipse.sirius.editor (the VSM editor infrastructure) and org.eclipse.sirius.common.acceleo.mtl.ide (which provides completion/validation support for Acceleo expressions in the VSM editor, and is not needed when *running* a Sirius modeler.

As mentioned in a previous comment by Cédric, Acceleo/MTL itself still depends on the JDT. But AQL does not, so now it *should* be possible to create full-featured Sirius-based modelers which can be run in Eclipse installations without the JDT.

I'm not closing the ticket yet, as it is not completely clear how to validate it, so until we have proper validation scenario it stays open (we may have a bad surprise if some other dependency of ours we missed requires the JDT itself).
Comment 8 Laurent Redor CLA 2016-04-27 10:44:25 EDT
I validated this issue with this scenario:
* Get the sources of all Sirius plugins in your workspace
* Launch a runtime with all plugins
* Validate that all is OK (open a diagram, a tree and a table for example)
* Modify the launch configuration to remove all jdt plugins.
* Validate the launch configuration and remove plugins which depends from jdt (until launch configuration OK).
* You should have all Sirius plugins necessary to the runtime.
* Launch a runtime
* Validate that all is OK (open a diagram, a tree and a table for example)

A real validation would be to make a product with Sirius runtime and without jdt but this was not made for this issue.
Comment 9 Pierre-Charles David CLA 2016-06-24 08:03:14 EDT
Available in Sirius 4.0.0.