src-diagnostics/build.xml
author Asier Lostalé <asier.lostale@openbravo.com>
Tue, 18 Nov 2008 16:42:05 +0000
changeset 2001 9350afa1a995
child 2013 866b18b6aef6
permissions -rw-r--r--
Added diagnostics context
asier@2001
     1
<?xml version="1.0" encoding="UTF-8" ?>
asier@2001
     2
<!--
asier@2001
     3
*************************************************************************
asier@2001
     4
* The contents of this file are subject to the Openbravo  Public  License
asier@2001
     5
* Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
asier@2001
     6
* Version 1.1  with a permitted attribution clause; you may not  use this
asier@2001
     7
* file except in compliance with the License. You  may  obtain  a copy of
asier@2001
     8
* the License at http://www.openbravo.com/legal/license.html
asier@2001
     9
* Software distributed under the License  is  distributed  on  an "AS IS"
asier@2001
    10
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
asier@2001
    11
* License for the specific  language  governing  rights  and  limitations
asier@2001
    12
* under the License.
asier@2001
    13
* The Original Code is Openbravo ERP.
asier@2001
    14
* The Initial Developer of the Original Code is Openbravo SL
asier@2001
    15
* All portions are Copyright (C) 2008 Openbravo SL
asier@2001
    16
* All Rights Reserved.
asier@2001
    17
* Contributor(s):  ______________________________________.
asier@2001
    18
************************************************************************
asier@2001
    19
-->
asier@2001
    20
<project name="openbravo-diagnostics" basedir="." default="check.all">
asier@2001
    21
asier@2001
    22
	<property file="config/diagnostics.properties"/>
asier@2001
    23
	<property file="config/Openbravo.properties"/>
asier@2001
    24
	<property environment="env"/>
asier@2001
    25
	
asier@2001
    26
  <condition property="context.running">
asier@2001
    27
     <http url="${tomcat.manager.url}/../OpenbravoDiagnostics/Check.html"/>
asier@2001
    28
   </condition>
asier@2001
    29
asier@2001
    30
	
asier@2001
    31
	<path id="diagnostic.class.path">
asier@2001
    32
	  <pathelement path="build/classes"/>
asier@2001
    33
    <fileset dir="WebContent/WEB-INF/lib">
asier@2001
    34
      <include name="**/*.jar"/>
asier@2001
    35
    </fileset>
asier@2001
    36
	</path>
asier@2001
    37
	
asier@2001
    38
	 <path id="tomcat.classpath">
asier@2001
    39
	    <fileset file="${env.CATALINA_HOME}/server/lib/catalina-ant.jar"/>
asier@2001
    40
	 </path>
asier@2001
    41
	
asier@2001
    42
	 <taskdef name="compareVersion"
asier@2001
    43
	          classname="org.openbravo.task.CompareVersion">
asier@2001
    44
	   <classpath refid="diagnostic.class.path"/>
asier@2001
    45
	 </taskdef>
asier@2001
    46
asier@2001
    47
	<target name="check.all">
asier@2001
    48
		<ant antfile="build-create.xml" target="build"/>
asier@2001
    49
		<antcall target="check.db"/>
asier@2001
    50
		<antcall target="check.ant"/>
asier@2001
    51
		<antcall target="check.tomcat"/>
asier@2001
    52
	</target>
asier@2001
    53
	
asier@2001
    54
	
asier@2001
    55
	
asier@2001
    56
	<target name="check.ant">
asier@2001
    57
		<antcall target="check.ant.version"/>
asier@2001
    58
		<antcall target="check.ant.jvm.size"/>
asier@2001
    59
		<antcall target="check.ant.jvm.version"/>
asier@2001
    60
	</target>
asier@2001
    61
	
asier@2001
    62
	<target name="check.tomcat">
asier@2001
    63
		<antcall target="deploy.context"/>
asier@2001
    64
asier@2001
    65
		<antcall target="check.tomcat.version"/>
asier@2001
    66
		<antcall target="check.tomcat.jvm.size"/>
asier@2001
    67
		<antcall target="check.tomcat.jvm.version"/>	
asier@2001
    68
	</target>
asier@2001
    69
	
asier@2001
    70
	<target name="check.db">
asier@2001
    71
		<taskdef name="checkDB"
asier@2001
    72
		                 classname="org.openbravo.task.CheckDB">
asier@2001
    73
		          <classpath refid="diagnostic.class.path"/>
asier@2001
    74
		</taskdef>
