Creating an XText based Product [message #1862416] |
Sun, 03 December 2023 22:41 |
Steve Hickman 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 #1862431 is a reply to message #1862428] |
Mon, 04 December 2023 17:55 |
Steve Hickman 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 |
Steve Hickman 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 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 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 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
|
|
|
Powered by
FUDForum. Page generated in 0.04055 seconds