Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve Usage directions #1

Closed
steve-hickman-epistimis opened this issue Dec 16, 2022 · 8 comments
Closed

Improve Usage directions #1

steve-hickman-epistimis opened this issue Dec 16, 2022 · 8 comments
Assignees
Labels
bug Something isn't working question Further information is requested

Comments

@steve-hickman-epistimis
Copy link

steve-hickman-epistimis commented Dec 16, 2022

The usage directions are spartan - so much so that I haven't gotten this to work yet. So far I've done:

  1. Used the p2 to add this to my Eclipse install - and restarted Eclipse
  2. 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"
  3. 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.
4. Added the Maven dependency to the pom.xml of my base grammar project as below:

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>3.0.0</version>
				<executions>
					<execution>
						<id>mwe2Launcher</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>java</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
					<arguments>
						<argument>/${project.basedir}/src/com/epistimis/face/GenerateFace.mwe2</argument>
						<argument>-p</argument>
						<argument>rootPath=/${project.basedir}/..</argument>
					</arguments>
					<classpathScope>compile</classpathScope>
					<includePluginDependencies>true</includePluginDependencies>
					<cleanupDaemonThreads>false</cleanupDaemonThreads><!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
				</configuration>
				<dependencies>
					<dependency>
						<groupId>org.eclipse.xtext</groupId>
						<artifactId>xtext-antlr-generator</artifactId>
						<version>2.1.1</version>
					</dependency>
					<dependency>
					    <groupId>io.typefox.xtext2langium</groupId>
					    <artifactId>io.typefox.xtext2langium</artifactId>
					    <version>0.2.0</version>
					</dependency>
				</dependencies>
			</plugin>
  1. Ran Maven > Update Project to sync everything.
  2. Ran Project > Clean to rebuild the project

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.

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?

@dhuebner
Copy link
Member

@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.

@dhuebner dhuebner self-assigned this Dec 19, 2022
@dhuebner dhuebner added the question Further information is requested label Dec 19, 2022
@steve-hickman-epistimis
Copy link
Author

steve-hickman-epistimis commented Dec 20, 2022

I'm using Eclipse 2022-09. The screenshot shows what I have installed.
Screenshot 2022-12-20 at 1 49 39 PM

  1. I created a default XText 'Hello World' project using the defaults. I picked Maven / Fat Jar (see second screen shot)
    Screenshot 2022-12-20 at 1 52 16 PM

  2. 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"

  3. 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.

@spoenemann
Copy link
Member

If you build an Eclipse plug-in, you need to add the xtext2langium p2 repository to your target platform.

@dhuebner
Copy link
Member

@steve-hickman-epistimis
It looks like the p2 repository packaging is broken. I will fix that and report here

@dhuebner
Copy link
Member

@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>

@dhuebner dhuebner added the bug Something isn't working label Dec 22, 2022
@dhuebner
Copy link
Member

@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:
Bildschirm­foto 2022-12-22 um 16 11 00

Please re-open if something else is missing.

@steve-hickman-epistimis
Copy link
Author

steve-hickman-epistimis commented Dec 22, 2022

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!

@steve-hickman-epistimis
Copy link
Author

NOTE: You need to update your blog post (https://www.typefox.io/blog/xtext-to-langium) to reference the 0.3.0 version.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants