<?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="output.directory" location="${main.directory}"/>
	<property name="source.directory" value="src"/>
	<property name="genJDKLevel" value="5.0"/>
	
	<target name="codegen">

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

		<!-- Generating the code for the library model -->
		<multipleXSDs2Java genModelName="library">
			<settings>
				<model file="${main.directory}/model/libraryPart1.xsd"/>
				<model file="${main.directory}/model/libraryPart2.xsd"/>
				<arg line="-packages http://www.example.eclipse.org/Library1"/>
				<arg line="-packages http://www.example.eclipse.org/Library2"/>
				<arg line="-packageMap http://www.example.eclipse.org/Library1 org.examples.library.elements"/>
				<arg line="-packageMap http://www.example.eclipse.org/Library2 org.examples.library"/>
			</settings>
		</multipleXSDs2Java>
		
	</target>
</project>