[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: User-defined project-name for Ant-Task Code-Generation

Marcus,

It sounds like you'd want to specify editProject/editProjectFragmentPath and editorProject/editorProjectFragmentPath as well; I assume those are supported by the Ant task as the are for the command line invocation.


Marcus Krause wrote:
Hi,

I'm currently trying to build a basic EMF-editor based on given ecore/genmodel-files. (in Eclipse)
So I do have 3 projects so called emfedi.model, emfedi.EMFedit and emfedi.EMFeditor!
In every project there are the same ecore/genmodel-files and an Ant buildfile that should generate sourcecode and puts it in src-directory of the according project.


The buildfiles uses the example from API
-> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.doc/references/javadoc/org/eclipse/emf/importer/ecore/taskdefs/EcoreGeneratorTask.html




The problem is:
When generating the code, eclipse creates a new project with following scheme:
CurrentProjectName.edit, CurrentProjectName.editor, etc.


But I just want to put the generated code in the src-directory of the project from within the buildfile is called.

Maybe anyone could point me to a solution for this issue!


Thanks in advance, Marcus.


Example - codegen.xml of project "emfedi.EMFedit": <?xml version="1.0" encoding="UTF-8"?> <project name="emfEdi.EMFedit" default="codegen" basedir=".">

    <!-- Global properties definitions -->
    <dirname property="antfile.dir" file="${ant.file}"/>

<!-- property definitions -->
<property file ="build.properties"/>


<!-- path definitions -->

<!-- target definitions -->
<target name="moveEMFBasisToEMFDir">XXX</target>


<target name="codegen" depends="moveEMFBasisToEMFDir" if="GenmodelPresent.run" description="Creates EMF-Model-Code on basis of Ecore-Metamodel and Genmodel.">
<macrodef name="customEcore2Java">
<attribute name="modelName"/>
<element name="settings"/>
<sequential>
<emf.Ecore2Java
model="${basedir}/emf/Sample.ecore"
genModel="${basedir}/emf/Sample.genmodel"
modelProject="${basedir}"
modelProjectFragmentPath="src/"
reconcileGenModel="keep"
generateJavaCode="true"
generateModelProject="false"
generateEditProject="true"
generateEditorProject="false"
copyright="XXX"
jdkLevel="${JDK.level}"
validateModel="true">
<settings/>
</emf.Ecore2Java>
</sequential>
</macrodef>


<!-- Generating the code for project emfEdi.EMFedit -->
<customEcore2Java modelName="${model.name}">
<settings>
<arg line="-package http://www.in.tu-clausthal.de/emfEdi de.tu_clausthal.in.propra.emfEdi.EMFedit emfEdi"/>
</settings>
</customEcore2Java>
<echo>Creating EMF-sourcecode successfully.</echo>
</target>
</project>