<?xml version="1.0" encoding="UTF-8"?>
<!-- Apache Ant script to build spec.
     Philippe Le Hegaret, W3C -->
      
<project name="WS-Policy 1.5" default="main" basedir=".">
    <path id="saxon8.classpath">
        <pathelement location="saxon8/saxon8.jar"/>
    </path>
    <property name="htmlOutputDir" value="c:/WWW/2002/ws/policy/7/11/"/>
    <property name="stylesheet" value="xmlspec-policy.xsl"/>
    <property name="glossary" value="extract-glist.xsl"/>
	<property name="generateBPlist" value="generateBPlist.xsl"/>
    <property name="diffformat" value="diffspec.xsl"/>
    <property name="last-public-draft" value="20070706"/>
    <property name="primer-last-public-draft" value="20070928"/>
    <property name="guidelines-last-public-draft" value="20070928"/>
<!-- Not needed anymore   <property name="wsdl11elementidentifiers-last-public-draft" value="20070720"/>-->

    <target name="clean">
        <delete quiet="true" file="ws-policy-framework.html"/>
        <delete quiet="true" file="ws-policy-attachment.html"/>
        <delete quiet="true" file="ws-policy-primer.html"/>
        <delete quiet="true" file="ws-policy-guidelines.html"/>
    </target>

    <target name="validate-xsl" description="Validates all XML files.">
        <xmlvalidate lenient="true">
            <fileset dir="." includes="*.xsl"/>
        </xmlvalidate>
    </target>

    <target name="validate-svg" description="Validates all SVG files.">
        <xmlvalidate lenient="false" warn="yes">
            <fileset dir="." includes="*.svg"/>
        </xmlvalidate>
    </target>

    <target name="validate-policy-specs" description="Validates all WS Policy spec files."
        depends="glossaries, bestpractices">
        <xmlvalidate lenient="false" warn="yes" file="ws-policy-framework.xml"/>
        <xmlvalidate lenient="false" warn="yes" file="ws-policy-attachment.xml"/>
        <xmlvalidate lenient="false" warn="yes" file="ws-policy-primer.xml"/>
        <xmlvalidate lenient="false" warn="yes" file="ws-policy-guidelines.xml"/>
        <xmlvalidate lenient="false" file="wsdl11elementidentifiers.xml"/>
    </target>

    <target name="validate" depends="validate-xsl,validate-svg,validate-policy-specs"/>

    <target name="updateAcks"
        description="Update acknowledgements. Before running this, 
	update ackcurrent.xml via http://www.w3.org/2000/09/dbwg/details?group=39293 and ackold.xml
	via http://www.w3.org/2000/09/dbwg/details?group=39293&amp;former=1 .">
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="acknowledgements-current.txt"/>
            <arg value="ackcurrent.xml"/>
            <arg value="generate-acknowledgements.xsl"/>
            <arg value="participating=1"/>
        </java>
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="acknowledgements-old.txt"/>
            <arg value="ackold.xml"/>
            <arg value="generate-acknowledgements.xsl"/>
            <arg value="participating=0"/>
        </java>
    </target>

    <target name="html" description="Transforms xml into html.">
 <!--    <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}ws-policy-framework.html"/>
            <arg value="ws-policy-framework.xml"/>
            <arg value="${stylesheet}"/>
        </java>
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}ws-policy-attachment.html"/>
            <arg value="ws-policy-attachment.xml"/>
            <arg value="${stylesheet}"/>
        </java>-->
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}ws-policy-primer.html"/>
            <arg value="ws-policy-primer.xml"/>
            <arg value="${stylesheet}"/>
        </java>    
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}ws-policy-guidelines.html"/>
            <arg value="ws-policy-guidelines.xml"/>
            <arg value="${stylesheet}"/>
        </java>
<!--      <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}wsdl11elementidentifiers.html"/>
            <arg value="wsdl11elementidentifiers.xml"/>
            <arg value="${stylesheet}"/>
        </java>-->
    </target>

    <target name="glossaries" description="Generates glossary entries out of temdef elements">
