<?xml version="1.0"?>

<project default="iterate">
    <property environment="env"/>
    <property name="DANGER_HOME" value="${env.DANGER_HOME}"/>

    <target name="iterate"
            description="run a target on all projects">
        <fail unless="TARGET" message="must specify a TARGET (eg. -DTARGET=clean)" />
        <iterate-over-projects target="${TARGET}" />
    </target>

    <macrodef name="iterate-over-projects">
        <attribute name="target" />
        <sequential>
            <!-- do the main locale first, so that interface files are present for the others -->
            <subant target="@{target}" inheritall="false">
                <fileset dir="${basedir}" includes="**/build.xml" excludes="build.xml" />
            </subant>
        </sequential>
    </macrodef>

</project>
