Skip to main content



      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 08:20 Go to next message
Eclipse UserFriend
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 08:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

did you add it to the manifest, runtime tab?
Re: Using linked .jar libraries in code generator [message #1767282 is a reply to message #1767277] Tue, 04 July 2017 08:39 Go to previous messageGo to next message
Eclipse UserFriend
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 12:18 Go to previous messageGo to next message
Eclipse UserFriend
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 12:21 Go to previous messageGo to next message
Eclipse UserFriend
yes that is intended. for your libary no code is generated. only for sources in the project
Re: Using linked .jar libraries in code generator [message #1767328 is a reply to message #1767326] Tue, 04 July 2017 12:32 Go to previous messageGo to next message
Eclipse UserFriend
see org.eclipse.xtext.builder.BuilderParticipant.getRelevantDeltas(IBuildContext)
Re: Using linked .jar libraries in code generator [message #1767333 is a reply to message #1767328] Tue, 04 July 2017 13:15 Go to previous messageGo to next message
Eclipse UserFriend
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 13:32 Go to previous messageGo to next message
Eclipse UserFriend
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?
Re: Using linked .jar libraries in code generator [message #1767336 is a reply to message #1767335] Tue, 04 July 2017 13:35 Go to previous messageGo to next message
Eclipse UserFriend
p.s:

in xbase you usally implement JvmModelInferrer and no generator
so i am not sure which prinltn you are referring to?
Re: Using linked .jar libraries in code generator [message #1767338 is a reply to message #1767336] Tue, 04 July 2017 14:16 Go to previous messageGo to next message
Eclipse UserFriend
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 14:52] by Moderator

Re: Using linked .jar libraries in code generator [message #1767339 is a reply to message #1767338] Tue, 04 July 2017 14:57 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Using linked .jar libraries in code generator [message #1767340 is a reply to message #1767339] Tue, 04 July 2017 14:58 Go to previous messageGo to next message
Eclipse UserFriend
created https://github.com/eclipse/xtext/issues/1122
Re: Using linked .jar libraries in code generator [message #1767344 is a reply to message #1767339] Tue, 04 July 2017 15:48 Go to previous message
Eclipse UserFriend
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 Jul 27 12:03:52 EDT 2025

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

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

Back to the top