Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using linked .jar libraries in code generator
Using linked .jar libraries in code generator [message #1767277] Tue, 04 July 2017 12:20 Go to next message
Mark Green is currently offline Mark GreenFriend
Messages: 37
Registered: June 2017
Member
I have been trying to write a code generator, however the established compiler I am working from uses the javax.json library via a JAR file. I have added the JAR file to my project but when I run the Runtime Eclipse it generates a long series of errors about the JAR file being missing. I have already added it to build.properties. Do I need to add it to the MWE2 file or to plugin.xml somewhere?
Re: Using linked .jar libraries in code generator [message #1767278 is a reply to message #1767277] Tue, 04 July 2017 12:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
Hi,

did you add it to the manifest, runtime tab?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using linked .jar libraries in code generator [message #1767282 is a reply to message #1767277] Tue, 04 July 2017 12:39 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 748
Registered: July 2009
Location: Dortmund, Germany
Senior Member

and also to build.properties
Re: Using linked .jar libraries in code generator [message #1767325 is a reply to message #1767282] Tue, 04 July 2017 16:18 Go to previous messageGo to next message
Mark Green is currently offline Mark GreenFriend
Messages: 37
Registered: June 2017
Member
Ah, ok. Adding it to runtime worked. But doGenerate apparently never runs.
Re: Using linked .jar libraries in code generator [message #1767326 is a reply to message #1767325] Tue, 04 July 2017 16:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
yes that is intended. for your libary no code is generated. only for sources in the project

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using linked .jar libraries in code generator [message #1767328 is a reply to message #1767326] Tue, 04 July 2017 16:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
see org.eclipse.xtext.builder.BuilderParticipant.getRelevantDeltas(IBuildContext)

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using linked .jar libraries in code generator [message #1767333 is a reply to message #1767328] Tue, 04 July 2017 17:15 Go to previous messageGo to next message
Mark Green is currently offline Mark GreenFriend
Messages: 37
Registered: June 2017
Member
Sorry but I don't understand that response at all. The only library I talked about was the JSON library. Of course no code would be generated for that, it is not written in my DSL. In the runtime eclipse I have a DSL-project with DSL-sources in it. Nothing is generated for them and according to a println I put in doGenerate(), it is never being called. The getRelevantDeltas method has no documentation that I could find. Is generation not run by default? If there is something extra that needs to be done to make the code generator run could it be added to https://eclipse.org/Xtext/documentation/303_runtime_concepts.html ?


Re: Using linked .jar libraries in code generator [message #1767335 is a reply to message #1767333] Tue, 04 July 2017 17:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
well i get nice code generated for

entity X extends demo {

}


import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.eclipse.xtext.xbase.lib.util.ToStringBuilder;

@SuppressWarnings("all")
public class X extends demo {
public X() {
}

public X(final Procedure1<X> initializer) {
initializer.apply(this);
}

@Override
public String toString() {
String result = new ToStringBuilder(this).addAllFields().toString();
return result;
}
}


so i have no idea what you are talking about.

- sure model is in source folder
- build automatically is on
- project has xtext nature and xtext builder?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using linked .jar libraries in code generator [message #1767336 is a reply to message #1767335] Tue, 04 July 2017 17:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
p.s:

in xbase you usally implement JvmModelInferrer and no generator
so i am not sure which prinltn you are referring to?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using linked .jar libraries in code generator [message #1767338 is a reply to message #1767336] Tue, 04 July 2017 18:16 Go to previous messageGo to next message
Mark Green is currently offline Mark GreenFriend
Messages: 37
Registered: June 2017
Member
Ah, sorry, the DSL does not compile to Java so I have written a Generator class.

Edit: The project doesn't seem to have a Builder configured, there doesn't seem to be a project type generated for the DSL. The 15 minute tutorial says to use a Java project so I tried one of those, but the generator still isn't running. There's only two options for the Builder, Ant Build and "Program", there doesn't seem to be an option to run the XText-created Generator.

Also I noticed that in the documentation at https://eclipse.org/Xtext/documentation/303_runtime_concepts.html it omits the IGeneratorContext parameter in the example.

[Updated on: Tue, 04 July 2017 18:52]

Report message to a moderator

Re: Using linked .jar libraries in code generator [message #1767339 is a reply to message #1767338] Tue, 04 July 2017 18:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
if you create or open a .yourdsl project xtext asks if you want to add the stuff
you can do a rightclick on the project -> configure -> xtext project as well


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using linked .jar libraries in code generator [message #1767340 is a reply to message #1767339] Tue, 04 July 2017 18:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
created https://github.com/eclipse/xtext/issues/1122

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Using linked .jar libraries in code generator [message #1767344 is a reply to message #1767339] Tue, 04 July 2017 19:48 Go to previous message
Mark Green is currently offline Mark GreenFriend
Messages: 37
Registered: June 2017
Member
Christian Dietrich wrote on Tue, 04 July 2017 18:57
if you create or open a .yourdsl project xtext asks if you want to add the stuff
you can do a rightclick on the project -> configure -> xtext project as well


Ah, ok, the right click worked. Thanks! Sorry, it is a bit confusing to have this called an "Xtext project" when the project it is not written in Xtext.
Previous Topic:Adding a library to an Xbase DSL
Next Topic:Semantic Highlighting Cross-References
Goto Forum:
  


Current Time: Sun Oct 24 14:41:56 GMT 2021

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

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

Back to the top