Skip to main content


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: 22
Registered: December 2011
Location: Germany
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: 14665
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



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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: 22
Registered: December 2011
Location: Germany
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: 22
Registered: December 2011
Location: Germany
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: 14665
Registered: July 2009
Senior Member
yes but the files are not rebuilt => it will not be regenerated

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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: 22
Registered: December 2011
Location: Germany
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: 14665
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


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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: 22
Registered: December 2011
Location: Germany
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: 14665
Registered: July 2009
Senior Member
You should change the default resource description strategy to hash the value into the eobjectdescription user data map

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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: 22
Registered: December 2011
Location: Germany
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: 14665
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?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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: 7655
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: 22
Registered: December 2011
Location: Germany
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: 14665
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)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
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 Apr 25 01:06:03 GMT 2024

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

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

Back to the top