<?xml version="1.0" encoding="UTF-8"?>

<!--
    Copyright (c) 2005, 2010 IBM Corporation and others.

    This program and the accompanying materials
    are made available under the terms of the Eclipse Public License 2.0
    which accompanies this distribution, and is available at
    https://www.eclipse.org/legal/epl-2.0/

    SPDX-License-Identifier: EPL-2.0
   
    Contributors:
        IBM Corporation - initial API and implementation
 -->

<!-- 
 Build script to create the apt.core plugin. 
 This script assumes that the classes have already been compiled,
 and exist in the 'bin' subdirectory of the plugin project.
 The directory structure assumed by this script is as follows:
    [dev root]/
        [workspace]/
            [plugins]/
                org.eclipse.jdt.apt.core/
                    bin/
                    src/
                    scripts/          // contains this script
            plugin-export/            // will be created if necessary
                org.eclipse.jdt.apt.core_[version]/
            org.eclipse.jdt.apt.core_[version].zip  // will be created
        
-->

<project name="${plugin}" default="export plug-in [_1.0.0]" basedir="..">

<target name="export plug-in [_1.0.0]">
	<antcall target="zz_internal_export">
		<param name="plugin_version" value="3.2.0.qualifier"/>
	</antcall>
</target>

<target name="zz_internal_export">

	<tstamp/>
	<property name="export-dir" value="../../plugin-export" />
	<property name="plugin" value="org.eclipse.jdt.apt.core" />
	<property name="plugin-dir" value="${export-dir}/${plugin}_${plugin_version}"/>

	<echo message="TARGET: ${export-dir}" />
	<mkdir dir="${export-dir}" />
	<delete dir="${plugin-dir}" />
	<mkdir dir="${plugin-dir}" />

	<zip zipfile="${plugin-dir}/aptcore.jar">
		        <fileset dir="bin" />
	</zip>

	<echo message="UPDATE ${plugin}_${plugin_version}.jar" />
	<zip zipfile="${plugin-dir}/${plugin}_${plugin_version}.jar">
		<fileset dir=".">
		  <include name="mirrorapi.jar" /> 
		  <include name="plugin.xml" />
		  <include name="plugin.properties" />
		  <include name="META-INF/**" />
		  <include name=".options"/>
        </fileset>
	    <fileset dir="${plugin-dir}">
		  <include name="aptcore.jar"/>
	    </fileset>
	</zip>

	<echo message="UPDATE ${plugin}_${plugin_version}.jar with aptcore.jar" />
	<zip zipfile="${plugin-dir}/aptcoresrc.zip">
	    <fileset dir="src" />
	</zip>		

		

	<echo message="UPDATE aptcoresrc.zip" />
	<zip zipfile="${plugin-dir}/aptcoresrc.zip">
	    <fileset dir="src" />
	</zip>		

	<echo message="UPDATE ${export-dir}/../${plugin}_${plugin_version}.zip" />
	<zip zipfile="${export-dir}/../${plugin}_${plugin_version}.zip"
	    basedir="${export-dir}" 
	    includes="${plugin}_${plugin_version}/**"	/>		
</target>

</project>