asier@2001
    75
		<checkDB/>
asier@2001
    76
	</target>
asier@2001
    77
	
asier@2001
    78
  <target name="check.ant.version">
asier@2001
    79
  	<echo message="Checking ant version..."/>
asier@2001
    80
  	<echo message="Minimun ${ant.min.version}, current ${ant.version}"/>
asier@2001
    81
    <condition property="antversion">
asier@2001
    82
        <antversion atleast="${ant.min.version}"/>
asier@2001
    83
    </condition>
asier@2001
    84
  	<fail unless="antversion" message="Minimum ant version: ${ant.min.version}, current version ${ant.version}"/>
asier@2001
    85
  	<echo message="Version OK"/>
asier@2001
    86
  </target>
asier@2001
    87
	
asier@2001
    88
	<target name="check.ant.jvm.version">
asier@2001
    89
	     <echo message="Checking ant's JVM version..."/>
asier@2001
    90
	     <compareVersion v1="${ant.java.version}"
asier@2001
    91
	                     v2="${jvm-version}"/>
asier@2001
    92
	  </target>
asier@2001
    93
	
asier@2001
    94
	<target name="check.ant.jvm.size">
asier@2001
    95
		<taskdef name="checkAntMem"
asier@2001
    96
		             classname="org.openbravo.task.CheckMemory">
asier@2001
    97
		      <classpath refid="diagnostic.class.path"/>
asier@2001
    98
		    </taskdef>
asier@2001
    99
		    <checkAntMem/>
asier@2001
   100
	</target>
asier@2001
   101
	
asier@2001
   102
	
asier@2001
   103
	
asier@2001
   104
	<target name="check.tomcat.version">
asier@2001
   105
	    <taskdef name="checkTomcatVersion"
asier@2001
   106
	             classname="org.openbravo.task.CheckTomcatVersion">
asier@2001
   107
	      <classpath refid="diagnostic.class.path"/>
asier@2001
   108
	    </taskdef>
asier@2001
   109
	    <checkTomcatVersion/>
asier@2001
   110
	  </target>
asier@2001
   111
	
asier@2001
   112
	<target name="check.tomcat.jvm.size">
asier@2001
   113
    <taskdef name="checkMem"
asier@2001
   114
             classname="org.openbravo.task.CheckTomcatMemory">
asier@2001
   115
    	<classpath refid="diagnostic.class.path"/>
asier@2001
   116
    </taskdef>
asier@2001
   117
		<checkMem/>
asier@2001
   118
  </target>
asier@2001
   119
	
asier@2001
   120
	<target name="check.tomcat.jvm.version">
asier@2001
   121
	    <taskdef name="checkJVMversion"
asier@2001
   122
	             classname="org.openbravo.task.CheckJVMVersion">
asier@2001
   123
	      <classpath refid="diagnostic.class.path"/>
asier@2001
   124
	    </taskdef>
asier@2001
   125
	    <checkJVMversion/>
asier@2001
   126
	  </target>
asier@2001
   127
  
asier@2001
   128
	<target name="deploy.context" unless="context.running">
asier@2001
   129
		<ant antfile="build-create.xml" target="war"/>
asier@2001
   130
		<taskdef name="deploy.war" classname="org.apache.catalina.ant.DeployTask">
asier@2001
   131
		  <classpath refid="tomcat.classpath"/>
asier@2001
   132
		</taskdef>
asier@2001
   133
		<taskdef name="start"    classname="org.apache.catalina.ant.StartTask">
asier@2001
   134
		      <classpath refid="tomcat.classpath"/>
asier@2001
   135
		</taskdef>
asier@2001
   136
	
asier@2001
   137
		<deploy.war url="${tomcat.manager.url}" 
asier@2001
   138
			          username="${tomcat.manager.username}" 
asier@2001
   139
			          password="${tomcat.manager.password}"
asier@2001
   140
		            path="/OpenbravoDiagnostics" 
asier@2001
   141
			          war="file:OpenbravoDiagnostics.war"/>
asier@2001
   142
		
asier@2001
   143
		<start      url="${tomcat.manager.url}" 
asier@2001
   144
		            username="${tomcat.manager.username}" 
asier@2001
   145
			          password="${tomcat.manager.password}"
asier@2001
   146
		            path="/OpenbravoDiagnostics"/>
asier@2001
   147
		
asier@2001
   148
asier@2001
   149
	</target>
asier@2001
   150
</project>