<project name="x-resources-impl">
    <target name="-before-inherit-resources"/>
    <target name="-after-inherit-resources"/>
    <target name="-inherit-resources">
        <for list="${package.base.packages}" param="base">
            <sequential>
                <local name="base.path"/>
                <local name="base.resource.path"/>
                <property name="base.path" location="@{base}"/>
                <property name="base.resource.path" location="${base.path}/resources"/>
                <echo>Merging resources from base package ${base.path}</echo>
                <if>
                    <available file="${base.resource.path}" type="dir"/>
                    <then>
                        <copy todir="${build.out.resources.dir}/" overwrite="true">
                            <fileset dir="${base.resource.path}" includes="**/*"/>
                        </copy>
                    </then>
                </if>
            </sequential>
        </for>
    </target>
    
    <target name="-before-copy-resources"/>
    <target name="-after-copy-resources"/>
    <target name="-copy-resources">
        <echo>Merging resources from current package ${package.resources.dir}</echo>
        <copy todir="${build.out.resources.dir}" overwrite="true">
            <fileset dir="${package.resources.dir}" includes="**/*"/>
        </copy>
        <property name="target.json.resources.dir" value="${package.output.base}"/>
        <property name="target.config.resources.dir" value="${build.resources.dir}"/>
        <x-compile refid="${compiler.ref.id}">
            <![CDATA[
                resources
                    -excludes=-all*.css
                    -out=${target.config.resources.dir}
                and
                resources
                    -model=true
                    -out=${target.json.resources.dir}
            ]]>
        </x-compile>
    </target>
</project>