Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Regarding Compiler integration with Xtext
Regarding Compiler integration with Xtext [message #1784254] Sat, 24 March 2018 21:58 Go to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello,

I have build a xtext plugin. It is working fine with content assist ,validations and various other custom functionalities. However, I want now this plugin to work with my compiler. Can you please suggest pointer or provide inputs how can I include my compiler to run with existing xtext plugin. I want to compile my program by combining xtext plugin and my compiler. I am looking into the generator class and IXtextBuilder to achieve the same.

Thanks in advance.
Re: Regarding Compiler integration with Xtext [message #1784258 is a reply to message #1784254] Sun, 25 March 2018 09:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Well compiler is very unspecific.
With such a unspecific word builder participant or generator are the right places to look at


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding Compiler integration with Xtext [message #1784694 is a reply to message #1784258] Mon, 02 April 2018 17:22 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello Christian,

I am creating an Xtext Builder for my dsl. I have tried various things but was unable to create one.
1. First I override my override Class<? extends IXtextBuilderParticipant> bindIXtextBuilderParticipant() {
return ABSbuilder;
} with my Absbuilder. This is working fine but I need more options such as buildAll,clean and not just an incremental build as provided by IXtextBuilderParticipant. Also, I want not able to attach my custom nature to this builder although the dependency between the builder and nature in present in plugin.xml. Therefore, I tried to override the XtextBuilder.

2. For the Xtext Builder I added the dependency in plugin.xml created a class that extends the Xtend Builder and override @Override
public void configure(Binder binder) {
binder.bind(XtextBuilder.class).to(MyXtextBuilder.class);
} as explained in https://www.eclipse.org/forums/index.php/t/1069946/ but I am also getting registry error. Also, I am not sure where to create this Builder (in geneartor or in ui package).

Please let me know where I am doing wrong.

Thanks in advance.
Re: Regarding Compiler integration with Xtext [message #1784696 is a reply to message #1784694] Mon, 02 April 2018 18:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i dont understand. (1) is called in all cases you describe
see org.eclipse.xtext.builder.BuilderParticipant.build(IBuildContext, IProgressMonitor) (the default impl)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 02 April 2018 18:30]

Report message to a moderator

Re: Regarding Compiler integration with Xtext [message #1784699 is a reply to message #1784696] Mon, 02 April 2018 19:00 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Oh yes I will look into it.... Thank you so much. Just one more question, how can I attach my nature to this builder. Also, this is should be created in geneartor or the ui package?
Re: Regarding Compiler integration with Xtext [message #1784701 is a reply to message #1784699] Mon, 02 April 2018 19:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Builder and builder participant are not the same
So maybe you want to implement your own incremental project builder
( Assuming you don't use any xtext stuff in it)

You can create the nature where ever you want but usually it's done in the UI project


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding Compiler integration with Xtext [message #1784702 is a reply to message #1784701] Mon, 02 April 2018 19:23 Go to previous messageGo to next message
Mohd Danish is currently offline Mohd DanishFriend
Messages: 49
Registered: October 2017
Member
Hello,

Yes they are different, but in Xtext I was not able to implement my custom builder that extends the XtextBuilder. If I try to bind My custom builder by overriding
the e.g. public void configure(Binder binder) {
binder.bind(XtextBuilder.class).to(MyCustomXtextBuilder.class);
} in AbstractxxxxUiModule, I get the registry error ....Guice creation errors. Can we override the build method of XtextBuilder?
Re: Regarding Compiler integration with Xtext [message #1784703 is a reply to message #1784702] Mon, 02 April 2018 19:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
still do t get it.

if you want to provide a builder that is not interacting/using xtext then implement a IncrementalProjectBuilder additional to the xtext one.

if you just want to hook into the builderparticipant then bind it


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Regarding Compiler integration with Xtext [message #1784717 is a reply to message #1784703] Tue, 03 April 2018 08:10 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The Xtext nature and builder provide a variety of services that can be helpful if you use the full range of Xtext's capabilities.

Alternatively the Xtext nature/builder inflicts some unwelcome costs if you do not want these extra capabilities.

It is for you to decide what is appropriate for your application, but I recommend that once you make a positive decision to reject some of Xtext's capabilities, you do so consistently.

If you decide that you do not want the Xtext nature/builder then do not try to use any builder-related Xtext facilities. You are a conventional Eclipse developer who provides their own XXX Nature to invoke their own XXX Builder to do what is appropriate for *.xxx files. As always with Eclipse, copying existing examples is good, but probably the Xtext nature/builder is not a good example. Choose a much simpler example. The find references for extension points in the Manifest Editor is often a good way to find code to copy. (For Photon I have added an OCL nature/builder to fully escape from the Xtext nature/builder.)

NB. As of Photon M6, it is no longer necessary to implement your own Configure->Convert to XXX Project/Unconfigure XXX menu actions; there is a shared platform property page.

Regards

Ed Willink
Previous Topic:Linking in external file
Next Topic:PostProcessing
Goto Forum:
  


Current Time: Fri Apr 19 07:17:59 GMT 2024

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

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

Back to the top