src-diagnostics/build.xml
author Martin Taal <martin.taal@openbravo.com>
Mon, 02 Feb 2009 06:33:43 +0000
changeset 2871 065884513f10
parent 2291 81968b541bd2
child 6489 2c21e06e2e3b
permissions -rw-r--r--
Reformatted xml
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
martin@2871
    22
  <property file="config/diagnostics.properties" />
martin@2871
    23
  <property file="config/Openbravo.properties" />
martin@2871
    24
  <property environment="env" />
martin@2871
    25
asier@2001
    26
  <condition property="context.running">
martin@2871
    27
    <http url="${tomcat.manager.url}/../OpenbravoDiagnostics/Check.html" />
asier@2021
    28
  </condition>
asier@2021
    29
martin@2871
    30
  <condition property="isCheckPerms">
martin@2871
    31
    <and>
martin@2871
    32
      <os family="unix" />
martin@2871
    33
      <equals arg1="${chekPerms}" arg2="true" />
martin@2871
    34
    </and>
asier@2021
    35
  </condition>
asier@2021
    36
asier@2001
    37
martin@2871
    38
martin@2871
    39
  <path id="diagnostic.class.path">
martin@2871
    40
    <pathelement path="build/classes" />
asier@2001
    41
    <fileset dir="WebContent/WEB-INF/lib">
martin@2871
    42
      <include name="**/*.jar" />
asier@2001
    43
    </fileset>
martin@2871
    44
  </path>
asier@2001
    45
martin@2871
    46
martin@2871
    47
  <taskdef name="compareVersion" classname="org.openbravo.task.CompareVersion">
martin@2871
    48
    <classpath refid="diagnostic.class.path" />
martin@2871
    49
  </taskdef>
martin@2871
    50
martin@2871
    51
  <target name="check.all">
martin@2871
    52
    <antcall target="check.permissions" />
martin@2871
    53
    <antcall target="check.properties.configuration" />
martin@2871
    54
    <antcall target="check.environment.variables" />
martin@2871
    55
    <antcall target="check.db" />
martin@2871
    56
    <antcall target="check.ant" />
martin@2871
    57
    <antcall target="check.tomcat" />
martin@2871
    58
    <antcall target="undeploy.context" />
martin@2871
    59
  </target>
martin@2871
    60
martin@2871
    61
  <target name="check.properties.configuration">
martin@2871
    62
    <antcall target="check.properties" />
martin@2871
    63
    <antcall target="check.log4j" />
martin@2871
    64
  </target>
martin@2871
    65
martin@2871
    66
  <target name="check.environment.variables">
martin@2871
    67
    <taskdef name="checkEnv" classname="org.openbravo.task.CheckEnvironmentVariables">
martin@2871
    68
      <classpath refid="diagnostic.class.path" />
martin@2871
    69
    </taskdef>
martin@2871
    70
    <checkEnv />
martin@2871
    71
  </target>
martin@2871
    72
martin@2871
    73
  <target name="check.properties">
martin@2871
    74
    <echo message="Checking for Openbravo.properties file..." />
martin@2871
    75
    <available file="../config/Openbravo.properties" property="isProperties" />
martin@2871
    76
    <fail unless="isProperties" message="Openbravo.properties file not available. Tip: move config/Openbravo.properties.template file to config/Openbravo.properties and configure it" />
martin@2871
    77
    <echo message="Openbravo.properties file OK" />
martin@2871
    78
martin@2871
    79
    <echo message="Checking for source.path in Openbravo.properties file..." />
martin@2871
    80
    <condition property="isSourcePath">
martin@2871
    81
      <and>
martin@2871
    82
        <isset property="source.path" />
martin@2871
    83
        <available file="${source.path}" type="dir" />
martin@2871
    84
      </and>
martin@2871
    85
    </condition>
martin@2871
    86
    <fail unless="isSourcePath" message="source.path property is not properly set in Openbravo.properties file" />
