| <!-- |
| Copyright (c) 2009 Tasktop Technologies and others. |
| All rights reserved. This program and the accompanying materials |
| are made available under the terms of the Eclipse Public License v1.0 |
| which accompanies this distribution, and is available at |
| http://www.eclipse.org/legal/epl-v10.html |
| |
| Contributors: |
| Tasktop Technologies - initial API and implementation |
| --> |
| <project name="get dependent zips/tar.gz files for running plugin project tests" default="getBundle"> |
| <!-- these scripts are called by another script, such as getDependencies.xml or getTestDependencies.xml --> |
| |
| <target name="getBundle"> |
| <!-- <echo message="getDependenciesHelper.xml: basedir = ${basedir}"/> --> |
| <!-- requires the following params to be set --> |
| <!-- |
| <property name="url"/> [url to download and unpack, eg., http://.../.../foo.zip] |
| <property name="file"/> [filename of the url to download and unpack, eg., foo.zip] |
| --> |
| <!-- get the zip or tar.gz from the remote server if it's not already been downloaded --> |
| <available file="${downloadsDir}/${file}" property="theZipExists"/> |
| <antcall target="downloadFile"> |
| <param name="theFile" value="${file}"/> |
| <param name="theURL" value="${url}"/> |
| </antcall> |
| </target> |
| <target name="unpackBundle"> |
| <!-- requires the following params to be set --> |
| <!-- |
| <property name="file"/> [filename of the url to download and unpack, eg., foo.zip] |
| <property name="unpackDest"/> [path where to unpack, eg., ${buildDirectory}/.. or .] |
| <property name="isUnpackedFile"/> [filename and path for which if it exists we can assume that the unpack has already occurred, eg., ./plugins/org.eclipse.foo/plugin.xml] |
| --> |
| <sequential> |
| <!-- check if we've done this already --> |
| <available property="isUnpacked" file="${isUnpackedFile}"/> |
| |
| <!-- check the bundle type and unpack it accordingly --> |
| <condition property="isAZip"><contains string="${file}" substring=".zip" /></condition> |
| <condition property="isATar"><contains string="${file}" substring=".tar.gz" /></condition> |
| <antcall target="unzipFile"><param name="theFile" value="${downloadsDir}/${file}"/><param name="theDir" value="${unpackDest}"/></antcall> |
| <antcall target="untarFile"><param name="theFile" value="${downloadsDir}/${file}"/><param name="theDir" value="${unpackDest}"/></antcall> |
| |
| <!-- reset these properties for the next loop --> |
| <condition property="isAZip"><contains string="a" substring="z"/></condition> |
| <condition property="isATar"><contains string="a" substring="z"/></condition> |
| <condition property="isUnpacked"><contains string="a" substring="z"/></condition> |
| </sequential> |
| </target> |
| |
| <target name="unpackUpdateSite"> |
| <!-- requires the following params to be set --> |
| <!-- |
| <property name="file"/> [filename of the url to download and unpack, eg., foo.zip] |
| <property name="unpackDest"/> [path where to unpack, eg., ${buildDirectory}/../eclipse or .] |
| --> |
| <property name="tmpsite" value="${buildDirectory}/unpacktmp" /> |
| <sequential> |
| <mkdir dir="${unpackDest}/features" /> |
| <mkdir dir="${unpackDest}/plugins" /> |
| <mkdir dir="${tmpsite}/eclipse" /> |
| |
| <!-- check the bundle type and unpack it accordingly into a temp dir--> |
| <condition property="isAZip"><contains string="${file}" substring=".zip" /></condition> |
| <condition property="isATar"><contains string="${file}" substring=".tar.gz" /></condition> |
| <antcall target="unzipFile"><param name="theFile" value="${downloadsDir}/${file}"/><param name="theDir" value="${tmpsite}/eclipse"/></antcall> |
| <antcall target="untarFile"><param name="theFile" value="${downloadsDir}/${file}"/><param name="theDir" value="${tmpsite}/eclipse"/></antcall> |
| |
| <!-- use PDE to unpack features and plugins --> |
| <unpackUpdateJars site="${tmpsite}/eclipse" output="${unpackDest}" /> |
| |
| <!-- copy root files (if applicable?) --> |
| <copy todir="${unpackDest}"> |
| <fileset dir="${tmpsite}/eclipse"> |
| <include name="*" /> |
| </fileset> |
| </copy> |
| <delete dir="${tmpsite}" /> |
| |
| <!-- reset these properties for the next loop --> |
| <condition property="isAZip"><contains string="a" substring="z"/></condition> |
| <condition property="isATar"><contains string="a" substring="z"/></condition> |
| </sequential> |
| </target> |
| |
| <!-- helper methods --> |
| <target name="downloadFile" unless="theZipExists"><get src="${theURL}" dest="${downloadsDir}/${theFile}" usetimestamp="true"/><touch file="${downloadsDir}/${theFile}"/></target> |
| <target name="unzipFile" unless="isUnpacked" if="isAZip"><unzip src="${theFile}" dest="${theDir}" overwrite="true" /></target> |
| <target name="untarFile" unless="isUnpacked" if="isATar"><untar src="${theFile}" dest="${theDir}" overwrite="true" compression="gzip"/></target> |
| <target name="unpackJar" unless="isUnpacked" if="jarExists"><unjar src="${theJar}" dest="${theDir}" overwrite="true"/></target> |
| </project> |