<?xml version="1.0" encoding="UTF-8"?>
<project name="org.springframework.asm" xmlns:ivy="antlib:org.apache.ivy.ant">
	<property file="${basedir}/../build.properties"/>
	<import file="${basedir}/../build-spring-framework/package-bundle.xml"/>
	<import file="${basedir}/../spring-build/standard/default.xml"/>

	<target name="jar" depends="ivy.init, jar.init, jarjar.init"
			description="Creates a JAR file containing the output of a compilation of the source tree.">
		<delete quiet="true" file="${ivy.output.file}"/>
		<mkdir dir="${ivy.output.dir}"/>
		<delete quiet="true" file="${jar.output.file}"/>
		<mkdir dir="${jar.output.dir}"/>
		<delete quiet="true" file="${source-jar.output.file}"/>
		<mkdir dir="${source-jar.output.dir}"/>

		<delete quiet="true" dir="${target.dir}/jarjar-staging"/>
		<mkdir dir="${target.dir}/jarjar-staging"/>
		<ivy:retrieve resolveId="asm.path" pattern="${target.dir}/jarjar-staging/[artifact].[ext]" conf="jarjar" type="jar"
			log="download-only"/>

		<jarjar destfile="${jar.output.file}" index="true" filesetmanifest="merge">
			<manifest>
				<attribute name="Bundle-ManifestVersion" value="2"/>
				<attribute name="Bundle-Version" value="${bundle.version}"/>
				<attribute name="Implementation-Title" value="${implementation.title}"/>
				<attribute name="Implementation-Version" value="${implementation.version}"/>
			</manifest>
			<zipfileset src="${target.dir}/jarjar-staging/com.springsource.org.objectweb.asm.jar"/>
			<zipfileset src="${target.dir}/jarjar-staging/com.springsource.org.objectweb.asm.commons.jar"/>
			<rule pattern="org.objectweb.asm.**" result="org.springframework.asm.@1"/>
		</jarjar>
		<antcall target="bundlor"/>
		<jar destfile="${source-jar.output.file}" basedir="${main.java.dir}" index="true"/>
		<ivy:publish resolver="integration" pubdate="${timestamp}" status="${release.type}">
			<artifacts pattern="${jar.output.dir}/[artifact].[ext]"/>
			<artifacts pattern="${source-jar.output.dir}/[artifact].[ext]"/>
			<artifacts pattern="${ivy.output.dir}/[artifact].[ext]"/>
		</ivy:publish>
	</target>

	<target name="jarjar.init" depends="ivy.init">
		<ivy:cachepath resolveId="jarjar.classpath" pathid="jarjar.classpath" organisation="com.google.jarjar"
				module="com.springsource.com.tonicsystems.jarjar" revision="1.0.0" conf="compile" inline="true"
				type="jar" log="download-only"/>
		<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpathref="jarjar.classpath"/>
	</target>

</project>
