<?xml version="1.0" encoding="utf-8" ?>
<!-- this is in a separate file because <import> can only load files that exist before build starts. This separate project is executed using <ant> AFTER greenstone3 has been checked out, to allow us to import the source-fileset.xml file -->
<project name="create-sourcecode-component">

	<import file="${basedir}/distributions/${dist.name}/resources/xml/components.xml"/>
	<import file="${basedir}/distributions/${dist.name}/resources/xml/executables.xml"/>

	<target name="create-sourcecode-component">

		<copy todir="distributions/source-component">
			<fileset dir="distributions/${dist.name}">
				<patternset refid="greenstone3.source.component"/>
			</fileset>
		</copy>

		<!-- fix permissions -->
		<chmod perm="775">
			<fileset dir="distributions/source-component"><patternset refid="greenstone3.source.executables"/></fileset>
		</chmod>

		<!-- archive it -->
		<delete file="products/Greenstone-${version}-source-component.zip"/>
		<zip destfile="products/Greenstone-${version}-source-component.zip" basedir="distributions/source-component" includes="**/*"/>
		<exec dir="distributions/source-component" executable="bash">
			<arg value="-c"/>
			<arg value="tar -czf ../../products/Greenstone-${version}-source-component.tar.gz *"/>
		</exec>
	</target>


</project>
