Closed steve-hickman-epistimis closed 1 year ago
@steve-hickman-epistimis
Updated the Required-Bundle dependencies in the MANIFEST.MF of the base grammar project (the one with the .xtext file) to include io.typefox.xtext2langium;bundle-version="0.2.0"
Normally this is enough to be able to resolve io.typefox.xtext2langium.Xtext2LangiumFragment
in mwe2 file if you have a plug-in project. Are you using m2e? Is your DSL project somewhere in GitHub so I can take a look? Or better create a small Xtext project with the setup that reflects your project setup.
I'm using Eclipse 2022-09. The screenshot shows what I have installed.
I created a default XText 'Hello World' project using the defaults. I picked Maven / Fat Jar (see second screen shot)
I updated the Required-Bundle dependencies in the MANIFEST.MF of the base grammar project (the one with the .xtext file) to include io.typefox.xtext2langium;bundle-version="0.2.0"
I updated the Generate....mwe2
file in base grammar project, adding the prescribed snippet
fragment = io.typefox.xtext2langium.Xtext2LangiumFragment {
outputPath = './langium'
}
to the StandardLanguage
section as directed.
I still get:
Couldn't resolve reference to JvmIdentifiableElement 'outputPath'.
Couldn't resolve reference to JvmType 'io.typefox.xtext2langium.Xtext2LangiumFragment'.
errors in the .mwe2 file where I inserted the snippet.
BTW: I see the same problem if I choose Gradle instead of Maven for builds. I also the the same result if I don't even go to the 'Advanced' dialog - so that I get the default of 'None' for the Preferred Build System.
If you build an Eclipse plug-in, you need to add the xtext2langium p2 repository to your target platform.
@steve-hickman-epistimis It looks like the p2 repository packaging is broken. I will fix that and report here
@steve-hickman-epistimis
P2 jars are fixed now.
Please try the following p2 repository https://typefox.github.io/xtext2langium/download/updates/v0.3.0/
Also don't forget to add it to your Language *.target file (should be in the <your-lang>.target
project), otherwise maven-tycho build will fail:
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="io.typefox.xtext2langium" version="0.0.0"/>
<repository location="https://typefox.github.io/xtext2langium/download/updates/v0.3.0/"/>
</location>
@steve-hickman-epistimis I've release version v0.3.0, p2 repository is fixed now. In your runtime language project (with the Xtext grammar file) you should see this entries:
Please re-open if something else is missing.
I have tested this for both Maven and Gradle using the default 'Hello' XText project. This eliminates the unresolved reference errors and the .langium files are generated as expected. Interestingly, on the Gradle project, I did not have to add this to the dependencies in the build.gradle file to build in Eclipse. Don't know why - maybe the Gradle file only matters when building from the command line?
One other thing: For my actual DSL, I found that recreating the XText project and adding the langium dependency before the first time I selected "Generate XText Artifacts" worked. For those who still have problems getting this to work, consider that.
Thanks!
NOTE: You need to update your blog post (https://www.typefox.io/blog/xtext-to-langium) to reference the 0.3.0 version.
The usage directions are spartan - so much so that I haven't gotten this to work yet. So far I've done:
io.typefox.xtext2langium;bundle-version="0.2.0"
Generate....mwe2
file in base grammar project, adding the prescribed snippetto the
StandardLanguage
section as directed.I still get:
errors in the .mwe2 file where I inserted the snippet.
I know there must be a simple fix to this - I just don't know what it is. I haven't discovered it by looking through the test code for this either. Or on StackOverflow/ Eclipse Forums via Google searches. I apologize that I just don't know Eclipse well enough to know the solution to this.
Could I trouble you to update the directions to make them more explicit?