<project name="build.jars">
    <import file="properties.xml" />
    <import file="compile.xml" />

    <!-- Compiles main codebase, and builds jar for it -->
    <target name="jar.core" depends="compile" description="build core jar">
        <jar jarfile="${dest.dir}/core-renderer.jar" compress="true" index="true">
            <fileset dir="${dest.java.dir}">
                <include name="**/*.class"/>
                <exclude name="org/joshy/html/app"/>
                <exclude name="**/demo/**"/>
                <exclude name="**/test/**"/>
            </fileset>
            <fileset dir="${dest.dir}">
                <include name="resources/**"/>
            </fileset>
            <fileset dir="${dest.java.dir}">
                <include name="resources/**"/>
            </fileset>
        </jar>
	</target>

    <!-- builds minmal version of core jar, excluding entity files -->
    <target name="jar.core-minimal" depends="compile" description="build core jar">
        <jar jarfile="${dest.dir}/core-renderer-minimal.jar" compress="true" index="true">
            <fileset dir="${dest.java.dir}">
                <include name="**/*.class"/>
                <exclude name="org/joshy/html/app"/>
                <exclude name="**/demo/**"/>
                <exclude name="**/test/**"/>
            </fileset>
        </jar>
	</target>

    <!-- Compiles browser and main codebase, and builds jar for browser -->
    <target name="jar.browser" depends="compile.browser, jar.core" description="build browser jar">
        <jar jarfile="${dest.dir}/browser.jar" compress="true"
            manifest="${src.packaging.dir}/manifest"
            duplicate="preserve"
            index="true"
            >
            <fileset dir="${dest.java.dir}">
                <include name="org/xhtmlrenderer/demo/browser/**"/>
            </fileset>
            <zipfileset refid="xhtml.demos"/>
            <zipfileset refid="xhtml.splash"/>
            <fileset dir="${src.browser.icons.dir}">
              <include name="images/**" />
            </fileset>
            <fileset dir="${guide}">
                <include name="users-guide-r8.html"/>
                <include name="images/**/*"/>
                <include name="base.css"/>
                <include name="ug.css"/>
            </fileset>
        </jar>
    </target>
    
    <!-- Compiles SVG sample and main codebase, and builds jar for browser -->
    <target name="jar.svg" depends="compile.svg, jar.core" description="build SVG jar">
        <jar jarfile="${dest.dir}/svg.jar" compress="true"
            manifest="${src.packaging.dir}/manifest"
            duplicate="preserve"
            index="true"
            >
            <fileset dir="${dest.java.dir}">
                <include name="org/xhtmlrenderer/demo/svg/**"/>
            </fileset>
            <zipfileset refid="xhtml.svg"/>
        </jar>
    </target>

    <!-- Compiles DocBook sample and main codebase, and builds jar for browser -->
    <target name="jar.docbook" depends="compile.docbook, jar.core" description="build DocBook jar">
        <jar jarfile="${dest.dir}/docbook.jar"
            compress="true"
            manifest="${src.packaging.dir}/manifest"
            duplicate="preserve"
            index="true"
            >
            <fileset dir="${dest.java.dir}">
                <include name="org/xhtmlrenderer/demo/docbook/**"/>
            </fileset>
            <zipfileset refid="files.docbook"/>
        </jar>
    </target>

    <!-- Compiles about box and main codebase, and builds jar for about box -->
    <target name="jar.about" depends="compile.about" description="build about jar">
        <jar jarfile="${dest.dir}/aboutbox.jar" compress="true"
            manifest="${src.packaging.dir}/manifest"
            duplicate="preserve"
            index="true"
            >
            <fileset dir="${dest.java.dir}">
                <include name="org/xhtmlrenderer/demo/aboutbox/**"/>
            </fileset>
            <zipfileset refid="xhtml.about.demos"/>
            <zipfileset refid="xhtml.splash"/>
        </jar>
    </target>
</project>
