blob: 7ac33f04d14d17ecca77de53a96e5d9a9deb286e [file] [log] [blame]
<!--
******************************************************************************
* Copyright (c) 2016 Oracle
* 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:
* Konstantin Komissarchik - initial implementation and ongoing maintenance
******************************************************************************
-->
<project name="corundum.macro.zip-dirs">
<macrodef name="zip-dirs">
<attribute name="source.dir"/>
<attribute name="dest.dir" default="@{source.dir}"/>
<attribute name="suffix" default="zip"/>
<attribute name="includes" default="*"/>
<attribute name="excludes" default=""/>
<element name="do" optional="true" implicit="true"/>
<sequential>
<if>
<available file="@{source.dir}"/>
<then>
<for param="dir">
<path>
<dirset dir="@{source.dir}" includes="@{includes}" excludes="@{excludes}"/>
</path>
<sequential>
<basename property="dir.name" file="@{dir}"/>
<property name="zip.file" value="@{dest.dir}/${dir.name}.@{suffix}"/>
<zip destfile="${zip.file}">
<fileset dir="@{dir}"/>
</zip>
<delete dir="@{dir}"/>
<do/>
<var name="zip.file" unset="true"/>
<var name="dir.name" unset="true"/>
</sequential>
</for>
</then>
</if>
</sequential>
</macrodef>
</project>