[Acceleo] A circular dependency exists between scripts [message #985676] |
Thu, 15 November 2012 11:35  |
Eclipse User |
|
|
|
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 03:38   |
Eclipse User |
|
|
|
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 ). 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 .
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 08:29   |
Eclipse User |
|
|
|
Laurent Goubet wrote on Fri, 16 November 2012 03:38Hi 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 ). 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 .
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. 
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.
Dario
|
|
|
|
|
|
|
Re: [Acceleo] A circular dependency exists between scripts [message #987828 is a reply to message #987577] |
Wed, 28 November 2012 05:24   |
Eclipse User |
|
|
|
Stephane Begaudeau wrote on Tue, 27 November 2012 03:47Hi 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 09:40] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.06889 seconds