Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Building dependent resources
Building dependent resources [message #1777209] Mon, 27 November 2017 07:14 Go to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 11
Registered: December 2011
Junior Member
Hallo,

i have created 2 different DSLs to created, the second DSL referencing objects from the first DSL. Now, if i'm changing a resource from the first DSL, the dependent resources from dsl 2 also require a rebuild.
How can i model these dependencies between resources?

Thanks in advance.
Re: Building dependent resources [message #1777210 is a reply to message #1777209] Mon, 27 November 2017 07:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11588
Registered: July 2009
Senior Member
this usually happens automatically through org.eclipse.xtext.builder.clustering.ClusteringBuilderState.queueAffectedResources(Set<URI>, IResourceDescriptions, CurrentDescriptions, Collection<Delta>, Collection<Delta>, BuildData, IProgressMonitor)
which calls org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager.isAffected(Collection<Delta>, IResourceDescription, IResourceDescriptions)

=> if it does not work for you the question is: what is special about your dsl and the references and the changes that require a rebuild



Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Building dependent resources [message #1777211 is a reply to message #1777209] Mon, 27 November 2017 07:27 Go to previous messageGo to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 11
Registered: December 2011
Junior Member
Thanks for the quick reply.

I can not see anything obviously special. The cross references are ok and when doing a clean build everything is working fine.
I will your information to debug deeper into the problem.
Re: Building dependent resources [message #1777215 is a reply to message #1777211] Mon, 27 November 2017 08:11 Go to previous messageGo to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 11
Registered: December 2011
Junior Member
Hello,

just to be sure that we are talking about the same thing: Are the methods you've mentioned only for rebuilding the index? My problem is that the code generation is not started for the dependent files.

Thanks in Advance.
Re: Building dependent resources [message #1777220 is a reply to message #1777215] Mon, 27 November 2017 08:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11588
Registered: July 2009
Senior Member
yes but the files are not rebuilt => it will not be regenerated

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Building dependent resources [message #1777242 is a reply to message #1777220] Mon, 27 November 2017 12:04 Go to previous messageGo to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 11
Registered: December 2011
Junior Member
Ok, what would i have to do if i would like the dependent files to be regenerated?
Can you give me an entry point how these dependencies are modeled?
Re: Building dependent resources [message #1777244 is a reply to message #1777242] Mon, 27 November 2017 12:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11588
Registered: July 2009
Senior Member
they are modeled by references

b references a
and changes to a which are detected by the EObjectDescription changes.
created by IDefaultResourceDescriptionStrategy.

this would be 100000000 times easier to eplain if you would be more explicit on
what you change.
and how file b relates to file a


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Building dependent resources [message #1777256 is a reply to message #1777244] Mon, 27 November 2017 16:16 Go to previous messageGo to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 11
Registered: December 2011
Junior Member
Hello,

i'm trying to be more explicit:

model A has the following structure:
application ApplicationName 
{
    param "A" = 1
    ...
}

and an example for for a file containing model B is:
import "modelA.aml"
test Test1 using ApplicationName 
{
    //Do somthing with the application
}

When in this example the value of param "A" is changed, both models need to be regenerated, since this value is used in the code generated for Test1 of model B.

Thanks in advance.
Re: Building dependent resources [message #1777259 is a reply to message #1777256] Mon, 27 November 2017 16:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11588
Registered: July 2009
Senior Member
You should change the default resource description strategy to hash the value into the eobjectdescription user data map

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Building dependent resources [message #1777318 is a reply to message #1777209] Tue, 28 November 2017 12:54 Go to previous messageGo to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 11
Registered: December 2011
Junior Member
My solution:
Serializing the (application) object, remove all whitespaces and create a hash from the resulting string that is stored into the eobjectdescription.
If anything changes in the object, all dependent resources are regenerated.
I will have to check if this first idea for hash calculation using the serializer is fast enough, but that is different problem.

Thank you!
Re: Building dependent resources [message #1777325 is a reply to message #1777318] Tue, 28 November 2017 13:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11588
Registered: July 2009
Senior Member
is there a reason your modularity requires the subclasses to be regenerated at all? cant they inherit the stuff from a base class?
can you decide more specific which changes are relevant and which are not?


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Building dependent resources [message #1777330 is a reply to message #1777325] Tue, 28 November 2017 14:31 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5579
Registered: July 2009
Senior Member
Hi

Why not just regenerate them all anyway? MWE2 supports compound workflows so a GenerateAllDSLs.mwe2 can generate both.

EMF is very good at not overwriting unchanged generated files. Xtext is pretty good; one serializer comment instability has just been fixed.

You should therefore find that a gratuitous regeneration results in nothing to update in GIT.

Regards

Ed Willink
Re: Building dependent resources [message #1777389 is a reply to message #1777325] Wed, 29 November 2017 07:18 Go to previous messageGo to next message
Matthias Fromme is currently offline Matthias FrommeFriend
Messages: 11
Registered: December 2011
Junior Member
The regenerating the dependent resources has different reasons. One may be a little bad initial design of the generator.
Also this are not subclasses. The DSLs are used for testing purposes of an embedded system and i have only provided a simplified example of the problem.

In real life we have 4 different DSLs that allow us to describe different aspects of our system.
The first one describes the hardware components and environment. The second language describes the software components of the system and depends on components defined in the first language. On top of the this two languages a third one is used for defining applications. The last one defines test cases and uses elements from all previous models.

The code generator for e.g. the test language uses information from the referenced application to generate the test, so that it is required to regenerate the test if the application (or the referenced harware or software components) is changed.

The serialization of the whole referenced object is just a first try. If there a reasons not to do this in future, e.g. bad performance, we will be more specific in what changes we are interested in.

Regenrating them all using a MWE2 workflow is not suitable for my case since this would take several minutes. During development this would be disruptive and i would do this only if i can't see any other possibility.

Regards

Matthias
Re: Building dependent resources [message #1777392 is a reply to message #1777389] Wed, 29 November 2017 07:44 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11588
Registered: July 2009
Senior Member
ok maybe you can be more fine grained calculating the hashes or use the node model (would take space/comment changes into account as well)

Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Previous Topic:Tycho/Maven error when updating Xtext version
Next Topic:How to leverage _trace to properly configure "Open Source/Generated File"
Goto Forum:
  


Current Time: Thu Jan 18 12:09:04 GMT 2018

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

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