src-diagnostics/build.xml
author Asier Lostalé <asier.lostale@openbravo.com>
Wed, 19 Nov 2008 14:58:03 +0000
changeset 2021 ce7df0c4b986
parent 2013 866b18b6aef6
child 2024 86e47b4daf8d
permissions -rw-r--r--
diagnostics: added file permissions and log4j.lcf availability checks
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@2021
    27
    <http url="${tomcat.manager.url}/../OpenbravoDiagnostics/Check.html"/>
asier@2021
    28
  </condition>
asier@2021
    29
asier@2021
    30
	<condition property="isUnix">
asier@2021
    31
	  <os family="unix"/>
asier@2021
    32
  </condition>
asier@2021
    33
asier@2001
    34
asier@2001
    35
	
asier@2001
    36
	<path id="diagnostic.class.path">
asier@2001
    37
	  <pathelement path="build/classes"/>
asier@2001
    38
    <fileset dir="WebContent/WEB-INF/lib">
asier@2001
    39
      <include name="**/*.jar"/>
asier@2001
    40
    </fileset>
asier@2001
    41
	</path>
asier@2001
    42
	
asier@2001
    43
	 <path id="tomcat.classpath">
asier@2001
    44
	    <fileset file="${env.CATALINA_HOME}/server/lib/catalina-ant.jar"/>
asier@2001
    45
	 </path>
asier@2001
    46
	
asier@2001
    47
	 <taskdef name="compareVersion"
asier@2001
    48
	          classname="org.openbravo.task.CompareVersion">
asier@2001
    49
	   <classpath refid="diagnostic.class.path"/>
asier@2001
    50
	 </taskdef>
asier@2001
    51
asier@2001
    52
	<target name="check.all">
asier@2001
    53
		<ant antfile="build-create.xml" target="build"/>
asier@2021
    54
		<antcall target="check.permissions"/>
asier@2021
    55
		<antcall target="check.log4j"/>
asier@2001
    56
		<antcall target="check.db"/>
asier@2001
    57
		<antcall target="check.ant"/>
asier@2001
    58
		<antcall target="check.tomcat"/>
asier@2001
    59
	</target>
asier@2001
    60
	
asier@2021
    61
	<target name="check.log4j">
asier@2021
    62
		<echo message="Checking for log4j.lcf file..."/>
asier@2021
    63
		<available file="../config/log4j.lcf" property="isLog4j"/>
asier@2021
    64
		<fail unless="isLog4j" message="log4j.file not available"/>
asier@2021
    65
		<echo message="log4j.lcf file OK"/>
asier@2021
    66
	</target>
asier@2001
    67
	
asier@2021
    68
	<target name="check.permissions" if="isUnix">
asier@2021
    69
		<echo message="Checking file permissions for current user, (this will take a while)..."/>
asier@2021
    70
		<exec executable="./check-ob-perms.sh" failonerror="true">
asier@2021
    71
			<arg value=".."/>
asier@2021
    72
		</exec>
asier@2021
    73
		<echo message="Permissions OK"/>
asier@2021
    74
	</target>
asier@2001
    75
	
asier@2001
    76
	<target name="check.ant">
asier@2001
    77
		<antcall target="check.ant.version"/>
asier@2001
    78
		<antcall target="check.ant.jvm.size"/>
asier@2001
    79
		<antcall target="check.ant.jvm.version"/>
asier@2001
    80
	</target>
asier@2001
    81
	
asier@2001
    82
	<target name="check.tomcat">
asier@2001
    83
		<antcall target="deploy.context"/>
asier@2021
    84
		 
asier@2001
    85
		<antcall target="check.tomcat.version"/>
asier@2001
    86
		<antcall target="check.tomcat.jvm.size"/>
asier@2001
    87
		<antcall target="check.tomcat.jvm.version"/>	
asier@2013
    88
		<antcall target="check.tomcat.ant"/>  
asier@2021
    89
		<antcall target="check.tomcat.permissions"/>
asier@2001
    90
	</target>
asier@2001
    91
	
asier@2001
    92
	<target name="check.db">
asier@2001
    93
		<taskdef name="checkDB"
asier@2001
    94
		                 classname="org.openbravo.task.CheckDB">
asier@2001
    95
		          <classpath refid="diagnostic.class.path"/>
asier@2001
    96
		</taskdef>
asier@2001
    97
		<checkDB/>
asier@2001
    98
	</target>
asier@2001
    99
	
asier@2001
   100
  <target name="check.ant.version">
asier@2001
   101
  	<echo message="Checking ant version..."/>
asier@2001
   102
  	<echo message="Minimun ${ant.min.version}, current ${ant.version}"/>
asier@2001
   103
    <condition property="antversion">
asier@2001
   104
        <antversion atleast="${ant.min.version}"/>
asier@2001
   105
    </condition>
asier@2001
   106
  	<fail unless="antversion" message="Minimum ant version: ${ant.min.version}, current version ${ant.version}"/>
asier@2001
   107
  	<echo message="Version OK"/>
asier@2001
   108
  </target>
asier@2001
   109
	
