src-util/diagnostic/build.xml
changeset 6907 60a98816806d
parent 6702 690d2af86089
child 9085 79e55dfc8af0
equal deleted inserted replaced
6906:39596de39bca 6907:60a98816806d
       
     1 <?xml version="1.0" encoding="UTF-8" ?>
       
     2 <!--
       
     3 *************************************************************************
       
     4 * The contents of this file are subject to the Openbravo  Public  License
       
     5 * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
       
     6 * Version 1.1  with a permitted attribution clause; you may not  use this
       
     7 * file except in compliance with the License. You  may  obtain  a copy of
       
     8 * the License at http://www.openbravo.com/legal/license.html
       
     9 * Software distributed under the License  is  distributed  on  an "AS IS"
       
    10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
       
    11 * License for the specific  language  governing  rights  and  limitations
       
    12 * under the License.
       
    13 * The Original Code is Openbravo ERP.
       
    14 * The Initial Developer of the Original Code is Openbravo SLU
       
    15 * All portions are Copyright (C) 2008 Openbravo SLU
       
    16 * All Rights Reserved.
       
    17 * Contributor(s):  ______________________________________.
       
    18 ************************************************************************
       
    19 -->
       
    20 <project name="openbravo-diagnostics" basedir="." default="check.all">
       
    21 
       
    22   <property file="config/diagnostics.properties" />
       
    23   <property file="config/Openbravo.properties" />
       
    24   <property environment="env" />
       
    25 
       
    26   <condition property="context.running">
       
    27     <http url="${tomcat.manager.url}/../OpenbravoDiagnostics/Check.html" />
       
    28   </condition>
       
    29 
       
    30   <condition property="isCheckPerms">
       
    31     <and>
       
    32       <os family="unix" />
       
    33       <equals arg1="${chekPerms}" arg2="true" />
       
    34     </and>
       
    35   </condition>
       
    36 
       
    37 
       
    38 
       
    39   <path id="diagnostic.class.path">
       
    40     <pathelement path="build/classes" />
       
    41     <pathelement path="config"/>
       
    42     <fileset dir="WebContent/WEB-INF/lib">
       
    43       <include name="**/*.jar" />
       
    44     </fileset>
       
    45   </path>
       
    46 
       
    47 
       
    48   <taskdef name="compareVersion" classname="org.openbravo.task.CompareVersion">
       
    49     <classpath refid="diagnostic.class.path" />
       
    50   </taskdef>
       
    51 
       
    52   <target name="check.all">
       
    53     <antcall target="check.permissions" />
       
    54     <antcall target="check.properties.configuration" />
       
    55     <antcall target="check.environment.variables" />
       
    56     <antcall target="check.db" />
       
    57     <antcall target="check.ant" />
       
    58     <antcall target="check.tomcat" />
       
    59     <antcall target="undeploy.context" />
       
    60   </target>
       
    61 
       
    62   <target name="check.properties.configuration">
       
    63     <antcall target="check.properties" />
       
    64     <antcall target="check.log4j" />
       
    65   </target>
       
    66 
       
    67   <target name="check.environment.variables">
       
    68     <taskdef name="checkEnv" classname="org.openbravo.task.CheckEnvironmentVariables">
       
    69       <classpath refid="diagnostic.class.path" />
       
    70     </taskdef>
       
    71     <checkEnv />
       
    72   </target>
       
    73 
       
    74   <target name="check.properties">
       
    75     <echo message="Checking for Openbravo.properties file..." />
       
    76     <available file="../../config/Openbravo.properties" property="isProperties" />
       
    77     <fail unless="isProperties" message="Openbravo.properties file not available. Tip: move config/Openbravo.properties.template file to config/Openbravo.properties and configure it" />
       
    78     <echo message="Openbravo.properties file OK" />
       
    79 
       
    80     <echo message="Checking for source.path in Openbravo.properties file..." />
       
    81     <condition property="isSourcePath">
       
    82       <and>
       
    83         <isset property="source.path" />
       
    84         <available file="${source.path}" type="dir" />
       
    85       </and>
       
    86     </condition>
       
    87     <fail unless="isSourcePath" message="source.path property is not properly set in Openbravo.properties file" />
       
    88     <echo message="source.path OK" />
       
    89   </target>
       
    90 
       
    91   <target name="check.log4j">
       
    92     <echo message="Checking for log4j.lcf file..." />
       
    93     <available file="../../config/log4j.lcf" property="isLog4j" />
       
    94     <fail unless="isLog4j" message="log4j.lcf file not available. Tip: move config/log4j.lcf.template file to config/log4j.lcf and configure it" />
       
    95     <echo message="log4j.lcf file OK" />
       
    96   </target>
       
    97 
       
    98   <target name="check.permissions" if="isCheckPerms">
       
    99     <echo message="Checking file permissions for current user, (this will take a while)..." />
       
   100     <exec executable="./check-ob-perms.sh" failonerror="true">
       
   101       <arg value=".." />
       
   102     </exec>
       
   103     <echo message="Permissions OK" />
       
   104   </target>
       
   105 
       
   106   <target name="check.ant">
       
   107     <antcall target="check.ant.version" />
       
   108     <antcall target="check.ant.jvm.size" />
       
   109     <antcall target="check.ant.jvm.version" />
       
   110   </target>
       
   111 
       
   112   <target name="check.tomcat">
       
   113     <antcall target="deploy.context" />
       
   114 
       
   115     <antcall target="check.tomcat.version" />
       
   116     <antcall target="check.tomcat.jvm.size" />
       
   117     <antcall target="check.tomcat.jvm.version" />
       
   118     <antcall target="check.tomcat.ant" />
       
   119     <antcall target="check.tomcat.permissions" />
       
   120   </target>
       
   121 
       
   122   <target name="check.db">
       
   123     <taskdef name="checkDB" classname="org.openbravo.task.CheckDB">
       
   124       <classpath refid="diagnostic.class.path" />
       
   125     </taskdef>
       
   126     <checkDB />
       
   127   </target>
       
   128 
       
   129   <target name="check.ant.version">
       
   130     <echo message="Checking ant version..." />
       
   131     <echo message="Minimun ${ant.min.version}, current ${ant.version}" />
       
   132     <condition property="antversion">
       
   133       <antversion atleast="${ant.min.version}" />
       
   134     </condition>
       
   135     <fail unless="antversion" message="Minimum ant version: ${ant.min.version}, current version ${ant.version}. Tip: check http://wiki.openbravo.com/wiki/Development_Stack_Setup#Apache_Ant" />
       
   136     <echo message="Version OK" />
       
   137   </target>
       
   138 
       
   139   <target name="check.ant.jvm.version">
       
   140     <echo message="Checking ant's JVM version..." />
       
   141     <compareVersion v1="${ant.java.version}" v2="${jvm-version}" />
       
   142   </target>
       
   143 
       
   144   <target name="check.ant.jvm.size">
       
   145     <taskdef name="checkAntMem" classname="org.openbravo.task.CheckMemory">
       
   146       <classpath refid="diagnostic.class.path" />
       
   147     </taskdef>
       
   148     <checkAntMem />
       
   149   </target>
       
   150 
       
   151 
       
   152 
       
   153   <target name="check.tomcat.version">
       
   154     <taskdef name="checkTomcatVersion" classname="org.openbravo.task.CheckTomcatVersion">
       
   155       <classpath refid="diagnostic.class.path" />
       
   156     </taskdef>
       
   157     <checkTomcatVersion />
       
   158   </target>
       
   159 
       
   160   <target name="check.tomcat.jvm.size">
       
   161     <taskdef name="checkMem" classname="org.openbravo.task.CheckTomcatMemory">
       
   162       <classpath refid="diagnostic.class.path" />
       
   163     </taskdef>
       
   164     <checkMem />
       
   165   </target>
       
   166 
       
   167   <target name="check.tomcat.jvm.version">
       
   168     <taskdef name="checkJVMversion" classname="org.openbravo.task.CheckJVMVersion">
       
   169       <classpath refid="diagnostic.class.path" />
       
   170     </taskdef>
       
   171     <checkJVMversion />
       
   172   </target>
       
   173 
       
   174   <target name="check.tomcat.ant">
       
   175     <taskdef name="checkTomcatAnt" classname="org.openbravo.task.CheckTomcatAntExecution">
       
   176       <classpath refid="diagnostic.class.path" />
       
   177     </taskdef>
       
   178     <checkTomcatAnt />
       
   179   </target>
       
   180 
       
   181   <target name="check.tomcat.x">
       
   182     <taskdef name="CheckX" classname="org.openbravo.task.CheckX">
       
   183       <classpath refid="diagnostic.class.path" />
       
   184     </taskdef>
       
   185     <CheckX />
       
   186   </target>
       
   187 
       
   188 
       
   189   <target name="deploy.context" unless="context.running">
       
   190     <ant antfile="build-create.xml" target="war" />
       
   191     <taskdef name="deploy.war" classname="org.apache.catalina.ant.DeployTask">
       
   192       <classpath refid="diagnostic.class.path" />
       
   193     </taskdef>
       
   194     <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
       
   195       <classpath refid="diagnostic.class.path" />
       
   196     </taskdef>
       
   197 
       
   198     <deploy.war url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" war="file:src-util${file.separator}diagnostic${file.separator}OpenbravoDiagnostics.war" />
       
   199 
       
   200     <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" />
       
   201 
       
   202 
       
   203   </target>
       
   204 
       
   205   <target name="check.tomcat.permissions" if="isCheckPerms">
       
   206     <taskdef name="checkTomcatPermissions" classname="org.openbravo.task.CheckTomcatFilePermissions">
       
   207       <classpath refid="diagnostic.class.path" />
       
   208     </taskdef>
       
   209     <checkTomcatPermissions />
       
   210   </target>
       
   211 
       
   212   <target name="undeploy.context">
       
   213     <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
       
   214       <classpath refid="diagnostic.class.path" />
       
   215     </taskdef>
       
   216     <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" failonerror="false" />
       
   217   </target>
       
   218 
       
   219   <target name="test1" description="simple ant task to be called from tomcat">
       
   220     <echo message="testing..." />
       
   221   </target>
       
   222 
       
   223   <target name="test2" description="simple compilation task">
       
   224     <delete file="build/classes/Test.class" failonerror="false" />
       
   225     <javac srcdir="src" destdir="build/classes" includes="**/Test*" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" deprecation="on" />
       
   226   </target>
       
   227 </project>