<!--        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="glossary-framework.xml"/>
            <arg value="ws-policy-framework.xml"/>
            <arg value="${glossary}"/>
        </java>
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="glossary-attachment.xml"/>
            <arg value="ws-policy-attachment.xml"/>
            <arg value="${glossary}"/>
        </java>-->
    </target>
	
<target name="bestpractices" description="Generates Best Practice statements for the guidelines document.">
	<java fork="true" classname="net.sf.saxon.Transform">
    			            <classpath refid="saxon8.classpath"/>
    			            <arg value="-o"/>
    			            <arg value="guidelines-bestpractices.xml"/>
    			            <arg value="ws-policy-guidelines.xml"/>
    			            <arg value="${generateBPlist}"/>
    			        </java>
</target>

    <path id="diffmk.classpath">
        <pathelement location="${basedir}/diffmk.jar"/>
        <pathelement location="${basedir}/DiffMk.properties"/>
    </path>
    <target name="generateXMLdiff">
<!-- Not needed anymore  <java classname="com.sun.xtc.diffmk.DiffMk" fork="true">
            <arg value="-doctype"/>
            <arg value="xmlspec"/>
            <arg value="-diff"/>
            <arg value="both"/>
            <arg value="-words"/>
            <arg value="ws-policy-framework-tr${last-public-draft}.xml"/>
            <arg value="ws-policy-framework.xml"/>
            <arg value="ws-policy-framework-diff${last-public-draft}.xml"/>
            <classpath path="diffmk.jar:DiffMk.properties"> </classpath>
        </java>
        <java classname="com.sun.xtc.diffmk.DiffMk" fork="true">
            <arg value="-doctype"/>
            <arg value="xmlspec"/>
            <arg value="-diff"/>
            <arg value="both"/>
            <arg value="-words"/>
            <arg value="ws-policy-attachment-tr${last-public-draft}.xml"/>
            <arg value="ws-policy-attachment.xml"/>
            <arg value="ws-policy-attachment-diff${last-public-draft}.xml"/>
            <classpath path="diffmk.jar:DiffMk.properties"> </classpath>
        </java>-->
        <java classname="com.sun.xtc.diffmk.DiffMk" fork="true">
            <arg value="-doctype"/>
            <arg value="xmlspec"/>
            <arg value="-diff"/>
            <arg value="both"/>
            <arg value="-words"/>
            <arg value="ws-policy-guidelines-tr${guidelines-last-public-draft}.xml"/>
            <arg value="ws-policy-guidelines.xml"/>
            <arg value="ws-policy-guidelines-diff${guidelines-last-public-draft}.xml"/>
            <classpath path="diffmk.jar:DiffMk.properties"> </classpath>
        </java>
        <java classname="com.sun.xtc.diffmk.DiffMk" fork="true">
            <arg value="-doctype"/>
            <arg value="xmlspec"/>
            <arg value="-diff"/>
            <arg value="both"/>
            <arg value="-words"/>
            <arg value="ws-policy-primer-tr${primer-last-public-draft}.xml"/>
            <arg value="ws-policy-primer.xml"/>
            <arg value="ws-policy-primer-diff${primer-last-public-draft}.xml"/>
            <classpath path="diffmk.jar:DiffMk.properties"> </classpath>
        </java>
<!-- Not needed anymore        <java classname="com.sun.xtc.diffmk.DiffMk" fork="true">
            <arg value="-doctype"/>
            <arg value="xmlspec"/>
            <arg value="-diff"/>
            <arg value="both"/>
            <arg value="-words"/>
            <arg
                value="wsdl11elementidentifiers-tr${wsdl11elementidentifiers-last-public-draft}.xml"/>
            <arg value="wsdl11elementidentifiers.xml"/>
            <arg
                value="wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.xml"/>
            <classpath path="diffmk.jar:DiffMk.properties"> </classpath>
        </java>-->
    </target>
    <target name="generateHTMLdiff">
 <!-- Not needed anymore        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}ws-policy-framework-diff${last-public-draft}.html"/>
            <arg value="ws-policy-framework-diff${last-public-draft}.xml"/>
            <arg value="diffspec.xsl"/>
        </java>
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}ws-policy-attachment-diff${last-public-draft}.html"/>
            <arg value="ws-policy-attachment-diff${last-public-draft}.xml"/>
            <arg value="diffspec.xsl"/>
        </java>-->
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="${htmlOutputDir}ws-policy-primer-diff${primer-last-public-draft}.html"/>
            <arg value="ws-policy-primer-diff${primer-last-public-draft}.xml"/>
            <arg value="diffspec.xsl"/>
        </java>
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg
                value="${htmlOutputDir}ws-policy-guidelines-diff${guidelines-last-public-draft}.html"/>
            <arg value="ws-policy-guidelines-diff${guidelines-last-public-draft}.xml"/>
            <arg value="diffspec.xsl"/>
        </java>
