<?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="xsd2Java">
			<attribute name="modelName"/>
			<element name="settings"/>
			<sequential>
				<emf.XSD2Java
					model="${main.directory}/model/@{modelName}.xsd"
					genModel="${main.directory}/emf/@{modelName}.genmodel"
					modelProject="${main.directory}"
					modelProjectFragmentPath="${source.directory}"
					copyright="This is my code.">
					<settings/>
				</emf.XSD2Java>
			</sequential>
		</macrodef>

		<!-- Generating the code for the library model -->
		<xsd2Java modelName="library">
			<settings>
				<arg line="-packages http://www.example.eclipse.org/Library"/>
				<arg line="-packageMap http://www.example.eclipse.org/Library org.examples.library"/>
			</settings>
		</xsd2Java>
		
	</target>
</project>