<?xml version="1.0" encoding="UTF-8"?>
<project default="codegen" basedir="..">
	<dirname property="antfile.dir" file="${ant.file}"/>
    
    <!-- Global properties -->
	<property name="main.directory" location="${antfile.dir}/.."/>
	<property name="source.directory" value="src"/>
	
	<target name="codegen">

	    <!-- A macrodef makes it easier to generate code for multiple models in one script. -->
		<macrodef name="ecore2Java">
			<attribute name="modelName"/>
			<element name="settings"/>
			<sequential>
				<emf.Ecore2Java
					model="${main.directory}/model/@{modelName}.ecore"
					genModel="${main.directory}/emf/@{modelName}.genmodel"
					modelProject="${main.directory}"
					modelProjectFragmentPath="${source.directory}"
					modelPluginID="@{modelName}.model"
					copyright="This is my code.">					
					<settings/>
				</emf.Ecore2Java>
			</sequential>
		</macrodef>

		<!-- Generating the code for the library model -->
		<ecore2Java modelName="library">
			<settings>
				<arg line="-package http:///library.ecore org.examples Library"/>
			</settings>
		</ecore2Java>
		
	</target>
</project>