Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [XTEND] Standalone compiler
[XTEND] Standalone compiler [message #710734] Fri, 05 August 2011 07:01 Go to next message
Eclipse UserFriend
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 07:05 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Fri, 05 August 2011 07:06] by Moderator

Re: [XTEND] Standalone compiler [message #710818 is a reply to message #710736] Fri, 05 August 2011 08:49 Go to previous messageGo to next message
Eclipse UserFriend
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 09:20 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Fri, 05 August 2011 11:12] by Moderator

Re: [XTEND] Standalone compiler [message #713140 is a reply to message #710839] Mon, 08 August 2011 02:31 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 11:16:25 EDT 2025

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

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

Back to the top