Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] A circular dependency exists between scripts
[Acceleo] A circular dependency exists between scripts [message #985676] Thu, 15 November 2012 16:35 Go to next message
Dario Imparato is currently offline Dario Imparato
Messages: 20
Registered: August 2012
Junior Member
Dear all,
I have a problem of "circular dependency" between modules.
Consider to have to translate a metamodel containing elements to represent "for" cycle. "for" element contains a "body" element that can itself contain a "for" element or other construct elements (e.g. if,while ecc).
Consider to create a module ForModule with a template "ForToText" that has to translate the entire "For" element, it (the module ForModule) will import a module "BodyModule" that has a template "Bodytotext" used to translate the generic element "Body". This template analyzes the body, if the body contains a "for" it invokes "ForToText" template so module "BodyModule" will import the module "ForModule" but can also import other modules to translate e.g."If"or "While" elements so I cannot put the templates in the same module.
Here are the dependencies:
ForModule imports BodyModule
BodyModule Imports ForModule
WhileModule imports BodyModule
BodyModule imports WhileModule
BodyModule imports IfModule
IfModule imports BodyModule

Any suggestions?
Thanks in advance.
Dario
Re: [Acceleo] A circular dependency exists between scripts [message #985798 is a reply to message #985676] Fri, 16 November 2012 08:38 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
Hi Dario,

Sounds like an awfully complicated design to me. It seems like you are trying to parse a language and transform it into another?

Whatever the reason Acceleo will not allow circular dependencies because of compilation issues. Why are you creating "modules" where it seems like templates would be much more of a fit? If you have a model that contains concepts of "For", "If", "While" which represent statements, then surely you also have the concepts representing the artifacts of the language (Class, Package... There should be one in that language Razz). Your generator should not have one module per metamodel concept, doing so usually yields an unfathomable soup which will give a headache to the maintainer Smile.

In such a case, you could have one single module holding all "statement" templates, which would be called by the 'higher level' modules : a module to "generate a Class" that will call the templates to generate the 'if's and 'for's it contains for example.

Well the main point is : if you find yourself in a case where you reach a cyclic dependency, your generators probably got too complicated. Since Acceleo will not allow cycles, you have to think about the architecture and find a way to simplify the design. I don't know if my above example helps in your case, but I hope you get the idea.

Laurent Goubet
Obeo

Re: [Acceleo] A circular dependency exists between scripts [message #985865 is a reply to message #985798] Fri, 16 November 2012 13:29 Go to previous messageGo to next message
Dario Imparato is currently offline Dario Imparato
Messages: 20
Registered: August 2012
Junior Member
Surprised Laurent Goubet wrote on Fri, 16 November 2012 03:38
Hi Dario,

Sounds like an awfully complicated design to me. It seems like you are trying to parse a language and transform it into another?

Whatever the reason Acceleo will not allow circular dependencies because of compilation issues. Why are you creating "modules" where it seems like templates would be much more of a fit? If you have a model that contains concepts of "For", "If", "While" which represent statements, then surely you also have the concepts representing the artifacts of the language (Class, Package... There should be one in that language Razz). Your generator should not have one module per metamodel concept, doing so usually yields an unfathomable soup which will give a headache to the maintainer Smile.

In such a case, you could have one single module holding all "statement" templates, which would be called by the 'higher level' modules : a module to "generate a Class" that will call the templates to generate the 'if's and 'for's it contains for example.

Well the main point is : if you find yourself in a case where you reach a cyclic dependency, your generators probably got too complicated. Since Acceleo will not allow cycles, you have to think about the architecture and find a way to simplify the design. I don't know if my above example helps in your case, but I hope you get the idea.

Laurent Goubet
Obeo


Hi Laurent,
thank you very much, I followed your suggestion and solved circular dependencies. Surprised
Now I have another issue. When I try to launch the transformation as "Acceleo Application" in Eclipse-Juno (Runner:Acceleo Plug-in Application) I have the following error:
"An internal error occurred during:"Launching Acceleo Main". The type of the first parameter of the main template named "Main_script" is a proxy".
I have this error ONLY if the "Java Project" of the metamodel is closed, if I open it everything goes fine.
I obviously have added the JARs of the metamodel in the Java Build Path of the "Acceleo Project".
Do you have a solution also for this?
Thanks again. Smile
Dario
Re: [Acceleo] A circular dependency exists between scripts [message #986872 is a reply to message #985865] Thu, 22 November 2012 08:04 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
Dario,

Something being 'a proxy' means that there is an unresolved reference in your model. If you try and open your template with the 'other project' closed, you will see that it contains a compilation error. (If not, then you only need to re-save it before launching the generation : the problem lies in the URIs between the template and the metamodel.)

Basically, the metamodel needs to be accessible in order for Acceleo to manage the generation.

Laurent Goubet
Obeo
Re: [Acceleo] A circular dependency exists between scripts [message #986880 is a reply to message #986872] Thu, 22 November 2012 08:56 Go to previous messageGo to next message
Dario Imparato is currently offline Dario Imparato
Messages: 20
Registered: August 2012
Junior Member
Laurent Goubet wrote on Thu, 22 November 2012 03:04
Dario,

Something being 'a proxy' means that there is an unresolved reference in your model. If you try and open your template with the 'other project' closed, you will see that it contains a compilation error. (If not, then you only need to re-save it before launching the generation : the problem lies in the URIs between the template and the metamodel.)

Basically, the metamodel needs to be accessible in order for Acceleo to manage the generation.

Laurent Goubet
Obeo


Hi Laurent,
first of all thanks for the reply.
I have not any compilation error with the metamodel project closed. What do you mean for "re-save" the project? I cleaned it, restart eclipse, re-build it but the error always appears.
Re: [Acceleo] A circular dependency exists between scripts [message #987346 is a reply to message #986880] Mon, 26 November 2012 09:01 Go to previous messageGo to next message
Dario Imparato is currently offline Dario Imparato
Messages: 20
Registered: August 2012
Junior Member
Here are the steps i follow.
In Java project of my meta-model:
-I create the .ecore and the .ecorediagram files
-Right click on .ecore and create genmodel file
-on the root in genmodel file right click-> generate all
-right click on the project ->export deployable plug-ins and fragments and create 3 .jar (project, project.edit, project.editor)

On the Acceleo project
-in META-INF/MANIFEST.MF add "dependencies" of 3 jars
-right click on project build path/configure build path/libraries add external jars and select 3 .jars

launch the .mtl file (that with @main tag) and have the error main template is a proxy.

What is wrong in my steps?
I would really appreciate any suggestion.
Thanks in advance.
Dario
Re: [Acceleo] A circular dependency exists between scripts [message #987577 is a reply to message #987346] Tue, 27 November 2012 08:47 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 413
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Dario,

When you go in the Acceleo compiler properties of your Acceleo project (Alt+enter on the project and the navigate to the Acceleo properties), what kind of serialization are you using?

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau & @acceleo
Google+: stephane.begaudeau & acceleo
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo



Re: [Acceleo] A circular dependency exists between scripts [message #987828 is a reply to message #987577] Wed, 28 November 2012 10:24 Go to previous messageGo to next message
Dario Imparato is currently offline Dario Imparato
Messages: 20
Registered: August 2012
Junior Member
Stephane Begaudeau wrote on Tue, 27 November 2012 03:47
Hi Dario,

When you go in the Acceleo compiler properties of your Acceleo project (Alt+enter on the project and the navigate to the Acceleo properties), what kind of serialization are you using?

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau & @acceleo
Google+: stephane.begaudeau & acceleo
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo

Hello Stephane,
I am using XMI serialization and (if it is of interest) with "Compilation Path Kind" set to "Absolute file system paths".
Is it right?

P.S.
my metamodel was structured in one package containing 4 packages. I read in another thread that is not recommended to use nested packages, so I put all the metamodel in the root package. Unfortunately, I have not solved my problem.

[Updated on: Wed, 28 November 2012 14:40]

Report message to a moderator

Re: [Acceleo] A circular dependency exists between scripts [message #988292 is a reply to message #987828] Thu, 29 November 2012 09:58 Go to previous message
Dario Imparato is currently offline Dario Imparato
Messages: 20
Registered: August 2012
Junior Member
Hello,
I solved my problem Smile
The "Ns URI" of the root package of the metamodel (.ecore file) must begin with "http://"
Thank you for your suggestions Smile
Previous Topic:[Acceleo] Metamodel URIs are not resolved by creating a new Acceleo generation file
Next Topic:[XPand/Xtend] Model Transform Example
Goto Forum:
  


Current Time: Thu Oct 30 18:25:05 GMT 2014

Powered by FUDForum. Page generated in 0.02015 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software