asier@2001
   110
	<target name="check.ant.jvm.version">
asier@2001
   111
	     <echo message="Checking ant's JVM version..."/>
asier@2001
   112
	     <compareVersion v1="${ant.java.version}"
asier@2001
   113
	                     v2="${jvm-version}"/>
asier@2001
   114
	  </target>
asier@2001
   115
	
asier@2001
   116
	<target name="check.ant.jvm.size">
asier@2001
   117
		<taskdef name="checkAntMem"
asier@2001
   118
		             classname="org.openbravo.task.CheckMemory">
asier@2001
   119
		      <classpath refid="diagnostic.class.path"/>
asier@2001
   120
		    </taskdef>
asier@2001
   121
		    <checkAntMem/>
asier@2001
   122
	</target>
asier@2001
   123
	
asier@2001
   124
	
asier@2001
   125
	
asier@2001
   126
	<target name="check.tomcat.version">
asier@2001
   127
	    <taskdef name="checkTomcatVersion"
asier@2001
   128
	             classname="org.openbravo.task.CheckTomcatVersion">
asier@2001
   129
	      <classpath refid="diagnostic.class.path"/>
asier@2001
   130
	    </taskdef>
asier@2001
   131
	    <checkTomcatVersion/>
asier@2001
   132
	  </target>
asier@2001
   133
	
asier@2001
   134
	<target name="check.tomcat.jvm.size">
asier@2001
   135
    <taskdef name="checkMem"
asier@2001
   136
             classname="org.openbravo.task.CheckTomcatMemory">
asier@2001
   137
    	<classpath refid="diagnostic.class.path"/>
asier@2001
   138
    </taskdef>
asier@2001
   139
		<checkMem/>
asier@2001
   140
  </target>
asier@2001
   141
	
asier@2001
   142
	<target name="check.tomcat.jvm.version">
asier@2001
   143
	    <taskdef name="checkJVMversion"
asier@2001
   144
	             classname="org.openbravo.task.CheckJVMVersion">
asier@2001
   145
	      <classpath refid="diagnostic.class.path"/>
asier@2001
   146
	    </taskdef>
asier@2001
   147
	    <checkJVMversion/>
asier@2001
   148
	  </target>
asier@2013
   149
	
asier@2013
   150
	 <target name="check.tomcat.ant">
asier@2013
   151
	      <taskdef name="checkTomcatAnt"
asier@2013
   152
	               classname="org.openbravo.task.CheckTomcatAntExecution">
asier@2013
   153
	        <classpath refid="diagnostic.class.path"/>
asier@2013
   154
	      </taskdef>
asier@2013
   155
	      <checkTomcatAnt/>
asier@2013
   156
	 </target>
asier@2001
   157
  
asier@2001
   158
	<target name="deploy.context" unless="context.running">
asier@2001
   159
		<ant antfile="build-create.xml" target="war"/>
asier@2001
   160
		<taskdef name="deploy.war" classname="org.apache.catalina.ant.DeployTask">
asier@2001
   161
		  <classpath refid="tomcat.classpath"/>
asier@2001
   162
		</taskdef>
asier@2001
   163
		<taskdef name="start"    classname="org.apache.catalina.ant.StartTask">
asier@2001
   164
		      <classpath refid="tomcat.classpath"/>
asier@2001
   165
		</taskdef>
asier@2001
   166
	
asier@2001
   167
		<deploy.war url="${tomcat.manager.url}" 
asier@2001
   168
			          username="${tomcat.manager.username}" 
asier@2001
   169
			          password="${tomcat.manager.password}"
asier@2001
   170
		            path="/OpenbravoDiagnostics" 
asier@2021
   171
			          war="file:src-diagnostics/OpenbravoDiagnostics.war"/>
asier@2001
   172
		
asier@2001
   173
		<start      url="${tomcat.manager.url}" 
asier@2001
   174
		            username="${tomcat.manager.username}" 
asier@2001
   175
			          password="${tomcat.manager.password}"
asier@2001
   176
		            path="/OpenbravoDiagnostics"/>
asier@2001
   177
		
asier@2001
   178
asier@2001
   179
	</target>
asier@2013
   180
	
asier@2021
   181
	<target name="check.tomcat.permissions">
asier@2021
   182
		<taskdef name="checkTomcatPermissions"
asier@2021
   183
             classname="org.openbravo.task.CheckTomcatFilePermissions">
asier@2021
   184
		  <classpath refid="diagnostic.class.path"/>
asier@2021
   185
    </taskdef>
asier@2021
   186
    <checkTomcatPermissions/>
asier@2021
   187
  </target>
asier@2021
   188
	
asier@2013
   189
	<target name="test1" description="simple ant task to be called from tomcat">
asier@2013
   190
		<echo message="testing..."/>
asier@2013
   191
	</target>
asier@2013
   192
	
asier@2013
   193
	<target name="test2" description="simple compilation task">
asier@2013
   194
		<javac srcdir="src" destdir="build/classes" includes="**/Test*" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" deprecation="on"/>
asier@2013
   195
	</target>
asier@2001
   196
</project>