<?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="projectized-common" basedir=".">

    <!-- XXX supply descriptions for the appropriate targets -->
    <!-- XXX prefix internal targets with '-' (and grep all module scripts which override or use these targets and update them to match) -->
    <!-- XXX should use namespaces for NB in-VM tasks from ant/browsetask and debuggerjpda/ant and apisupport/ant -->
    <!-- XXX move more things here from projectized.xml when possible and desirable -->

    <target name="basic-init" depends="common-init,-jdk-init">
        <!-- Synch the following property loads with NbModuleProject.makeEvalDefs: -->
        <property file="nbproject/private/private.properties"/>
        <property file="nbproject/project.properties"/>
        <!-- Do not try to set module.classpath here, in particular: -->
        <!-- during a clean, the ${foo/bar.dir} properties may not be set. -->
        <parseprojectxml project="." codenamebasedashesproperty="code.name.base.dashes" codenamebaseslashesproperty="code.name.base.slashes"/>
        <property name="module.jar.dir" value="modules"/>
        <property name="module.jar.basename" value="${code.name.base.dashes}.jar"/>
        <property name="module.jar" value="${module.jar.dir}/${module.jar.basename}"/>
        <condition property="has.javahelp">
            <and>
                <available file="javahelp"/>
                <!-- Special hack for core: -->
                <not><available file="javahelp/manifest.mf"/></not>
            </and>
        </condition>
        <property name="javahelp.jar.dir" value="modules/docs"/>
        <property name="javahelp.jar.basename" value="${code.name.base.dashes}.jar"/>
        <property name="javahelp.jar" value="${javahelp.jar.dir}/${javahelp.jar.basename}"/>
        <condition property="javahelp.class.path.extension" value="docs/${javahelp.jar.basename}">
            <isset property="has.javahelp"/>
        </condition>
	<property name="javac.source" value="1.4"/>
        <property name="javac.target" value="${javac.source}"/>
        <property name="javac.compilerargs" value=""/>
        <property name="module.auto.deps.xml" location="module-auto-deps.xml"/>
        <condition property="has.module.auto.deps">
            <available file="${module.auto.deps.xml}"/>
        </condition>
        <property name="jar-excludes" value="**/*.java,**/*.form,**/package.html,**/doc-files/"/>
    </target>

    <target name="-release.dir">
        <property name="release.dir" location="release"/>
        <condition property="has.release.dir">
            <available file="${release.dir}"/>
        </condition>
    </target>
    <target name="-release.files" depends="-release.dir" if="has.release.dir">
        <pathconvert pathsep="," property="release.files">
            <path>
                <fileset dir="${release.dir}"/>
            </path>
            <map from="${release.dir}${file.separator}" to=""/>
        </pathconvert>
    </target>
    <target name="files-init" depends="basic-init,-release.files">
        <property name="release.files" value=""/>
        <property name="extra.module.files" value=""/>
        <patternset id="module.files" includes="${release.files},${extra.module.files}">
            <include name="${module.jar}"/>
            <include name="${javahelp.jar}" if="has.javahelp"/>
            <include name="config/Modules/${code.name.base.dashes}.xml"/>
            <include name="config/ModuleAutoDeps/${code.name.base.dashes}.xml" if="has.module.auto.deps"/>
            <include name="ant/nblib/${code.name.base.dashes}.jar"/>
        </patternset>
    </target>

    <target name="compile" depends="init">
        <mkdir dir="${build.classes.dir}"/>
        <javac srcdir="${src.dir}" destdir="${build.classes.dir}" debug="${build.compiler.debug}" debuglevel="${build.compiler.debuglevel}" deprecation="${build.compiler.deprecation}" optimize="${build.compiler.optimize}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
            <classpath refid="cp"/>
            <compilerarg line="${javac.compilerargs}"/>
        </javac>
        <!-- Sanity check: -->
        <pathconvert pathsep=":" property="class.files.in.src">
            <path>
                <fileset dir="${src.dir}">
                    <include name="**/*.class"/>
                </fileset>
            </path>
        </pathconvert>
        <fail>
            <condition>
                <not>
                    <equals arg1="${class.files.in.src}" arg2=""/>
                </not>
            </condition>
            You have stray *.class files in ${src.dir} which you must remove.
            Probably you failed to clean your sources before updating them from CVS.
        </fail>
        <!-- OK, continue: -->
        <copy todir="${build.classes.dir}">
            <!-- #58298: strip comments to save some space -->
            <fileset dir="${src.dir}" includes="**/*.properties"/>
            <filterchain>
                <tokenfilter>
                    <!-- #61965: preserve #NOI18N and similar comments -->
                    <filetokenizer/>
                    <replaceregex pattern="^#(?!(PART)?(NO)?I18N).*[\r\n]+" replace="" flags="gm"/>
                </tokenfilter>
            </filterchain>
        </copy>
        <copy todir="${build.classes.dir}">
            <fileset dir="${src.dir}" excludes="${jar-excludes}"/>
        </copy>
    </target>

    <target name="compile-single" depends="init">
        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
        <mkdir dir="${build.classes.dir}"/>
        <!-- XXX consider forcing debug=true and deprecation=true -->
        <!-- XXX consider deleting the .class file first to force a rebuild -->
        <javac srcdir="${src.dir}" destdir="${build.classes.dir}"
               debug="${build.compiler.debug}" deprecation="${build.compiler.deprecation}"
               source="${javac.source}" target="${javac.target}" includes="${javac.includes}" optimize="${build.compiler.optimize}" includeantruntime="false">
            <classpath refid="cp"/>
            <compilerarg line="${javac.compilerargs}"/>
        </javac>
    </target>

    <target name="jar-prep" depends="init">
        <mkdir dir="${cluster}/${module.jar.dir}"/>
        <tstamp>
            <format property="buildnumber" pattern="yyMMdd" timezone="UTC"/>
        </tstamp>
    </target>

    <target name="jar" depends="init,compile,jar-prep">
        <!-- XXX it seems that using <manifest> forces the JAR to be recreated each time -->
        <!-- (presumably due to the variable OIDE-M-I-V) -->
        <!-- so might have to use e.g. <manifest> task (created in build/ somewhere)? -->
        <!-- Cf: http://issues.apache.org/bugzilla/show_bug.cgi?id=29085 -->
        <!-- This task adds some or all of: -Public-Packages, -Friends, Class-Path, -IDE-Dependencies, -Module-Dependencies, -Specification-Version, -Implementation-Version, -Build-Version -->
        <jarwithmoduleattributes jarfile="${cluster}/${module.jar}" compress="${build.package.compress}" index="${build.package.index}" manifest="${manifest.mf}">
            <fileset dir="${build.classes.dir}"/>
        </jarwithmoduleattributes>
    </target>
    
    <!-- Can insert extra stuff in here: -->
    <target name="netbeans-extra"/>

    <target name="module-xml-regular" if="is.regular">
        <mkdir dir="${cluster}/config/Modules"/>
        <createmodulexml xmldir="${cluster}/config/Modules">
            <enabled dir="${cluster}">
                <include name="${module.jar}"/>
            </enabled>
        </createmodulexml>
    </target>

    <target name="module-xml-autoload" if="is.autoload">
        <mkdir dir="${cluster}/config/Modules"/>
        <createmodulexml xmldir="${cluster}/config/Modules">
            <autoload dir="${cluster}">
                <include name="${module.jar}"/>
            </autoload>
        </createmodulexml>
    </target>

    <target name="module-xml-eager" if="is.eager">
        <mkdir dir="${cluster}/config/Modules"/>
        <createmodulexml xmldir="${cluster}/config/Modules">
            <eager dir="${cluster}">
                <include name="${module.jar}"/>
            </eager>
        </createmodulexml>
    </target>

    <target name="module-auto-deps" depends="basic-init" if="has.module.auto.deps">
        <mkdir dir="${cluster}/config/ModuleAutoDeps"/>
        <copy file="${module.auto.deps.xml}" tofile="${cluster}/config/ModuleAutoDeps/${code.name.base.dashes}.xml"/>
    </target>

    <target name="release" depends="files-init" if="has.release.dir">
        <mkdir dir="${cluster}"/>
        <copy todir="${cluster}">
            <fileset dir="${release.dir}">
                <patternset includes="${release.files}"/>
            </fileset>
        </copy>
    </target>
    
    <target name="verify-class-linkage" depends="jar,release">
        <verifyclasslinkage jar="${cluster}/${module.jar}" failonerror="false">
            <classpath refid="cp"/>
        </verifyclasslinkage>
    </target>

    <target name="netbeans" depends="init,jar,netbeans-extra,module-xml-regular,module-xml-autoload,module-xml-eager,javahelp,module-auto-deps,release,verify-class-linkage">
        <genlist outputfiledir="${cluster}" module="${module.jar}">
            <fileset dir="${cluster}">
                <patternset refid="module.files"/>
            </fileset>
        </genlist>
    </target>
    
    
    <property name="jnlp.signjar.alias" value="jnlp" />
    <property name="jnlp.signjar.keystore" location="${jnlp.dest.dir}/default.keystore" />
    <property name="jnlp.signjar.password" value="netbeans" />
    <property name="jnlp.codebase" value="file:${jnlp.dest.dir}" /><!-- XXX potential SPACE_IN_PATH bug -->
    
    <target name="jnlp" depends="init,netbeans,jnlp-master" description="Builds JNLP descriptor and signs JAR files" >
        <fail unless="jnlp.dest.dir" >
            You have to provide value to jnlp.dest.dir property!
        </fail>
        <fail unless="jnlp.signjar.keystore" >
            You have to provide value to jnlp.signjar.keystore property!
        </fail>
        <fail unless="jnlp.signjar.alias" >
            You have to provide value to jnlp.signjar.alias property!
        </fail>
        <fail unless="jnlp.signjar.password" >
            You have to provide value to jnlp.signjar.password property!
        </fail>
        
        <mkdir dir="${jnlp.dest.dir}" />
        
        <property name="jnlp.codebase" value="$$$$codebase" /> 
        
        <property name="jnlp.verify.excludes" value="" />
        <makejnlp 
            dir="${jnlp.dest.dir}" 
            alias="${jnlp.signjar.alias}"
            storepass="${jnlp.signjar.password}"
            keystore="${jnlp.signjar.keystore}"
            codebase="${jnlp.codebase}"
            verify="true"
            verifyexcludes="${jnlp.verify.excludes}"
        >
            <modules dir="${cluster}" >
                <include name="${module.jar}" />
            </modules>
        </makejnlp>
    </target>
    
    <target name="jnlp-master" depends="init,netbeans" if="jnlp.master.dir" >
        <property name="jnlp.master.codebase" value="" />
        <makemasterjnlp 
            dir="${jnlp.master.dir}"
            codebase="${jnlp.master.codebase}" 
        >
            <modules dir="${cluster}" >
                <include name="${module.jar}" />
            </modules>
        </makemasterjnlp>
    </target>
    
    
    <target name="-nbm-prompt-for-storepass" if="keystore" unless="storepass">
        <input addproperty="storepass" message="Enter password for ${keystore}:"/>
    </target>
    <target name="nbm" depends="init,netbeans,-nbm-prompt-for-storepass" description="Build NBM archive.">
        <mkdir dir="build"/>
        <makenbm file="build/${nbm}"
                 productdir="${cluster}"
                 module="${module.jar}"
                 homepage="${nbm.homepage}"
                 distribution="${nbm.distribution}"
                 needsrestart="${nbm.needs.restart}"
                 global="${nbm.is.global}"
                 releasedate="${nbm.release.date}"
		 moduleauthor="${nbm.module.author}">
            <license file="${license.file}"/>
            <signature keystore="${keystore}" storepass="${storepass}" alias="${nbm_alias}"/>
        </makenbm>
    </target>

    <target name="test-preinit" depends="init"/>
    <target name="test-init" depends="init,test-preinit,test-lib-init">
        <property name="test.unit.dir" location="test/unit"/>
        <property name="test.unit.src.dir" location="${test.unit.dir}/src"/>
        <property name="build.test.unit.dir" location="build/test/unit"/>
        <property name="build.test.unit.classes.dir" location="${build.test.unit.dir}/classes"/>
        <property name="build.test.unit.results.dir" location="${build.test.unit.dir}/results"/>
        <property name="test.filter.trace" value="true"/>
        <path id="test.unit.cp">
            <!-- Cannot use <path refid="cp"/> since that uses ${module.classpath} and we want ${module.run.classpath}: -->
            <pathelement path="${module.run.classpath}"/>
            <pathelement path="${cp.extra}"/>
            <pathelement location="${cluster}/${module.jar}"/>
            <path refid="test.unit.lib.cp"/>
            <pathelement path="${test.unit.cp.extra}"/>
        </path>
        <path id="test.unit.run.cp">
            <path refid="test.unit.cp"/>
            <pathelement location="${build.test.unit.classes.dir}"/>
            <pathelement path="${test.unit.run.cp.extra}"/>
        </path>
        <propertyset id="test.unit.properties">
            <propertyref prefix="test-unit-sys-prop."/>
            <mapper type="glob" from="test-unit-sys-prop.*" to="*"/>
        </propertyset>
    </target>

    <target name="test-build" depends="jar,do-test-build"/>

    <target name="do-test-build" depends="init,test-init">
        <mkdir dir="${build.test.unit.classes.dir}"/>
        <javac srcdir="${test.unit.src.dir}" destdir="${build.test.unit.classes.dir}"
               debug="true" deprecation="${build.compiler.deprecation}"
               source="${javac.source}" target="${javac.target}" optimize="${build.compiler.optimize}" includeantruntime="false">
               <exclude name="**/jars/**"/><!-- XXX for core only; fix in core, not here -->
               <exclude name="**/data/**"/><!-- XXX for openide/util and co. -->
            <classpath refid="test.unit.cp"/>
            <compilerarg line="${javac.compilerargs}"/>
        </javac>
        <copy todir="${build.test.unit.classes.dir}">
            <fileset dir="${test.unit.src.dir}">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy todir="${build.test.unit.dir}">
            <fileset dir="${test.unit.dir}">
                <include name="data/**"/>
            </fileset>
        </copy>
    </target>

    <target name="compile-test-single" depends="init,test-init,jar">
        <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
        <mkdir dir="${build.test.unit.classes.dir}"/>
        <!-- XXX consider forcing deprecation=true -->
        <!-- XXX consider deleting the .class file first to force a rebuild -->
        <javac srcdir="${test.unit.src.dir}" destdir="${build.test.unit.classes.dir}"
               debug="true" deprecation="${build.compiler.deprecation}"
               source="${javac.source}" target="${javac.target}" includeantruntime="false" optimize="${build.compiler.optimize}" includes="${javac.includes}">
            <classpath refid="test.unit.cp"/>
            <compilerarg line="${javac.compilerargs}"/>
        </javac>
        <copy todir="${build.test.unit.classes.dir}">
            <fileset dir="${test.unit.src.dir}">
                <exclude name="**/*.java"/>
            </fileset>
        </copy>
        <copy todir="${build.test.unit.dir}">
            <fileset dir="${test.unit.dir}">
                <include name="data/**"/>
            </fileset>
        </copy>
    </target>

    <target name="test" depends="init,test-init,test-build">
        <mkdir dir="${build.test.unit.results.dir}"/>
        <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.unit.results.dir}">
            <batchtest todir="${build.test.unit.results.dir}">
                <fileset dir="${test.unit.src.dir}">
                    <include name="**/*Test.java"/>
                </fileset>
            </batchtest>
            <classpath refid="test.unit.run.cp"/>
            <syspropertyset refid="test.unit.properties"/>
            <!-- <assertions> does not seem to work in Ant 1.6.1? -->
            <jvmarg value="-ea"/>
            <formatter type="brief" usefile="false"/>
            <formatter type="xml"/>
        </junit>
        <fail if="tests.failed">Some tests failed; see details above.</fail>
    </target>

    <target name="test-single" depends="init,test-init,test-build">
        <fail unless="test.includes">Must set test.includes</fail>
        <mkdir dir="${build.test.unit.results.dir}"/>
        <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.unit.results.dir}">
            <batchtest todir="${build.test.unit.results.dir}">
                <fileset dir="${test.unit.src.dir}" includes="${test.includes}"/>
            </batchtest>
            <classpath refid="test.unit.run.cp"/>
            <syspropertyset refid="test.unit.properties"/>
            <!-- <assertions> does not seem to work in Ant 1.6.1? -->
            <jvmarg value="-ea"/>
            <formatter type="brief" usefile="false"/>
            <formatter type="xml"/>
        </junit>
        <fail if="tests.failed">Some tests failed; see details above.</fail>
    </target>

    <target name="do-debug-test-single">
        <fail unless="test.class">Must set test.class</fail>
        <property name="test.report.file" location="${build.test.unit.results.dir}/TEST-${test.class}.xml"/>
        <delete file="${test.report.file}"/>
        <mkdir dir="${build.test.unit.results.dir}"/>
        <touch file="${test.report.file}" verbose="false"/>   <!-- must exist, otherwise the XML formatter would fail -->
        <java fork="true" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner">
            <jvmarg value="-Xdebug"/>
            <jvmarg value="-Xnoagent"/>
            <jvmarg value="-Djava.compiler=none"/>
            <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
            <jvmarg value="-ea"/>
            <classpath>
                <path refid="test.unit.run.cp"/>
                <pathelement location="${ant.home}/lib/ant.jar"/>
                <pathelement location="${ant.home}/lib/ant-junit.jar"/>
            </classpath>
            <syspropertyset refid="test.unit.properties"/>
            <arg value="${test.class}"/>
            <arg value="showoutput=true"/>
            <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
            <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
        </java>
    </target>

    <target name="debug-test-single" depends="init,test-init,test-build,do-debug-test-single"/>

    <target name="debug-test-single-nb" depends="init,test-init,test-build,-jdk-presetdef-nbjpdastart" if="netbeans.home">
        <fail unless="test.class">Must set test.class</fail>
        <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="${test.class}">
            <classpath>
                <path refid="test.unit.run.cp"/>
                <!-- Permit extra sources to be searched even if they are not in the actual CP. -->
                <!-- Used e.g. from ant/test/unit since some tests use dynamic loading: -->
                <pathelement path="${test.unit.debug.cp.extra}"/>
            </classpath>
        </nbjpdastart>
        <antcall target="do-debug-test-single"/>
    </target>

    <target name="-pre-debug-fix" depends="init">
        <fail unless="fix.class">Must set fix.class to e.g. org/netbeans/modules/foo/Bar</fail>
        <property name="javac.includes" value="${fix.class}.java"/>
    </target>
    <target name="debug-fix-nb" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
        <nbjpdareload>
            <fileset includes="${fix.class}*.class" dir="${build.classes.dir}"/>
        </nbjpdareload>
    </target>
    <target name="debug-fix-test-nb" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
        <nbjpdareload>
            <fileset includes="${fix.class}*.class" dir="${build.test.unit.classes.dir}"/>
        </nbjpdareload>
    </target>

    <target name="profile-test-single-nb" depends="init,test-init,test-build,-jdk-presetdef-nbprofiledirect">
        <fail unless="profile.class">Must set profile.class</fail>
        <mkdir dir="${build.test.unit.results.dir}"/>
        <nbprofiledirect
            jvmargsproperty="profiler.jvmargs"
            >
            <classpath refid="test.unit.run.cp"/>
        </nbprofiledirect>
        <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}">
            <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
            <jvmarg value="${profiler.info.jvmargs.agent}"/>
            <jvmarg line="${profiler.info.jvmargs}"/>
            <test name="${profile.class}"/>
            <classpath refid="test.unit.run.cp"/>
            <syspropertyset refid="test.unit.properties"/>
            <!-- <assertions> does not seem to work in Ant 1.6.1? -->
            <jvmarg value="-ea"/>
            <formatter type="brief" usefile="false"/>
            <formatter type="xml"/>
        </junit>
        <fail if="tests.failed">Some tests failed; see details above.</fail>
    </target>
    
    <target name="-javadoc-init" depends="init">
        <!-- #71884: default Javadoc title and header -->
        <property file="${manifest.mf}" prefix="mf."/>
        <property file="${src.dir}/${mf.OpenIDE-Module-Localizing-Bundle}" prefix="bundle."/>
        <condition property="javadoc.title" value="${bundle.OpenIDE-Module-Name}">
            <isset property="bundle.OpenIDE-Module-Name"/>
        </condition>
        <property name="javadoc.title" value="${code.name.base.dashes}"/> <!-- fallback -->
        <condition property="mf.OpenIDE-Module-Specification-Version" value="${spec.version.base}"> <!-- fallback -->
            <isset property="spec.version.base"/>
        </condition>
        <property name="mf.OpenIDE-Module" value="${code.name.base.dashes}"/> <!-- fallback -->
        <property name="mf.OpenIDE-Module-Implementation-Version" value=""/> <!-- fallback -->
        <property name="javadoc.header" value="${mf.OpenIDE-Module} ${mf.OpenIDE-Module-Specification-Version} ${mf.OpenIDE-Module-Implementation-Version}"/>
    </target>
    
    <target name="arch" depends="init" description="Process an arch.xml, creating it if it does not yet exist.">
        <fail unless="javadoc.arch">You must define e.g. javadoc.arch=$${basedir}/arch.xml in project.properties</fail>
        <mkdir dir="build"/>
        <property name="arch.output.html" location="build/arch.html"/>
        <property name="arch.generate" value="true"/>
        <arch answers="${javadoc.arch}" output="${arch.output.html}"
            project="nbproject/project.xml" 
        />
    </target>

    <target name="-arch-nb-check"> <!-- #67438: might not yet exist, if arch file newly generated as skeleton -->
        <condition property="-arch-nb-run">
            <and>
                <isset property="netbeans.home"/>
                <available file="${arch.output.html}"/>
            </and>
        </condition>
    </target>
    <target name="arch-nb" depends="init,arch,-arch-nb-check" if="-arch-nb-run" description="Process an arch.xml, creating it if it does not yet exist, and display the result.">
        <nbbrowse file="${arch.output.html}"/>
    </target>
    
    <target name="-testuserdir-delete-init" depends="files-init">
        <property name="test.user.dir" location="build/testuserdir"/>
        <property name="test.user.dir.lock" location="${test.user.dir}/lock"/>
        <available property="app.running" file="${test.user.dir.lock}"/>
    </target>
    <target name="-testuserdir-delete-ok" depends="-testuserdir-delete-init" unless="app.running">
        <delete dir="${test.user.dir}"/>
    </target>
    <target name="-testuserdir-delete-fail" depends="-testuserdir-delete-init" if="app.running">
        <!-- #66799: best to warn about this condition... -->
        <fail>Will not delete ${test.user.dir} because ${test.user.dir.lock} still exists; kill any running process and delete lock file if necessary</fail>
    </target>
    <target name="testuserdir-delete" depends="-testuserdir-delete-ok,-testuserdir-delete-fail" description="Delete testing user directory (if the application is not running); clears any saved settings etc."/>
    
    <target name="clean" depends="files-init,testuserdir-delete">
        <delete failonerror="false" includeemptydirs="true">
            <fileset dir="build">
                <exclude name="testuserdir/"/>
            </fileset>
        </delete>
        <delete dir="${netbeans.javadoc.dir}/${code.name.base.dashes}"/>
        <delete file="${netbeans.javadoc.dir}/${code.name.base.dashes}.zip"/>
        <delete failonerror="false"> <!-- #59457: OK if cluster does not exist currently -->
            <fileset dir="${cluster}">
                <patternset refid="module.files"/>
            </fileset>
        </delete>
        <delete file="${cluster}/update_tracking/${code.name.base.dashes}.xml"/>
    </target>

    <target name="fix-dependencies" depends="basic-init" >
        <property name="build.compiler.deprecation" value="false" />        
        <fixdependencies antfile="../../build.xml" buildtarget="netbeans" cleantarget="clean" failonerror="true" >
          <replace codenamebase="org.openide" addcompiletime="true" >
            <module codenamebase="org.openide.filesystems" spec="6.2"/>
            <module codenamebase="org.openide.util" spec="6.2"/>
            <module codenamebase="org.openide.util.enumerations" spec="6.2"/>
            <module codenamebase="org.openide.modules" spec="6.2"/>
            <module codenamebase="org.openide.nodes" spec="6.2"/>
            <module codenamebase="org.openide.explorer" spec="6.2"/>
            <module codenamebase="org.openide.awt" spec="6.2"/>
            <module codenamebase="org.openide.dialogs" spec="6.2"/>
            <module codenamebase="org.openide.compat" spec="6.2"/>
            <module codenamebase="org.openide.options" spec="6.2"/>
            <module codenamebase="org.openide.windows" spec="6.2"/>
            <module codenamebase="org.openide.text" spec="6.2"/>
            <module codenamebase="org.openide.actions" spec="6.2"/>
            <module codenamebase="org.openide.loaders" spec="5.3"/>
          </replace>
          
          <fileset dir="nbproject" >
              <include name="project.xml" />
          </fileset>
        </fixdependencies>
    </target>

</project>