martin@2871
    87
    <echo message="source.path OK" />
martin@2871
    88
  </target>
martin@2871
    89
martin@2871
    90
  <target name="check.log4j">
martin@2871
    91
    <echo message="Checking for log4j.lcf file..." />
martin@2871
    92
    <available file="../config/log4j.lcf" property="isLog4j" />
martin@2871
    93
    <fail unless="isLog4j" message="log4j.lcf file not available. Tip: move config/log4j.lcf.template file to config/log4j.lcf and configure it" />
martin@2871
    94
    <echo message="log4j.lcf file OK" />
martin@2871
    95
  </target>
martin@2871
    96
martin@2871
    97
  <target name="check.permissions" if="isCheckPerms">
martin@2871
    98
    <echo message="Checking file permissions for current user, (this will take a while)..." />
martin@2871
    99
    <exec executable="./check-ob-perms.sh" failonerror="true">
martin@2871
   100
      <arg value=".." />
martin@2871
   101
    </exec>
martin@2871
   102
    <echo message="Permissions OK" />
martin@2871
   103
  </target>
martin@2871
   104
martin@2871
   105
  <target name="check.ant">
martin@2871
   106
    <antcall target="check.ant.version" />
martin@2871
   107
    <antcall target="check.ant.jvm.size" />
martin@2871
   108
    <antcall target="check.ant.jvm.version" />
martin@2871
   109
  </target>
martin@2871
   110
martin@2871
   111
  <target name="check.tomcat">
martin@2871
   112
    <antcall target="deploy.context" />
martin@2871
   113
martin@2871
   114
    <antcall target="check.tomcat.version" />
martin@2871
   115
    <antcall target="check.tomcat.jvm.size" />
martin@2871
   116
    <antcall target="check.tomcat.jvm.version" />
martin@2871
   117
    <antcall target="check.tomcat.ant" />
martin@2871
   118
    <antcall target="check.tomcat.permissions" />
martin@2871
   119
  </target>
martin@2871
   120
martin@2871
   121
  <target name="check.db">
martin@2871
   122
    <taskdef name="checkDB" classname="org.openbravo.task.CheckDB">
martin@2871
   123
      <classpath refid="diagnostic.class.path" />
martin@2871
   124
    </taskdef>
martin@2871
   125
    <checkDB />
martin@2871
   126
  </target>
martin@2871
   127
asier@2001
   128
  <target name="check.ant.version">
martin@2871
   129
    <echo message="Checking ant version..." />
martin@2871
   130
    <echo message="Minimun ${ant.min.version}, current ${ant.version}" />
asier@2001
   131
    <condition property="antversion">
martin@2871
   132
      <antversion atleast="${ant.min.version}" />
asier@2001
   133
    </condition>
martin@2871
   134
    <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" />
martin@2871
   135
    <echo message="Version OK" />
asier@2001
   136
  </target>
martin@2871
   137
martin@2871
   138
  <target name="check.ant.jvm.version">
martin@2871
   139
    <echo message="Checking ant's JVM version..." />
martin@2871
   140
    <compareVersion v1="${ant.java.version}" v2="${jvm-version}" />
martin@2871
   141
  </target>
martin@2871
   142
martin@2871
   143
  <target name="check.ant.jvm.size">
martin@2871
   144
    <taskdef name="checkAntMem" classname="org.openbravo.task.CheckMemory">
martin@2871
   145
      <classpath refid="diagnostic.class.path" />
asier@2001
   146
    </taskdef>
martin@2871
   147
    <checkAntMem />
asier@2001
   148
  </target>
martin@2871
   149
martin@2871
   150
martin@2871
   151
martin@2871
   152
  <target name="check.tomcat.version">
martin@2871
   153
    <taskdef name="checkTomcatVersion" classname="org.openbravo.task.CheckTomcatVersion">
martin@2871
   154
      <classpath refid="diagnostic.class.path" />
martin@2871
   155
    </taskdef>
