<?xml version="1.0" encoding="UTF-8"?>
<!--
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

  Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.

  Oracle and Java are registered trademarks of Oracle and/or its affiliates.
  Other names may be trademarks of their respective owners.

  The contents of this file are subject to the terms of either the GNU General Public
  License Version 2 only ("GPL") or the Common Development and Distribution
  License("CDDL") (collectively, 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-gplv2.html or nbbuild/licenses/CDDL-GPL-2-CP. See the
  License for the specific language governing permissions and limitations under the
  License.  When distributing the software, include this License Header Notice in
  each file and include the License file at nbbuild/licenses/CDDL-GPL-2-CP.  Oracle
  designates this particular file as subject to the "Classpath" exception as provided
  by Oracle in the GPL Version 2 section of the License file that accompanied this code.
  If applicable, add the following below the License Header, with the fields enclosed
  by brackets [] replaced by your own identifying information:
  "Portions Copyrighted [year] [name of copyright owner]"
  
  Contributor(s):
  
  The Original Software is NetBeans. The Initial Developer of the Original Software
  is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun Microsystems, Inc. All
  Rights Reserved.
  
  If you wish your version of this file to be governed by only the CDDL or only the
  GPL Version 2, indicate your decision by adding "[Contributor] elects to include
  this software in this distribution under the [CDDL or GPL Version 2] license." If
  you do not indicate a single choice of license, a recipient has the option to
  distribute your version of this file under either the CDDL, the GPL Version 2 or
  to extend the choice of license to its licensees as provided above. However, if you
  add GPL Version 2 code and therefore, elected the GPL Version 2 license, then the
  option applies only if the new code is made subject to such option by the copyright
  holder.
-->

<!--
  This is a target library which is intended to be used by other build scripts.
  
  It contains the standard, fucntionality, common across all scripts which 
  allows to perform some basic initialization, check out sources from a cvs 
  repository and, finally, clean or build a netbeans project and jni libraries.
  
  None ot the targets defined in this script are intended to be called 
  directly, instead it is expected that targets in build dcripts which import 
  this one will declare dependecies on this script's targets.
  
  @author Kirill Sorokin
-->
<project name="common" default="usage" basedir=".">
    <!-- ============================================================================
      Aggregates
    ============================================================================= -->
    
    <!--
      Cleans the project.
      
      This is an aggregation target, which does not contain any functionality,
      but defines a dependency on the 'clean' target.
      For more details, please consult the documentation for this target.
    -->
    <target name="clean-all" depends="clean"/>
    
    <!--
      Cleans and builds the project.
      
      This is an aggregation target, which does not contain any functionality,
      but defines dependencies on the 'clean-all', 'checkout' and 'build' 
      targets. For more details, please consult the documentation for these 
      targets.
    -->
    <target name="build-all" depends="clean-all,checkout,build"/>
    
    <!--
      Cleans, builds and releases the project.
      
      This is an aggregation target, which does not contain any functionality,
      but defines dependencies on the 'clean', 'checkout', 'build' and 
      'release' targets. For more details, please consult the documentation 
      for these targets.
    -->
    <target name="release-all" depends="build-all,release"/>
    
    <!-- ============================================================================
      Initialization
    ============================================================================= -->
    
    <!--
      Initializes the projects's build script.
      
      This is an aggregation target, it does not contain any functionality, but 
      defines dependencies on '-pre-init', '-init' and '-post-init' 
      targets. The '-pre-init' and '-post-init' targets are empty hooks,
      which allow derivative scripts to inject custom logic which will be 
      executed prior to the initialization process or after it. The '-init' 
      target contains the code which actually initializes the script and should 
      be overriden in the derivative scripts.
    -->
    <target name="init" depends="-pre-init,-init,-post-init"/>
    
    <!--
      Performs the default initialization.
      
      This target defines a set of custom ant tasks which are used throughout
      the script and may be useful for the derivative scripts.
      
      It also sets some properties which control the flow of the build process, 
      such as whether to check-out sources from trunk or branch, or to copy 
      them from a given location; whether to build the native components or 
      not, whether to build the netbeans project or not.
      
      Finally this target initializes the local working directory and the 
      distributives directory and sets a special property which will prevent it
      from repeated execution.
      
      This target is not intended to be called directly.
    -->
    <target name=".init" depends=".build-custom-tasks" unless="skip.initialization">
        <!-- define custom ant tasks -->
        <taskdef 
            name="for-each" 
            classname="org.netbeans.installer.infra.build.ant.ForEach" 
            classpath="${custom.tasks.cls}"/>
        <taskdef 
            name="set" 
            classname="org.netbeans.installer.infra.build.ant.SetProperty" 
            classpath="${custom.tasks.cls}"/>
        <taskdef 
            name="if" 
            classname="org.netbeans.installer.infra.build.ant.If" 
            classpath="${custom.tasks.cls}"/>
        
        <!-- decide whether to checkout sources from trunk --> 
        <condition property="do.checkout">
            <and>
                <equals arg1="${checkout.sources}" arg2="true"/>
            </and>
        </condition>
        
        <!-- decide whether to copy sources from a given location -->
        <condition property="do.checkout.copy">
            <not>
                <equals arg1="${checkout.sources}" arg2="true"/>
            </not>
        </condition>
        
        <!-- decide whether to build native libraries/launchers or not -->
        <condition property="do.build.native">
            <equals arg1="${build.native}" arg2="true"/>
        </condition>
        
        <!-- decide whether there is need to build a netbeans project -->
        <condition property="do.build.nbproject">
            <equals arg1="${build.nbproject}" arg2="true"/>
        </condition>
        
        <!-- deduce the path to the ant executable -->
        <condition property="ant.executable" value="${ant.home}/bin/ant.bat">
            <os family="windows"/>
        </condition>
        <condition property="ant.executable" value="${ant.home}/bin/ant">
            <not>
                <os family="windows"/>
            </not>
        </condition>
        
        <!-- initialize the local working directory -->
        <mkdir dir="${work.dir}"/>
        
        <!-- initialize the local distributive directory -->
        <mkdir dir="${dist.dir}"/>
        
        <!-- set the marker property which will prevent the script running the 
             initialization procedure again, if history is lost, e.g. as a 
             result of an antcall -->
        <property name="skip.initialization" value="true"/>
    </target>
    
    <!--
      Builds custom ant tasks.
      
      This target deletes the directory which is the target for the custom ant
      tasks compilation, recreates it and runs javac on the custom tasks' 
      sources.
      
      It also sets a special property which will prevent it from repeated 
      execution.
      
      This target is not intended to be called directly.
    -->
    <target name=".build-custom-tasks" unless="dont.build.custom.tasks">
        <!-- quick clean-up and initialization -->
        <delete dir="${custom.tasks.cls}"/>
        <mkdir dir="${custom.tasks.cls}"/>
        
        <!-- compile -->
        <javac 
            srcdir="${custom.tasks.src}" 
            destdir="${custom.tasks.cls}" 
            debug="true"/>
        
        <property name="dont.build.custom.tasks" value="true"/>
    </target>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed prior to the script's initialization.
      
      This target is not intended to be called directly.
    -->
    <target name="-pre-init"/>
    
    <!--
      An empty hook. 
      
      It must be overriden in derivative scripts, in order to implement custom
      functionality required for the build script initialization.
      
      This target is not intended to be called directly.
    -->
    <target name="-init" depends=".init"/>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed after the script's initialization.
      
      This target is not intended to be called directly.
    -->
    <target name="-post-init"/>
    
    <!-- ============================================================================
      Clean-up
    ============================================================================= -->
    
    <!--
      Cleans the current working directory and the distributives directory.
      
      This is an aggregation target, it does not contain any functionality, but 
      defines dependencies on '-pre-clean', '-clean' and '-post-clean' 
      targets. The '-pre-clean' and '-post-clean' targets are empty hooks,
      which allow derivative scripts to inject custom logic which will be 
      executed prior to the clean process or after it. The '-clean' target 
      contains the code which actually cleans the project and should be 
      overriden in the derivative scripts.
    -->
    <target name="clean" depends="init,-pre-clean,-clean,-post-clean"/>
    
    <!--
      Performs the standard clean-up procedures.
      
      It cleans the native components (iterates over the list of platforms for 
      which the native components should be built and deletes the distributive 
      files of these components), tries to run cleanup on the netbeans project 
      and finally deletes the local working directory.
      
      This target is not intended to be called directly.
    -->
    <target name=".clean">
        <!-- for each of the defined platforms set the appropriate property
             and execute the clean-up procedure -->
        <for-each list="${native.platforms}" property="platform">
            <antcall target=".clean-native"/>
        </for-each>
        
        <!-- attempt to run the clean-up procedure on the netbeans project -->
        <antcall target=".clean-nbproject"/>
        
        <!-- delete the local working directory -->
        <delete dir="${work.dir}" includeemptydirs="true"/>
    </target>
    
    <!--
      Cleans the native components of the project. 
      
      It is meant to be antcall'ed from a loop which would iterate over the 
      list of supported platforms. This target expects the property 
      'platform' to point to the current platform for which clean-up should be 
      performed.
      
      By default it falls back to '.clean-jni' target, but it is meant to be 
      overriden by derivative build scripts, if there is need to do more than 
      that.
      
      This target is only executed if the the ${build.native} property was set 
      to 'true'.
      
      This target is not intended to be called directly.
    -->
    <target name=".clean-native" if="do.build.native">
        <antcall target=".clean-jni"/>
    </target>
    
    <!--
      Cleans up the native jni libraries for the project.
      
      It removes the distributive file for the jni library for the current 
      platform.
      
      This target is only executed if the the ${build.native} property was set 
      to 'true'.
      
      This target is not intended to be called directly.
    -->
    <target name=".clean-jni" if="do.build.native">
        <!-- set required properties -->
        <set property="current.scp.local.dir" 
             source="scp.local.dir"/>
        <set property="current.native.dist.file" 
             source="native.dist.file.${platform}"/>
        
        <!-- delete the distributive -->
        <delete dir="${scp.local.dir}/${current.native.dist.file}"/>
    </target>
    
    <!--
      Cleans up the netbeans part of the project.
      
      It runs the 'clean' target on the netbeans project's build script.
      
      This target is only executed if the the ${build.nbproject} property was 
      set to 'true'.
      
      This target is not intended to be called directly.
    -->
    <target name=".clean-nbproject" if="do.build.nbproject">
        <!-- check whether the netbeans project's directory exists -->
        <condition property="nbproject.exists" value="true">
            <available file="${cvs.dir}/${nbproject.path}"/>
        </condition>
        
        <!-- is it exists, run the 'clean' target on the netbeans project's 
             build script -->
        <if property="nbproject.exists" value="true">
            <condition property="nb.jdk.home"
                       value="${nb.platform.home}"
                       else="${nb.platform.home.macos}">
                    <not>
                        <equals arg1="Apple Inc." arg2="${java.vendor}"/>
                    </not>
            </condition>

            <exec executable="${ant.executable}" 
                  dir="${cvs.dir}/${nbproject.path}" 
                  failonerror="false"
                  failifexecutionfails="false">
                <env key="JAVA_HOME" value="${java.home}"/>
                <arg value="${nb.target.clean}"/>
                
                <arg value="${nb.jdk.home}"/>
                <arg value="${nb.ignore.native}"/>
                <arg value="${nb.no.dependencies}"/>
                <arg value="${nb.dont.build.custom.tasks}"/>
                <arg value="${nb.custom.tasks.cls}"/>
                <arg value="${nb.custom.parameter}"/>
            </exec>
        </if>
    </target>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed prior to cleaning the projects's local working directory.
      
      This target is not intended to be called directly.
    -->
    <target name="-pre-clean"/>
    
    <!--
      An empty hook. 
      
      It must be overriden in derivative scripts, in order to implement custom
      functionality required for the cleaning the project.
      
      This target is not intended to be called directly.
    -->
    <target name="-clean" depends=".clean"/>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed after cleaning the project's local working directory.
      
      This target is not intended to be called directly.
    -->
    <target name="-post-clean"/>
    
    <!-- ============================================================================
      Check-out
    ============================================================================= -->
    
    <!--
      Checks out the the project's sources from the CVS repository.
      
      This is an aggregation target, it does not contain any functionality, but 
      defines dependencies on '-pre-checkout', '-checkout' and '-post-checkout' 
      targets. The '-pre-checkout' and '-post-checkout' target are empty hooks,
      which allow derivative scripts to inject custom logic which will be 
      executed prior to the check-out process or after it. The '-checkout' 
      target contains the code which actually checks out the sources and should 
      be overriden in the derivative scripts.
    -->
    <target name="checkout" 
            depends="init,-pre-checkout,-checkout,-post-checkout"/>
    
    <!--
      Checks out sources from a CVS repository with the given coordinates.
      
      This target uses the values of ${cvs.root}, ${cvs.module}, ${cvs.path}, 
      ${cvs.branch}, ${cvs.timestamp} properties to check out the required sources.
      It falls back to the two targets: '.checkout-repository' and '.checkout-copy', 
      which correspond to the choosen check-out method. Only one of these 
      targets will be executed under any conditions.
      
      This target is not intended to be called directly.
    -->
    <target name=".checkout" 
            depends=".checkout-repository,.pre-checkout-copy,.checkout-copy,.post-checkout-copy">
        <copy todir="${cvs.dir}" failonerror="false">
            <fileset dir="${translatedfiles.dir}"/>
        </copy>
        
        <!-- substitute the params in the source tree -->
        <for-each from="1" to="${sources.params.length}" property="i">
            <set property="current.token" 
                 source="sources.params.${i}.token"/>
            <set property="current.value" 
                 source="sources.params.${i}.value"/>
            
            <replace dir="${cvs.dir}" 
                     token="${current.token}" 
                     value="${current.value}"/>
        </for-each>
    </target>
    
    <!--
      Checks out sources from trunk or from a given branch.
      
      This target executes the <cvs> task, which performs the actual check-out.
      
      This target is only executed if the the ${checkout.sources} property was 
      set to 'true' and the ${cvs.branch} property is not empty.
      
      This target is not intended to be called directly.
    -->
    <target name=".checkout-repository" if="do.checkout">
        <cvs cvsroot="${cvs.root}" 
             command="checkout" 
             package="${cvs.module}/${cvs.path}" 
             tag="${cvs.branch}"
             date="${cvs.timestamp}" 
             dest="${work.dir}"
             failonerror="true"/>
        <cvs cvsroot="${cvs.root}"
             command="checkout"
             package="${translatedfiles.module}/${translatedfiles.path}"
             tag="${cvs.branch}"
             date="${cvs.timestamp}"
             dest="${work.dir}"
             failonerror="false"/>
    </target>
    
    <!--
      Copies the sources from a given location.
      
      This target serves as an alternative to the actual check-out targets and
      is used in case when the calling script already knows the location of the
      appropriate source files and there is no need to check them out again.
      
      Several filters are applied to the sources files, e.g. no already built
      files are copied, the private parts of the netbeans projects are omitted,
      CVS metadata is also omitted.
      
      This target is only executed if the the ${checkout.sources} property was 
      set to 'false'.
      
      This target is not intended to be called directly.
    -->
    <target name=".checkout-copy" if="do.checkout.copy">
        <!-- create the destination directory for the sources -->
        <mkdir dir="${work.dir}/${cvs.module}/${cvs.path}"/>
        
        <!-- copy the sources, applying the selected filters -->
        <copy todir="${work.dir}/${cvs.module}/${cvs.path}" verbose="true">
            <fileset dir="${sources.dir}/${cvs.module}/${cvs.path}">
                <include name="**/*.*"/>
                <exclude name="**/nbproject/private/*.*"/>
                <exclude name="build/**/*.*"/>
                <exclude name="dist/**/*.*"/>
                <exclude name="**/CVS"/>
                <exclude name="**/.cvsignore"/>
            </fileset>
        </copy>
        <!-- copy the translatedfiles for the sources, applying the selected filters -->
        <copy todir="${translatedfiles.dir}" verbose="true" failonerror="false">
            <fileset dir="${sources.dir}/${translatedfiles.module}/${translatedfiles.path}">
                <include name="**/*.*"/>
                <exclude name="**/nbproject/private/*.*"/>
                <exclude name="build/**/*.*"/>
                <exclude name="dist/**/*.*"/>
                <exclude name="**/CVS"/>
                <exclude name="**/.cvsignore"/>
            </fileset>
        </copy>
    </target>

    <!--
      Empty hooks. 
      
      They allow derivative scripts to inject custom logic which will be 
      executed prior and after copying out the project's sources.
      
      These targets are not intended to be called directly.
    -->
    <target name=".pre-checkout-copy"/>
    <target name=".post-checkout-copy"/>

    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed prior to checking out the project's sources.
      
      This target is not intended to be called directly.
    -->
    <target name="-pre-checkout"/>
    
    <!--
      An empty hook. 
      
      It must be overriden in derivative scripts, in order to implement custom
      functionality required for the correctly checking out the project's 
      sources.
      
      This target is not intended to be called directly.
    -->
    <target name="-checkout" depends=".checkout"/>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed after checking out the project's sources.
      
      This target is not intended to be called directly.
    -->
    <target name="-post-checkout"/>
    
    <!-- ============================================================================
      Build
    ============================================================================= -->
    
    <!--
      Builds the project and (optionally) its native components.
      
      It is assumed that the sources of the project are already checked out, 
      but a dependency on the 'checkout' target is not defined as it may be 
      desirable to check-out the sources once and then rebuild the engine as 
      appropriate.
      
      The build process consists of two steps: first, the native components 
      of the project (jni libraries) are built (if it is required), then the 
      projects's netbeans part is compiled and packaged.
      
      This is an aggregation target, it does not contain any functionality, but 
      defines dependencies on '-pre-build', '-build' and '-post-build' 
      targets. The '-pre-build' and '-post-build' target are empty hooks,
      which allow derivative scripts to inject custom logic which will be 
      executed prior to the build process or after it. The '-build' target 
      contains the code which actually builds the project and should be 
      overriden in the derivative scripts.
    -->
    <target name="build" depends="init,-pre-build,-build,-post-build"/>
    
    <!-- 
      Performs the standard build procedures.
      
      This target builds the native components for the project (iterates over 
      the list of platforms, calling the '.build-native' target) and executes 
      the 'build' target on the netbeans part of the project.
      
      This target is not intended to be called directly.
    -->
    <target name=".build">
        <!-- for each of the defined platforms set the appropriate property
                 and execute the build procedure -->
        <for-each list="${native.platforms}" property="platform">
            <antcall target=".build-native"/>
        </for-each>
        
        <!-- run the 'build' target on the netbeans project -->
        <antcall target=".build-nbproject"/>
    </target>
    
    <!--
      Builds the native components of the project for a given platform.
      
      By default this target falls back to the '.build-jni' target, which 
      builds the jni libraries for the project.
      
      This target is called in a loop from the '.build-native' target, and 
      expects the ${platform} property to contain the code mane of the platform 
      for which the native components should be built.
      
      This target is only executed if the the ${build.native} property was set 
      to 'true'.
      
      This target is not intended to be called directly.
    -->
    <target name=".build-native" if="do.build.native">
        <antcall target=".build-jni"/>
    </target>
    
    <!-- 
      Builds the jni library for the given platform.
      
      This target is antcall'ed as part of the call to the '.build-native' 
      target, and expects the ${platform} property to contain the code name of
      the platform for which the library should be built.
      
      It connects to the registered satellite machine for the current platform
      using the 'ssh' utility, checks out the library's sources and builds it.
      The built binary is then copied back to the host machine using 'scp'.
      
      This target is only executed if the the ${build.native} property was set 
      to 'true'.
      
      This target is not intended to be called directly.
    -->
    <target name=".build-jni" if="do.build.native">
        <!-- set required properties -->
        <set property="remote.host" 
             source="remote.host.${platform}"/>
        <set property="remote.port" 
             source="remote.port.${platform}"/>
        <set property="remote.user" 
             source="remote.user.${platform}"/>
        
        <set property="current.native.dist.file" 
             source="native.dist.file.${platform}"/>
        
        <!-- now we need to re-evaluate the values of the ssh and scp-related 
             properties as they contain references to the properties that have 
             just been set above -->
        <set property="current.ssh.arguments" 
             source="ssh.arguments"/>
        <set property="current.ssh.command.clean" 
             source="ssh.command.clean"/>
        <set property="current.ssh.command.build" 
             source="ssh.command.build"/>
        
        <set property="current.scp.arguments" 
             source="scp.arguments"/>
        <set property="current.scp.remote.dir" 
             source="scp.remote.dir"/>
        <set property="current.scp.local.dir" 
             source="scp.local.dir"/>
        
        <!-- run the ssh command - it is expected that it will build 
             everything -->
        <exec executable="${ssh.executable}" failonerror="true">
            <arg line="${current.ssh.arguments}"/>
            <arg value="${current.ssh.command.build}"/>
        </exec>
        
        <!-- run the scp command to copy the resulting file back to the 
             host system -->
        <mkdir dir="${current.scp.local.dir}"/>
        <exec executable="${scp.executable}" failonerror="true">
            <arg line="${current.scp.arguments}"/>
            <arg value="${current.scp.remote.dir}/${current.native.dist.file}"/>
            <arg value="${current.scp.local.dir}/${current.native.dist.file}"/>
        </exec>
        
        <!-- run the ssh command - we need to clean after us -->
        <exec executable="${ssh.executable}" failonerror="true">
            <arg line="${current.ssh.arguments}"/>
            <arg value="${current.ssh.command.clean}"/>
        </exec>
    </target>
    
    <!--
      Builds the netbeans part of the project.
      
      It runs the 'jar' target on the netbeans project's build script.
      
      This target is only executed if the the ${build.nbproject} property was 
      set to 'true'.
      
      This target is not intended to be called directly.
    -->
    <target name=".build-nbproject" if="do.build.nbproject">
        <condition property="nb.jdk.home"
                   value="${nb.platform.home}"
                   else="${nb.platform.home.macos}">
                <not>
                    <equals arg1="Apple Inc." arg2="${java.vendor}"/>
                </not>
        </condition>

        <exec executable="${ant.executable}" 
              dir="${cvs.dir}/${nbproject.path}" 
              failonerror="true"
              failifexecutionfails="true"
              logerror="true"
              errorproperty="error.property">
            <env key="JAVA_HOME" value="${java.home}"/>
            <arg value="clean"/>
            <arg value="compile"/>
            
            <arg value="${nb.jdk.home}"/>
            <arg value="${nb.ignore.native}"/>
            <arg value="${nb.no.dependencies}"/>
            <arg value="${nb.dont.build.custom.tasks}"/>
            <!-- This argument removed due to bug #223625 - it is assumed that no longer need -->
            <!-- <arg value="${nb.custom.tasks.cls}"/> -->
            <arg value="${nb.custom.parameter}"/>
        </exec>
        
        <mkdir dir="${nbproject.dist.dir}"/>
        
        <jar manifest="${cvs.dir}/${nbproject.path}/${nbproject.manifest}" 
             destfile="${nbproject.dist.dir}/${nbproject.dist.file.name}">
            <fileset dir="${cvs.dir}/${nbproject.path}/build/classes">
                <include name="**/*.*"/>
            </fileset>
        </jar>
    </target>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed prior to building the project.
      
      This target is not intended to be called directly.
    -->
    <target name="-pre-build"/>
    
    <!--
      An empty hook. 
      
      It must be overriden in derivative scripts, in order to implement custom
      functionality required for the correctly building the project.
      
      This target is not intended to be called directly.
    -->
    <target name="-build" depends=".build"/>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed after building the project.
      
      This target is not intended to be called directly.
    -->
    <target name="-post-build"/>
    
    <!-- ============================================================================
      Release
    ============================================================================= -->
    
    <!--
      Releases the project to the registries server.
      
      It is assumed that the project has already been built, but a dependency 
      on the 'build' target is not defined, as it may be desirable to build 
      once and then release several times to different registries servers.
      
      This is an aggregation target, it does not contain any functionality, but 
      defines dependencies on '-pre-release', '-release' and '-post-release' 
      targets. The '-pre-release' and '-post-release' target are empty hooks,
      which allow derivative scripts to inject custom logic which will be 
      executed prior to the release process or after it. The '-release' target 
      contains the code which actually releases the project and should be 
      overriden in the derivative scripts.
    -->
    <target name="release" depends="init,-pre-release,-release,-post-release"/>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed prior to releasing the project.
      
      This target is not intended to be called directly.
    -->
    <target name="-pre-release"/>
    
    <!--
      An empty hook. 
      
      It must be overriden in derivative scripts, in order to implement custom
      functionality required for the correctly releasing the project.
      
      This target is not intended to be called directly.
    -->
    <target name="-release"/>
    
    <!--
      An empty hook. 
      
      It allows derivative scripts to inject custom logic which will be 
      executed after releasing the project.
      
      This target is not intended to be called directly.
    -->
    <target name="-post-release"/>
    
    <!-- ============================================================================
      Default
    ============================================================================= -->
    
    <!--
      The default target. 
      
      Does nothing except printing the usage information.
    -->
    <target name="usage">
        <echo>
            This build script is a targets library and must not be used 
            directly.
        </echo>
    </target>
</project>