<!-- Not needed anymore       <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg
                value="${htmlOutputDir}wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.html"/>
            <arg
                value="wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.xml"/>
            <arg value="diffspec.xsl"/>
        </java>-->
    </target>

    <target name="postprocess-diff">
<!-- Not needed anymore  <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="temp-ws-policy-framework-diff${last-public-draft}.xml"/>
            <arg value="ws-policy-framework-diff${last-public-draft}.xml"/>
            <arg value="diff-postprocess.xsl"/>
        </java>
        <copy tofile="ws-policy-framework-diff${last-public-draft}.xml"
            file="temp-ws-policy-framework-diff${last-public-draft}.xml" overwrite="true"/>
        <delete file="temp-ws-policy-framework-diff${last-public-draft}.xml"/>
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="temp-ws-policy-attachment-diff${last-public-draft}.xml"/>
            <arg value="ws-policy-attachment-diff${last-public-draft}.xml"/>
            <arg value="diff-postprocess.xsl"/>
        </java>
        <copy tofile="ws-policy-attachment-diff${last-public-draft}.xml"
            file="temp-ws-policy-attachment-diff${last-public-draft}.xml" overwrite="true"/>
        <delete file="temp-ws-policy-attachment-diff${last-public-draft}.xml"/> -->
      <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg value="temp-ws-policy-primer-diff${primer-last-public-draft}.xml"/>
            <arg value="ws-policy-primer-diff${primer-last-public-draft}.xml"/>
            <arg value="diff-postprocess.xsl"/>
        </java>
        <copy tofile="ws-policy-primer-diff${primer-last-public-draft}.xml"
            file="temp-ws-policy-primer-diff${primer-last-public-draft}.xml" overwrite="true"/>
        <delete file="temp-ws-policy-primer-diff${primer-last-public-draft}.xml"/>
        <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/> 
            <arg value="temp-ws-policy-guidelines-diff${guidelines-last-public-draft}.xml"/>
            <arg value="ws-policy-guidelines-diff${guidelines-last-public-draft}.xml"/>
            <arg value="diff-postprocess.xsl"/>
        </java>
        <copy tofile="ws-policy-guidelines-diff${guidelines-last-public-draft}.xml"
            file="temp-ws-policy-guidelines-diff${guidelines-last-public-draft}.xml"
            overwrite="true"/>
        <delete file="temp-ws-policy-guidelines-diff${guidelines-last-public-draft}.xml"/>
<!-- Not needed anymore      <java fork="true" classname="net.sf.saxon.Transform">
            <classpath refid="saxon8.classpath"/>
            <arg value="-o"/>
            <arg
                value="temp-wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.xml"/>
            <arg
                value="wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.xml"/>
            <arg value="diff-postprocess.xsl"/>
        </java>
        <copy
            tofile="wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.xml"
            file="temp-wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.xml"
            overwrite="true"/>
        <delete
            file="temp-wsdl11elementidentifiers-diff${wsdl11elementidentifiers-last-public-draft}.xml"/>-->

    </target>

    <target name="diff" depends="generateXMLdiff, postprocess-diff, generateHTMLdiff"/>
    <target name="changelog" description="Generate XML out of the CVS change log">
        <cvschangelog destfile="changelog.xml"/>
    </target>

    <target name="main" depends="validate-policy-specs,html"/>

</project>