martin@2871
   156
    <checkTomcatVersion />
martin@2871
   157
  </target>
martin@2871
   158
martin@2871
   159
  <target name="check.tomcat.jvm.size">
martin@2871
   160
    <taskdef name="checkMem" classname="org.openbravo.task.CheckTomcatMemory">
martin@2871
   161
      <classpath refid="diagnostic.class.path" />
martin@2871
   162
    </taskdef>
martin@2871
   163
    <checkMem />
martin@2871
   164
  </target>
martin@2871
   165
martin@2871
   166
  <target name="check.tomcat.jvm.version">
martin@2871
   167
    <taskdef name="checkJVMversion" classname="org.openbravo.task.CheckJVMVersion">
martin@2871
   168
      <classpath refid="diagnostic.class.path" />
martin@2871
   169
    </taskdef>
martin@2871
   170
    <checkJVMversion />
martin@2871
   171
  </target>
martin@2871
   172
martin@2871
   173
  <target name="check.tomcat.ant">
martin@2871
   174
    <taskdef name="checkTomcatAnt" classname="org.openbravo.task.CheckTomcatAntExecution">
martin@2871
   175
      <classpath refid="diagnostic.class.path" />
martin@2871
   176
    </taskdef>
martin@2871
   177
    <checkTomcatAnt />
martin@2871
   178
  </target>
martin@2871
   179
asier@2028
   180
  <target name="check.tomcat.x">
martin@2871
   181
    <taskdef name="CheckX" classname="org.openbravo.task.CheckX">
martin@2871
   182
      <classpath refid="diagnostic.class.path" />
martin@2871
   183
    </taskdef>
martin@2871
   184
    <CheckX />
martin@2871
   185
  </target>
asier@2001
   186
martin@2871
   187
martin@2871
   188
  <target name="deploy.context" unless="context.running">
martin@2871
   189
    <ant antfile="build-create.xml" target="war" />
martin@2871
   190
    <taskdef name="deploy.war" classname="org.apache.catalina.ant.DeployTask">
martin@2871
   191
      <classpath refid="diagnostic.class.path" />
asier@2021
   192
    </taskdef>
martin@2871
   193
    <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
martin@2871
   194
      <classpath refid="diagnostic.class.path" />
martin@2871
   195
    </taskdef>
martin@2871
   196
martin@2871
   197
    <deploy.war url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" war="file:src-diagnostics${file.separator}OpenbravoDiagnostics.war" />
martin@2871
   198
martin@2871
   199
    <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" />
martin@2871
   200
martin@2871
   201
asier@2021
   202
  </target>
martin@2871
   203
martin@2871
   204
  <target name="check.tomcat.permissions" if="isCheckPerms">
martin@2871
   205
    <taskdef name="checkTomcatPermissions" classname="org.openbravo.task.CheckTomcatFilePermissions">
martin@2871
   206
      <classpath refid="diagnostic.class.path" />
martin@2871
   207
    </taskdef>
martin@2871
   208
    <checkTomcatPermissions />
martin@2871
   209
  </target>
martin@2871
   210
martin@2871
   211
  <target name="undeploy.context">
asier@2051
   212
    <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
martin@2871
   213
      <classpath refid="diagnostic.class.path" />
asier@2051
   214
    </taskdef>
martin@2871
   215
    <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" failonerror="false" />
martin@2871
   216
  </target>
martin@2871
   217
martin@2871
   218
  <target name="test1" description="simple ant task to be called from tomcat">
martin@2871
   219
    <echo message="testing..." />
martin@2871
   220
  </target>
martin@2871
   221
martin@2871
   222
  <target name="test2" description="simple compilation task">
martin@2871
   223
    <delete file="build/classes/Test.class" failonerror="false" />
martin@2871
   224
    <javac srcdir="src" destdir="build/classes" includes="**/Test*" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" deprecation="on" />
martin@2871
   225
  </target>
asier@2001
   226
</project>