<?xml version="1.0" encoding="UTF-8"?>
<!--
The contents of this file are subject to the terms of the Common Development
and Distribution License (the License). You may not use this file except in
compliance with the License.

You can obtain a copy of the License at http://www.netbeans.org/cddl.html
or http://www.netbeans.org/cddl.txt.

When distributing Covered Code, include this CDDL Header Notice in each file
and include the License file at http://www.netbeans.org/cddl.txt.
If applicable, add the following below the CDDL Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyrighted [year] [name of copyright owner]"

The Original Software is NetBeans. The Initial Developer of the Original
Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
Microsystems, Inc. All Rights Reserved.
-->
<project name="apisupport/apidocs" default="netbeans" basedir=".">

    <import file="../../nbbuild/templates/projectized.xml"/>

    <target name="netbeans-extra" depends="docs"/>
    
    <target name="docs-check" depends="init">
        <property name="docs.dir" location="${cluster}/docs"/>
        <property name="docs.zip" location="${docs.dir}/NetBeansAPIs.zip"/>
        <available property="have.docs" file="${docs.zip}"/>
    </target>

    <target name="docs" depends="docs-check" unless="have.docs">
        <fail message="Must have defined netbeans.javadoc.dir!">
            <condition>
                <not>
                    <isset property="netbeans.javadoc.dir"/>
                </not>
            </condition>
        </fail>
        <!-- Build Javadoc in the usual way: -->
        <property file="../../nbbuild/build.properties"/>
        <ant dir="../../nbbuild" target="build-javadoc" inheritall="false">
            <!-- Stable only: -->
            <property name="modules" value="apisupport/apidocs, mdr/mdrapi"/>
            <property name="fixedmodules" value="${config.fixedmodules.javadoc}"/>
            <property name="building.apisupport/apidocs" value="true"/><!-- avoid recursion -->
            <property name="javadoc.skip.brokenlinks.check" value="true" />
        </ant>
        <mkdir dir="${docs.dir}"/>
        <zip zipfile="${docs.zip}" compress="true">
            <fileset dir="${netbeans.javadoc.dir}">
                <exclude name="*.zip"/>
            </fileset>
        </zip>
    </target>
    
    <target name="javadoc"/><!-- dummy, see above -->
    
    <target name="netbeans" unless="building.apisupport/apidocs"><!-- see above -->
        <antcall target="projectized-common.netbeans"/>
    </target>
    
    <target name="clean" depends="projectized-common.clean">
        <fail message="Must have defined netbeans.javadoc.dir!">
            <condition>
                <not>
                    <isset property="netbeans.javadoc.dir"/>
                </not>
            </condition>
        </fail>
        <delete dir="${netbeans.javadoc.dir}"/>
    </target>

</project>
