Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Creating an XText based Product
Creating an XText based Product [message #1862416] Sun, 03 December 2023 22:41 Go to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
The XText doc on CI (https://eclipse.dev/Xtext/documentation/350_continuous_integration.html#tycho-build) has an example of how to create a feature / plugin for an XText DSL. I have not yet found an example of creating an Eclipse product for an XText DSL. Can someone point me to one? In particular, I'm trying to make sure my target.target file contains all the appropriate location / unit references needed so that the product build results in a product that will launch and work properly.

Right now, I using the approach described here:
https://www.youtube.com/watch?v=ZmUrTlzqCXc

That works for Sirius but something is missing for XText.

For my XText product, the product file contains:
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>

<product name="UDDL Product" uid="com.epistimis.uddl.query.product" application="org.eclipse.ui.ide.workbench" version="1.0.0.qualifier" type="mixed" includeLaunchers="true" autoIncludeRequirements="true">

   <configIni use="default">
   </configIni>

   <launcherArgs>
      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
      </vmArgsMac>
   </launcherArgs>

   <launcher name="UQ">
      <win useIco="false">
         <bmp/>
      </win>
   </launcher>

   <vm>
      <macos include="true">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17</macos>
   </vm>

   <plugins>
      <plugin id="com.google.inject"/>
      <plugin id="javax.inject"/>
      <plugin id="org.eclipse.xtext"/>
   </plugins>

   <features>
      <feature id="com.epistimis.uddl.query.feature" installMode="root"/>
      <feature id="org.eclipse.platform" installMode="root"/>
   </features>

   <configurations>
      <plugin id="org.apache.felix.scr" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
      <plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
      <plugin id="org.eclipse.equinox.simpleconfigurator" autoStart="true" startLevel="1" />
   </configurations>

</product>



And my feature project contains:

<feature
      id="com.epistimis.uddl.query.feature"
      label="Query Feature "
      version="1.0.0.qualifier"
      provider-name="Epistimis LLC">

   <description>
      Support for UDDL Queries.
   </description>

   <plugin
         id="com.epistimis.uddl.query"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

   <plugin
         id="com.epistimis.uddl.query.ide"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

   <plugin
         id="com.epistimis.uddl.query.ui"
         download-size="0"
         install-size="0"
         version="0.0.0"
         unpack="false"/>

</feature>


I get a product that will launch. But when I try to create a new project based on my DSL, I get:

Failed to create injector for com.epistimis.uddl.query.Query (occurred in com.epistimis.uddl.query.ui.QueryExecutableExtensionFactory)
Failed to create injector for com.epistimis.uddl.query.Query

[Updated on: Mon, 04 December 2023 00:48]

Report message to a moderator

Re: Creating an XText based Product [message #1862417 is a reply to message #1862416] Mon, 04 December 2023 04:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14736
Registered: July 2009
Senior Member
Can you provide the actual error. (the other end of the stacktrace, missing dependencies reported in the log file etc)

besides that did not test if this one is still running
https://github.com/cdietrich/xtext-maven-example/blob/master/org.xtext.example.mydsl.product/org.xtext.example.mydsl.product.product


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com

[Updated on: Mon, 04 December 2023 05:25]

Report message to a moderator

Re: Creating an XText based Product [message #1862419 is a reply to message #1862417] Mon, 04 December 2023 08:18 Go to previous messageGo to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 162
Registered: February 2016
Senior Member
Hello Steve!

You can also take a look at the product file of this Xtext-based open source project to get some inspiration and compare it with your product file to identify the shortcomings:

https://github.com/itemis/MBSE4ME/blob/main/com.itemis.mbse4me.dsls.product/mbse4me.product


Hope that helps!
Tamás
Re: Creating an XText based Product [message #1862427 is a reply to message #1862419] Mon, 04 December 2023 16:29 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
Thanks for the product references. I'll check out both of them.

There is no log file or stacktrace that I can see. Nothing shows up in the console windlow or Error Log window - or in the .metadata directory. Whatever is happening happens as soon as I try to create a new DSL project.

Here's the content of my .metadata./.plugins directory in the workspace I'm using:
total 0
drwxr-xr-x@ 3 stevehickman  staff   96 Dec  3 16:47 com.epistimis.uddl.query.ui
drwxr-xr-x@ 5 stevehickman  staff  160 Dec  3 16:47 org.eclipse.core.resources
drwxr-xr-x@ 3 stevehickman  staff   96 Dec  3 16:47 org.eclipse.core.runtime
drwxr-xr-x@ 2 stevehickman  staff   64 Dec  3 16:46 org.eclipse.debug.core
drwxr-xr-x@ 2 stevehickman  staff   64 Dec  4 08:15 org.eclipse.debug.ui
drwxr-xr-x@ 2 stevehickman  staff   64 Dec  4 08:15 org.eclipse.e4.ui.workbench.swt
drwxr-xr-x@ 3 stevehickman  staff   96 Dec  3 16:47 org.eclipse.e4.workbench
drwxr-xr-x@ 2 stevehickman  staff   64 Dec  3 18:30 org.eclipse.emf.common.ui
drwxr-xr-x@ 7 stevehickman  staff  224 Dec  3 16:47 org.eclipse.jdt.core
drwxr-xr-x@ 4 stevehickman  staff  128 Dec  3 16:47 org.eclipse.jdt.ui
drwxr-xr-x@ 3 stevehickman  staff   96 Dec  3 16:47 org.eclipse.ui.ide
drwxr-xr-x@ 2 stevehickman  staff   64 Dec  4 08:18 org.eclipse.ui.views.log
drwxr-xr-x@ 3 stevehickman  staff   96 Dec  3 16:47 org.eclipse.ui.workbench
drwxr-xr-x@ 2 stevehickman  staff   64 Dec  4 08:15 org.eclipse.xtext.builder

and the content of the version.ini file:
#Mon Dec 04 08:14:45 PST 2023
org.eclipse.core.runtime=2
org.eclipse.platform=4.30.0.v20231115-1800


The configuration contents for the product as created is attached.
Re: Creating an XText based Product [message #1862428 is a reply to message #1862427] Mon, 04 December 2023 16:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14736
Registered: July 2009
Senior Member
i am quite sure these must be somehting in the log. maybe you can remote debug into the exception to get a stacktrace

maybe you also can try to activate from osgi console and see if there is a better error message e.g. missing dependencies


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com

[Updated on: Mon, 04 December 2023 16:59]

Report message to a moderator

Re: Creating an XText based Product [message #1862431 is a reply to message #1862428] Mon, 04 December 2023 17:55 Go to previous messageGo to next message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
Ahhh... No log or stack trace because I was trying to create a DSL project. By creating a general project and then a general file with the DSL extension, I get the stack trace as part of the file creation process.

I will pursue what's missing based on that stack trace and report back.

I suspect that creating the DSL project was a multi step process than threw away the stack trace in the middle.

[Updated on: Mon, 04 December 2023 17:57]

Report message to a moderator

Re: Creating an XText based Product [message #1862449 is a reply to message #1862431] Tue, 05 December 2023 18:07 Go to previous message
Steve Hickman is currently offline Steve HickmanFriend
Messages: 56
Registered: August 2017
Member
The stacktrace clarified the problem. The example provided by Tamas was a good inspiration. What I realized from that is that I should do the following:
0) Create a Product project and product file (Youtube link in original post shows you how).
1) Create a minimal Run Configuration
2) Save it to a file I can see (Open the configuration, select the Common tab, select Shared file, pick a location and the click Apply)
3) Open the Launch file created by the prior step and use the
<setEntry />
elements in the
<setAttribute key="selected_target_bundles">
element as a list of the plugins to include in the product. A copy/paste and global find/replace does that nicely.
4) Update the
target.target
file with location information. Many / Most of the plugins will be in one of the following repositories (adjusted for the release you're using):
	<repository location="https://download.eclipse.org/releases/2023-12"/>
	<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2023-12"/>
	<repository location="https://download.eclipse.org/oomph/simrel-orbit/milestone/latest"/>


Each of these should already have a location element in the file:
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
	<repository location="https://download.eclipse.org/oomph/simrel-orbit/milestone/latest"/>
</location>


but one can be added for each repository that isn't already there.

Then it's just a matter of figuring out which unit comes from which repository. There are several ways to do that:
A) Use the repository URL to look up the contents - you should get a web page that has a list of the contents.
B) Use Ctrl-Space for Content Assist- I'll admit I was surprised that this worked but it does (I don't know why - this is Eclipse - everything gets Content Assist!). You'll only get a valid choice to complete if that unit comes from that repository. You can also select the specific version if you need to or "0.0.0" to pick the current version.

If you're doing more than just vanilla XText, you may need additional repositories depending on your particular product.

I'm attaching both my product and target.target file to this post. The particular grammar used doesn't matter. This is a basic XText product with a full Eclipse IDE - if yours is similar, the required plugins should be essentially the same as these. I believe the primary distinction between this and Christian's example is that Christian's creates an SDK but does not result in an RCP application. (He can correct me if I'm wrong on that.) The plugins specific to my grammar are in
     <feature id="com.epistimis.uddl.query.feature" /> <!-- installMode="root"/>  -->


Note that both of the attached files are still a little bit of a mess. I don't know what
 installMode="root"
is for but commenting it out didn't appear to break anything in the product. Note also that the configuration settings are *NOT* the Eclipse defaults - those are taken from Christian's example. You can test that this works using the approach from the YouTube video listed at the top.

[Updated on: Tue, 05 December 2023 18:52]

Report message to a moderator

Previous Topic:TextMate file name and location
Next Topic:Code generation from DSL
Goto Forum:
  


Current Time: Mon Dec 09 20:23:05 GMT 2024

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

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

Back to the top