<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<project default="java:jar"
         xmlns:j="jelly:core"
         xmlns:maven="jelly:maven"
         xmlns:ant="jelly:ant">
  
	  
  <goal name="allClean"
        description="Clean the master project and all subprojects">
    <attainGoal name="subClean"/>
    <attainGoal name="clean"/>
  </goal>
  

  <goal name="subClean"
        description="Clean all subprojects"
        >
    <maven:reactor
               basedir="${basedir}"
               includes="*/project.xml,applications/*/project.xml"               
               goals="clean"
               banner="Cleaning"
               ignoreFailures="true"/>
  </goal>

  <goal name="allSite"
        description="Build the site for the master project and all subprojects, build the pdf documentation"
        >
    <maven:reactor
               basedir="${basedir}"
               includes="site/project.xml"               
               goals="allSite"
               banner="Building Site"
               postProcessing="false"
               ignoreFailures="false"/>
  </goal>

  <goal name="allHtml"
        description="Build the site for the master project and all subprojects"
        >
    <maven:reactor
               basedir="${basedir}"
               includes="site/project.xml"               
               goals="allHtml"
               banner="Building Site"
               postProcessing="false"
               ignoreFailures="false"/>
  </goal>  
  <goal name="allBuild"
        description="Build all jars and war">

    <maven:reactor
               basedir="${basedir}/api"
               includes="project.xml"
               goals="jar:install"
               banner="Build and Install the Graffito API jar in your Maven Repo"
               postProcessing="false"
               ignoreFailures="false"/>    

    <maven:reactor
               basedir="${basedir}/commons"
               includes="project.xml"
               goals="jar:install"
               banner="Build and Install the Graffito Commons jar in your Maven Repo"
               postProcessing="false"
               ignoreFailures="false"/>    	
		      
    <maven:reactor
               basedir="${basedir}/components"
               includes="project.xml"
               goals="jar:install"
               banner="Build and Install the Graffito Components jar in your Maven Repo"
               postProcessing="false"
               ignoreFailures="false"/>    
     
     <!-- maven:reactor
               basedir="${basedir}/engine"
               includes="project.xml"
               goals="jar:install"
               banner="Build and Install the Graffito engine in your Maven Repo"
               postProcessing="false"
               ignoreFailures="false"/ -->
	       
      <!-- Build framework portlet & portelt wars  -->		      
    <maven:reactor
               basedir="${basedir}/applications/framework-portlets"
               includes="project.xml"
               goals="jar:install"
               banner="Build and Install the Graffito framework portlet jar in your Maven Repo"
               postProcessing="false"
               ignoreFailures="false"/>  	      
      
     <maven:reactor
               basedir="${basedir}/applications/browser"
               includes="project.xml"
               goals="war:install"
               banner="Build and Install the Graffito Browser application WAR in your Maven Repo"
               postProcessing="false"
               ignoreFailures="false"/>
               
               
     <maven:reactor
               basedir="${basedir}/applications/graffito-portlets"
               includes="project.xml"
               goals="war:install"
               banner="Build and Install the Graffito Portlets War in your Maven Repo"
               postProcessing="false"
               ignoreFailures="false"/>
               
  </goal>
  
    <goal name="allDeploy"
        description="Deploy all jars and war into J2 for the Graffito Demo">
          	
    <maven:reactor
               basedir="${basedir}/components"
               includes="project.xml"
               goals="db.reinit.production"
               banner="Generate DB Scripts"
               postProcessing="false"
               ignoreFailures="false"/>    
	       

    <maven:reactor
               basedir="${basedir}/commons"
               includes="project.xml"
               goals="deploy"
               banner="Deploy the Graffito Commons jar"
               postProcessing="false"
               ignoreFailures="false"/>    
	       
    <maven:reactor
               basedir="${basedir}/api"
               includes="project.xml"
               goals="deploy"
               banner="Deploy the Graffito API jar"
               postProcessing="false"
               ignoreFailures="false"/>    
	       
    <maven:reactor
               basedir="${basedir}/components"
               includes="project.xml"
               goals="deploy"
               banner="Deploy the Graffito Components  jar"
               postProcessing="false"
               ignoreFailures="false"/>    
                
	       
     <maven:reactor
               basedir="${basedir}/applications/browser"
               includes="project.xml"
               goals="deploy"
               banner="Deploy the Graffito Browser application WAR"
               postProcessing="false"
               ignoreFailures="false"/>

     <maven:reactor
               basedir="${basedir}/applications/graffito-portlets"
               includes="project.xml"
               goals="deploy"
               banner="Deploy the Graffito Portlets application WAR"
               postProcessing="false"
               ignoreFailures="false"/>	       
     <maven:reactor
               basedir="${basedir}/jetspeed2-deploy"
               includes="project.xml"
               goals="deploy"
               banner="Install Spring assembly scripts &amp; PSML pages"
               postProcessing="false"
               ignoreFailures="false"/>
  </goal>

  
  <goal name="allDeployHead"
	description="Deploy all jars and war into J2 for the Graffito Demo">
	  
	  <maven:reactor
			basedir="${basedir}/components"
			includes="project.xml"
			goals="db.reinit.production"
			banner="Generate DB Scripts"
			postProcessing="false"
			ignoreFailures="false"/>    
	  
	  
	  <maven:reactor
			basedir="${basedir}/commons"
			includes="project.xml"
			goals="deploy"
			banner="Deploy the Graffito Commons jar"
			postProcessing="false"
			ignoreFailures="false"/>    
	  
	  <maven:reactor
			basedir="${basedir}/api"
			includes="project.xml"
			goals="deploy"
			banner="Deploy the Graffito API jar"
			postProcessing="false"
			ignoreFailures="false"/>    
	  
	  <maven:reactor
			basedir="${basedir}/components"
			includes="project.xml"
			goals="deploy"
			banner="Deploy the Graffito Components  jar"
			postProcessing="false"
			ignoreFailures="false"/>    
	  
	  
	  <maven:reactor
			basedir="${basedir}/applications/browser"
			includes="project.xml"
			goals="deploy"
			banner="Deploy the Graffito Browser application WAR"
			postProcessing="false"
			ignoreFailures="false"/>
	  
	  <maven:reactor
			basedir="${basedir}/applications/graffito-portlets"
			includes="project.xml"
			goals="deploy"
			banner="Deploy the Graffito Portlets application WAR"
			postProcessing="false"
			ignoreFailures="false"/>	       
	  <maven:reactor
			basedir="${basedir}/jetspeed2-deploy"
			includes="project.xml"
			goals="deployHead"
			banner="Install Spring assembly scripts &amp; PSML pages"
			postProcessing="false"
			ignoreFailures="false"/>
  </goal>  
  
  <goal name="start.test.server">
  	<echo message="====================================" />
  	<echo message="        Start HSQL Test Database    " />
  	<echo message="====================================" />
	<echo message = "${org.apache.portals.graffito.test.jdbc.drivers.path}" />
         <java classname="org.hsqldb.Server" fork="yes">
          <classpath>
            <path refid="maven.dependency.classpath"/>
            <pathelement path="${maven.build.dest}"/>
			<pathelement path="${org.apache.portals.graffito.test.jdbc.drivers.path}"/>
          </classpath>
            <arg value="-database" />
            <arg value="./test/hsql/TestDB" />
            <arg value="-port" />
            <arg value="9001" />
            <arg value="-silent" />
            <arg value="true" />
            <arg value="-trace" />
            <arg value="false" />
        </java>
  </goal>  
</project>
