Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 286495

Summary: [Generator] improve generated workflow file
Product: [Modeling] TMF Reporter: Alexander Nittka <alex>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: sven.efftinge
Version: 0.7.1Keywords: helpwanted
Target Milestone: M2   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Alexander Nittka CLA 2009-08-13 06:45:42 EDT
Currently a very minimal workflow file is generated into the MyProject.generator plugin. This is very nice for a first test of the generation process. However, it would be nice to show the user some more of the options (e.g. currently generation is not interrupted if there are errors in the model). Also, it is impossible to use that workflow file when invoking generation from the runtime workspace/some application, as model file, genfolder etc. cannot be passed on. In this respect, I liked the oAW workflow file better. 

This is why I propose to make the generated workflowfile a bit more complicated again, introducing variables, a conditional workflow component, and making visible some of the important options of the Reader and Generator component. This workflow file could be used in a more general context (by a fragment that adds a generate-Action to the UI) and is also more informative for the user without being too complex.

How about the following:

<workflow>
	<property name="genFolder" value="src-gen"/>
	<property name="modelFile" value="classpath:/model/MyModel.mydsl"/>
	<property name="doValidate" value="true"/>
	<property name="doSkipOnErrors" value="true"/>
	<property name="doCleanDirectory" value="true"/>
	<property name="fileEncodingToUse" value="MacRoman"/>
	
	<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup" platformUri=".."/>
	
	<if cond="${doCleanDirectory}">
		<component class="org.eclipse.emf.mwe.utils.DirectoryCleaner" directory="${genFolder}"/>
	</if>
	
	<component class="org.eclipse.xtext.MweReader" uri="${modelFile}">
		<!-- this class will be generated by the xtext generator -->
		<register class="org.xtext.example.MyDslStandaloneSetup"/>
		<validate value="${doValidate}"/>
	</component>
	
	<component class="org.eclipse.xpand2.Generator">
		<metaModel class="org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel"/>
		<fileEncoding value="${fileEncodingToUse}"/>
		<expand value="templates::Template::main FOR model"/>
		<genPath value="${genFolder}"/>
		<skipOnErrors value="${doSkipOnErrors}"/>
	</component>
</workflow>
Comment 1 Sven Efftinge CLA 2009-08-14 05:31:01 EDT
please provide a patch :-)
Comment 2 Knut Wannheden CLA 2009-08-24 03:22:27 EDT
Fixed in CVS HEAD. Please verify.
Comment 3 Karsten Thoms CLA 2017-09-19 16:22:51 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.