<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright (c) 2002, 2015 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
 -->

<project name="Build Team and CVS plugins" basedir="." default="init">

  <property name="root" value="${basedir}/.."/>
  <property name="temp" value="${root}/__temp"/>
  <property name="plugins" value="${temp}/eclipse/plugins"/>
  <property name="versionSuffix" value="_3.0.0"/>

  <target name="init">
    <tstamp/>

    <delete dir="${temp}"/>
    <mkdir dir="${plugins}"/>

    <antcall target="org.eclipse.team.core"/>
    <antcall target="org.eclipse.team.ui"/>
    <antcall target="org.eclipse.team.cvs.core"/>
    <antcall target="org.eclipse.team.cvs.ui"/>
    <antcall target="org.eclipse.releng.tools"/>
    <zip zipfile="${basedir}/selfhost${DSTAMP}.zip"
       basedir="${temp}"
    />

    <delete dir="${temp}"/>
    <eclipse.refreshLocal resource="org.eclipse.team.tests.cvs.core"/>
  </target>

  <target name="org.eclipse.team.core">
    <antcall target="buildPlugin">
      <param name="pluginName" value="org.eclipse.team.core" />
      <param name="jarName" value="team.jar" />
    </antcall>
  </target>

  <target name="org.eclipse.releng.tools">
    <antcall target="buildPlugin">
      <param name="pluginName" value="org.eclipse.releng.tools" />
      <param name="jarName" value="tools.jar" />
    </antcall>
  </target>

  <target name="org.eclipse.team.ui">
    <antcall target="buildPlugin">
      <param name="pluginName" value="org.eclipse.team.ui" />
      <param name="jarName" value="teamui.jar" />
    </antcall>
  </target>

  <target name="org.eclipse.team.cvs.core">
    <antcall target="buildPlugin">
      <param name="pluginName" value="org.eclipse.team.cvs.core" />
      <param name="jarName" value="cvs.jar" />
    </antcall>
  </target>

  <target name="org.eclipse.team.cvs.ui">
    <antcall target="buildPlugin">
      <param name="pluginName" value="org.eclipse.team.cvs.ui" />
      <param name="jarName" value="teamcvsui.jar" />
    </antcall>
  </target>

  <target name="buildPlugin">
    <copy todir="${plugins}/${pluginName}${versionSuffix}">
      <fileset dir="${root}/${pluginName}"/>
    </copy>
    <jar jarfile="${plugins}/${pluginName}${versionSuffix}/${jarName}"
         basedir="${plugins}/${pluginName}${versionSuffix}/bin"
    />
    <delete dir="${plugins}/${pluginName}${versionSuffix}/bin"/>
  </target>

</project>