Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [XTEND] Standalone compiler
[XTEND] Standalone compiler [message #710734] Fri, 05 August 2011 11:01 Go to next message
Fer  is currently offline Fer Friend
Messages: 3
Registered: August 2011
Junior Member
Hello,

We are trying to compile an xtend fiel within an Ant task. To do it, we first develope a compilation class in Eclipse where everything worked fine (we based our code in the org.eclipse.xtext.xtend2.tests.compiler.TestCaseCompiler class) and then we converted this class into an ant Task.

The problem is that when we try to compile the xtend file from ant we always get following errors when executing "EcoreUtil.resolveAll(resource)":

java.lang.RuntimeException: [XtextLinkingDiagnostic: null:20 Couldn't resolve reference to JvmDeclaredType 'MsfServerInfo'., XtextLinkingDiagnostic: null:20 Couldn't resolve reference to JvmIdentifiableElement 'getClassPathEntries'., XtextLinkingDiagnostic: null:32 Couldn't resolve reference to JvmDeclaredType 'MsfServerInfo'., XtextLinkingDiagnostic: null:32 Couldn't resolve reference to JvmIdentifiableElement 'getViewModulesFiles'.]

We guess this is happening because within the xtend file there is an import including the MsfServerInfo class, and the EcoreUtil resolver cannot find it, so the question is... is there a way to add files to the "xtend classpath" so that they can be found during resolution and compilation phases?

Thank you very much in advance for your help.
Re: [XTEND] Standalone compiler [message #710736 is a reply to message #710734] Fri, 05 August 2011 11:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi,

you have to add the class to the classpath you invoke xtend2-component with. then it should work.
for debugging see org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 05 August 2011 11:06]

Report message to a moderator

Re: [XTEND] Standalone compiler [message #710818 is a reply to message #710736] Fri, 05 August 2011 12:49 Go to previous messageGo to next message
Fer  is currently offline Fer Friend
Messages: 3
Registered: August 2011
Junior Member
Thank you very much for your quick answer Christian, actually something like that was what I was trying to do, the "problem" is that I need to do it at runtime... I have tried to add the folder containing the class to the SystemClassLoader before load the Resource and invoke the resolver, but this is not working at all, is there a way to get the ClassLoader that the ClasspathTypeProvider is using at runtime and this way be able to add to it the "extra classes"?

Thanks a lot again for your help.
Re: [XTEND] Standalone compiler [message #710839 is a reply to message #710818] Fri, 05 August 2011 13:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Hi,

can you share sample code?

<project name="test" default="gen">
	
	<path id="gen.classpath">
			<pathelement location="bin"/>
			<fileset dir="/Applications/eclipseNightly/plugins" includes="*xtext*.jar, 
				*mwe*.jar, 
				org.apache*.jar,
				org.antlr.*.jar, 
				org.eclipse.emf*.jar, 
				com.google.*.jar"/>
		</path>
	 
		<target name="gen">
			<java classname="test.Main" dir="." classpathref="gen.classpath" fork="true">
				
			</java>
		</target>
</project>

works for me

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 05 August 2011 15:12]

Report message to a moderator

Re: [XTEND] Standalone compiler [message #713140 is a reply to message #710839] Mon, 08 August 2011 06:31 Go to previous message
Fer  is currently offline Fer Friend
Messages: 3
Registered: August 2011
Junior Member
Hi Christian,

Once again thanks a lot for your quick reply. You were completely right, as I told you my problem was that I needed to load the classpath, but I need to do it programmatically from java not from ant file, but I was not making it correctly so that's why it did not work, I made an small change in my java code and now everything is working properly.

Thank you very much for all your support.

Best regards.
Previous Topic:Preprocessor and Macros
Next Topic:How do I use my language
Goto Forum:
  


Current Time: Tue Apr 20 05:09:49 GMT 2021

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

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

Back to the top