<?xml version="1.0" encoding="UTF-8"?>

<!-- ==========================================================================
     Buildfile for Project 2, version 8.0
     Computer Science E-259

     This buildfile "shipped" in the root of the following hierarchy.

	 project2-8.0/
	   b2b/
	   myblockbuster/
         gif/
         jpg/
         xhtml/
         xml/
         xsl/
	   xtube/
	     gif/
	       logos/
	       map/
	       miscellany/
	     pdf/
	     svg/
	     wav/
	     xhtml/
	     xml/
	     xsl/
     
     To apply myblockbuster.xsl to myblockbuster.xml, execute
     `ant transform-myblockbuster` from within project2-8.0/.

     To apply xtube.xsl to xtube.xml for XHTML, execute
     `ant transform-xtube-xhtml` from within project2-8.0/.

     To apply xtube.xsl to xtube.xml for SVG, execute
     `ant transform-xtube-svg` from within project2-8.0/.

     To apply converter.xsl to xtube.xml, execute
     `ant convert-xtube` from within project2-8.0/.

     To apply all transformations, execute `ant transform` or 
     just `ant` from within project2-8.0/.

     To publish My Blockbuster's XHTML at
     http://www.people.fas.harvard.edu/~username/cscie259/project2-8.0/myblockbuster/,
     where username is your FAS username, execute `ant publish-myblockbuster` 
     from within project2-8.0/.

     To publish XTube's XHTML at
     http://www.people.fas.harvard.edu/~username/cscie259/project2-8.0/xtube/,
     where username is your FAS username, execute `ant publish-xtube-xhtml` 
     from within project2-8.0/.  

     To publish XTube's SVG at
     http://www.people.fas.harvard.edu/~username/cscie259/project2-8.0/xtube/,
     where username is your FAS username, execute `ant publish-xtube-svg` 
     from within project2-8.0/.  

     To publish all transformations' output at
     http://www.people.fas.harvard.edu/~username/cscie259/xhtml/project2-8.0/,
     where username is your FAS username, execute `ant publish` 
     from within project2-8.0/.
============================================================================ -->

<project name="project2" default="transform" basedir=".">

    <description>Project 2</description>
 
    <!-- init -->
    <target name="init">

        <!-- set the standard DSTAMP, TSTAMP, and TODAY properties -->
        <!-- according to the default formats                      -->
        <tstamp/>

    </target>

    <!-- apply My Blockbuster's transformation -->
    <target name="transform-myblockbuster" 
            depends="init" 
            description="apply myblockbuster.xsl to myblockbuster.xml">
        <java classname="org.apache.xalan.xslt.Process" fork="true">
            <arg line="-IN myblockbuster/xml/myblockbuster.xml"/>
            <arg line="-XSL myblockbuster/xsl/myblockbuster.xsl"/>
            <arg line="-OUT myblockbuster/xhtml/myblockbuster.html"/>
        </java>
    </target>

    <!-- apply XTube's transformation for XHTML -->
    <target name="transform-xtube-xhtml" 
            depends="init" 
            description="apply xtube.xsl to xtube.xml for XHTML output">
        <java classname="org.apache.xalan.xslt.Process" fork="true">
            <arg line="-IN xtube/xml/xtube.xml"/>
            <arg line="-XSL xtube/xsl/xtube.xsl"/>
            <arg line="-OUT xtube/xhtml/xtube.html"/>
            <arg line="-PARAM mode xhtml"/>
        </java>
    </target>

    <!-- apply XTube's transformation for SVG -->
    <target name="transform-xtube-svg" 
            depends="init" 
            description="apply xtube.xsl to xtube.xml for SVG output">
        <java classname="org.apache.xalan.xslt.Process" fork="true">
            <arg line="-IN xtube/xml/xtube.xml"/>
            <arg line="-XSL xtube/xsl/xtube.xsl"/>
            <arg line="-OUT xtube/svg/xtube.svg"/>
            <arg line="-PARAM mode svg"/>
        </java>
    </target>

    <!-- apply XTube's converter -->
    <target name="convert-xtube" 
            depends="init" 
            description="apply converter.xsl to xtube.xml">
        <java classname="org.apache.xalan.xslt.Process" fork="true">
            <arg line="-IN xtube/xml/xtube.xml"/>
            <arg line="-XSL xtube/xsl/converter.xsl"/>
            <arg line="-OUT xtube/xml/converted.xml"/>
        </java>
    </target>

    <!-- apply all transformations -->
    <target name="transform" 
            depends="transform-myblockbuster,transform-xtube-xhtml,transform-xtube-svg,convert-xtube"
            description="apply all transformations"/>

    <!-- publish My Blockbuster's XHTML -->
    <target name="publish-myblockbuster"
            depends="transform-myblockbuster"
            description="publish My Blockbuster's XHTML">
        <copy todir="${user.home}/public_html/cscie259/project2-8.0/myblockbuster">
             <fileset dir="myblockbuster">
                 <include name="gif/**/*"/>
                 <include name="jpg/**/*"/>
                 <include name="xhtml/**/*"/>
             </fileset>
        </copy>
        <chmod parallel="false" 
               perm="a+rX" 
               dir="${user.home}/public_html/cscie259/project2-8.0/myblockbuster" 
               includes="**/*" 
               type="both"/>
    </target> 

    <!-- publish XTube's XHTML and SVG -->
    <target name="publish-xtube"
            depends="publish-xtube-xhtml,publish-xtube-svg"
            description="publish XTube's XHTML and SVG"/>

    <!-- publish XTube's XHTML -->
    <target name="publish-xtube-xhtml"
            depends="transform-xtube-xhtml"
            description="publish XTube's XHTML">
        <copy todir="${user.home}/public_html/cscie259/project2-8.0/xtube">
             <fileset dir="xtube">
                 <include name="gif/**/*"/>
                 <include name="wav/**/*"/>
                 <include name="xhtml/**/*"/>
             </fileset>
        </copy>
        <chmod parallel="false" 
               perm="a+rX" 
               dir="${user.home}/public_html/cscie259/project2-8.0/xtube" 
               includes="**/*" 
               type="both"/>
    </target> 

    <!-- publish XTube's SVG -->
    <target name="publish-xtube-svg"
             depends="transform-xtube-svg"
             description="publish XTube's XHTML">
        <copy todir="${user.home}/public_html/cscie259/project2-8.0/xtube">
             <fileset dir="xtube">
                 <include name="gif/**/*"/>
                 <include name="svg/**/*"/>
                 <include name="wav/**/*"/>
             </fileset>
        </copy>
        <chmod parallel="false" 
               perm="a+rX" 
               dir="${user.home}/public_html/cscie259/project2-8.0/xtube" 
               includes="**/*" 
               type="both"/>
    </target> 

    <!-- publish both transformations' output -->
    <target name="publish" 
            depends="publish-myblockbuster,publish-xtube-xhtml,publish-xtube-svg"
            description="publish both transformations' output"/>

</project>
