﻿<?xml version="1.0" encoding="UTF-8"?>

<project name="Project" basedir="." default="generate.jaxb.bindings">
    <description>
        Main build file - automated tasks for managing project compilation, JAXB and EJB genreation,
        code analysis, EAR exporting, and any other task needed.
    </description>

    <property file="build.properties"/>

    <target name="generate.jaxb.bindings" description="Generate JAXB bindings for the whole project">
	<ant antfile="build_jaxb.xml" />
    </target>

    <target name="findbugs-all" description="Create a Findbugs report for the whole project">
        <ant antfile="build_code_analysis.xml" target="findbugs-all"/>
    </target>

    <target name="pmd-all" description="Create a PMD report for the whole project">
        <ant antfile="build_code_analysis.xml" target="pmd-all"/>
    </target>

    <target name="clover-compile-all" description="Clover compile the whole project">
        <ant antfile="build_code_analysis.xml" target="clover-all"/>
    </target>

    <target name="clover-report" description="Create the Clover report">
        <ant antfile="build_code_analysis.xml" target="clover.report"/>
    </target>

    <!-- show what files you have checked out and also what is not in clearcase yet -->
    <target name="CC.Show.My.Checkouts.and.Private.View.Files" description="Show checked out and files not yet in ClearCase">
        <ant antfile="${common.build}" target="CC.Show.My.Checkouts.and.Private.View.Files">
            <property name="cc.check.root.dir" value="${root.dir}" />
        </ant>
    </target>

    <target name="generate.deploy.and.rmic.EJB" description="This task generates deployment code and RMIC code for an EJB Project">
        <!-- IgnoreErrors="true" - Do not halt for compilation or validation errors -->
        <!-- Quiet="true" - Only output errors, suppress informational messages -->
        <ejbDeploy EJBProject="${ejb.project}" IgnoreErrors="true" Quiet="true" />
    </target>

    <target name="export.EAR.DBDEV">
        <ant antfile="build_export.xml">
            <property name="deploy.db" value="${dev.db}" />
            <property name="deploy.name" value="${dev.db.header.name}" />			
            <property name="deploy.ear.file" value="${dev.ear.file}" />
            <property name="debug.compilation" value="true" />
        </ant>
    </target>

    <target name="refresh.all.projects" description="This task refreshes all project contents">
        <eclipse.refreshLocal resource="${ear.project}" depth="infinite" />
        <eclipse.refreshLocal resource="${dependents.project}" depth="infinite" />
        <eclipse.refreshLocal resource="${test.project}" depth="infinite" />
        <eclipse.refreshLocal resource="${persistence.project}" depth="infinite" />
        <eclipse.refreshLocal resource="${ejb.project}" depth="infinite" />
        <eclipse.refreshLocal resource="${web.project}" depth="infinite" />
    </target>

    <target name="compile.all.projects.with.debug.info" description="This task compiles all projects with debug info">
        <property name="debug.compilation" value="true" />
        <echo message="::: debug.compilation = ${debug.compilation}" />		
        <projectBuild ProjectName="${dependents.project}" failonerror="false" DebugCompilation="${debug.compilation}" />
        <projectBuild ProjectName="${persistence.project}" failonerror="false" DebugCompilation="${debug.compilation}" />
        <projectBuild ProjectName="${test.project}" failonerror="false" DebugCompilation="${debug.compilation}" />
        <projectBuild ProjectName="${ejb.project}" failonerror="false" DebugCompilation="${debug.compilation}" />
        <projectBuild ProjectName="${web.project}" failonerror="false" DebugCompilation="${debug.compilation}" />
    </target>

    <target name="label.clearcase" description="Create and apply a Clearcase label for project resources">
        <!-- create a new label in ClearCase -->
        <ant antfile="${common.build}" target="cc.create.label">
            <property name="cc.label" value="${clearcase.label}${versionNumber}"/>
        </ant>
        
        <!-- apply the label to the Java_sources dir and everything underneath -->
        <ant antfile="${common.build}" target="cc.apply.label.to.dir">
            <property name="vob.dir" value="${root.dir}.."/>
            <property name="cc.dir.to.label" value="Java_sources"/>
            <property name="cc.label" value="${clearcase.label}${versionNumber}"/>
        </ant>       

        <ant antfile="${common.build}" target="cc.apply.label.to.dir">
            <property name="vob.dir" value="${root.dir}.."/>
            <property name="cc.dir.to.label" value="ProjectHelp"/>
            <property name="cc.label" value="${clearcase.label}${versionNumber}"/>
        </ant>       
    </target>
</project>