src-util/diagnostic/build.xml
author RM packaging bot <staff.rm@openbravo.com>
Mon, 15 Jul 2013 04:41:54 +0000
changeset 20690 895ac3b1f59a
parent 11995 e7b20e55553e
child 35011 4099d7b5ceca
permissions -rw-r--r--
Update AD_MODULE version to 3.0MP25
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
priya@9085
     5
* Version  1.1  (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.
ggi@6702
    14
* The Initial Developer of the Original Code is Openbravo SLU
ggi@6702
    15
* All portions are Copyright (C) 2008 Openbravo SLU
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@6489
    41
    <pathelement path="config"/>
asier@2001
    42
    <fileset dir="WebContent/WEB-INF/lib">
martin@2871
    43
      <include name="**/*.jar" />
asier@2001
    44
    </fileset>
martin@2871
    45
  </path>
asier@2001
    46
martin@2871
    47
martin@2871
    48
  <taskdef name="compareVersion" classname="org.openbravo.task.CompareVersion">
martin@2871
    49
    <classpath refid="diagnostic.class.path" />
martin@2871
    50
  </taskdef>
martin@2871
    51
martin@2871
    52
  <target name="check.all">
martin@2871
    53
    <antcall target="check.permissions" />
martin@2871
    54
    <antcall target="check.properties.configuration" />
martin@2871
    55
    <antcall target="check.environment.variables" />
martin@2871
    56
    <antcall target="check.db" />
martin@2871
    57
    <antcall target="check.ant" />
martin@2871
    58
    <antcall target="check.tomcat" />
martin@2871
    59
    <antcall target="undeploy.context" />
martin@2871
    60
  </target>
martin@2871
    61
martin@2871
    62
  <target name="check.properties.configuration">
martin@2871
    63
    <antcall target="check.properties" />
martin@2871
    64
    <antcall target="check.log4j" />
martin@2871
    65
  </target>
martin@2871
    66
martin@2871
    67
  <target name="check.environment.variables">
martin@2871
    68
    <taskdef name="checkEnv" classname="org.openbravo.task.CheckEnvironmentVariables">
martin@2871
    69
      <classpath refid="diagnostic.class.path" />
martin@2871
    70
    </taskdef>
martin@2871
    71
    <checkEnv />
martin@2871
    72
  </target>
martin@2871
    73
martin@2871
    74
  <target name="check.properties">
martin@2871
    75
    <echo message="Checking for Openbravo.properties file..." />
antonio@6907
    76
    <available file="../../config/Openbravo.properties" property="isProperties" />
martin@2871
    77
    <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
    78
    <echo message="Openbravo.properties file OK" />
martin@2871
    79
martin@2871
    80
    <echo message="Checking for source.path in Openbravo.properties file..." />
martin@2871
    81
    <condition property="isSourcePath">
martin@2871
    82
      <and>
martin@2871
    83
        <isset property="source.path" />
martin@2871
    84
        <available file="${source.path}" type="dir" />
martin@2871
    85
      </and>
martin@2871
    86
    </condition>
martin@2871
    87
    <fail unless="isSourcePath" message="source.path property is not properly set in Openbravo.properties file" />
martin@2871
    88
    <echo message="source.path OK" />
martin@2871
    89
  </target>
martin@2871
    90
martin@2871
    91
  <target name="check.log4j">
martin@2871
    92
    <echo message="Checking for log4j.lcf file..." />
antonio@6907
    93
    <available file="../../config/log4j.lcf" property="isLog4j" />
martin@2871
    94
    <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
    95
    <echo message="log4j.lcf file OK" />
martin@2871
    96
  </target>
martin@2871
    97
martin@2871
    98
  <target name="check.permissions" if="isCheckPerms">
martin@2871
    99
    <echo message="Checking file permissions for current user, (this will take a while)..." />
martin@2871
   100
    <exec executable="./check-ob-perms.sh" failonerror="true">
martin@2871
   101
      <arg value=".." />
martin@2871
   102
    </exec>
martin@2871
   103
    <echo message="Permissions OK" />
martin@2871
   104
  </target>
martin@2871
   105
martin@2871
   106
  <target name="check.ant">
martin@2871
   107
    <antcall target="check.ant.version" />
martin@2871
   108
    <antcall target="check.ant.jvm.size" />
martin@2871
   109
    <antcall target="check.ant.jvm.version" />
martin@2871
   110
  </target>
martin@2871
   111
martin@2871
   112
  <target name="check.tomcat">
martin@2871
   113
    <antcall target="deploy.context" />
martin@2871
   114
martin@2871
   115
    <antcall target="check.tomcat.version" />
martin@2871
   116
    <antcall target="check.tomcat.jvm.size" />
martin@2871
   117
    <antcall target="check.tomcat.jvm.version" />
martin@2871
   118
    <antcall target="check.tomcat.ant" />
martin@2871
   119
    <antcall target="check.tomcat.permissions" />
martin@2871
   120
  </target>
martin@2871
   121
martin@2871
   122
  <target name="check.db">
martin@2871
   123
    <taskdef name="checkDB" classname="org.openbravo.task.CheckDB">
martin@2871
   124
      <classpath refid="diagnostic.class.path" />
martin@2871
   125
    </taskdef>
martin@2871
   126
    <checkDB />
martin@2871
   127
  </target>
martin@2871
   128
asier@2001
   129
  <target name="check.ant.version">
martin@2871
   130
    <echo message="Checking ant version..." />
martin@2871
   131
    <echo message="Minimun ${ant.min.version}, current ${ant.version}" />
asier@2001
   132
    <condition property="antversion">
martin@2871
   133
      <antversion atleast="${ant.min.version}" />
asier@2001
   134
    </condition>
martin@2871
   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" />
martin@2871
   136
    <echo message="Version OK" />
asier@2001
   137
  </target>
martin@2871
   138
martin@2871
   139
  <target name="check.ant.jvm.version">
martin@2871
   140
    <echo message="Checking ant's JVM version..." />
martin@2871
   141
    <compareVersion v1="${ant.java.version}" v2="${jvm-version}" />
martin@2871
   142
  </target>
martin@2871
   143
martin@2871
   144
  <target name="check.ant.jvm.size">
martin@2871
   145
    <taskdef name="checkAntMem" classname="org.openbravo.task.CheckMemory">
martin@2871
   146
      <classpath refid="diagnostic.class.path" />
asier@2001
   147
    </taskdef>
martin@2871
   148
    <checkAntMem />
asier@2001
   149
  </target>
martin@2871
   150
martin@2871
   151
martin@2871
   152
martin@2871
   153
  <target name="check.tomcat.version">
martin@2871
   154
    <taskdef name="checkTomcatVersion" classname="org.openbravo.task.CheckTomcatVersion">
martin@2871
   155
      <classpath refid="diagnostic.class.path" />
martin@2871
   156
    </taskdef>
martin@2871
   157
    <checkTomcatVersion />
martin@2871
   158
  </target>
martin@2871
   159
martin@2871
   160
  <target name="check.tomcat.jvm.size">
martin@2871
   161
    <taskdef name="checkMem" classname="org.openbravo.task.CheckTomcatMemory">
martin@2871
   162
      <classpath refid="diagnostic.class.path" />
martin@2871
   163
    </taskdef>
martin@2871
   164
    <checkMem />
martin@2871
   165
  </target>
martin@2871
   166
martin@2871
   167
  <target name="check.tomcat.jvm.version">
martin@2871
   168
    <taskdef name="checkJVMversion" classname="org.openbravo.task.CheckJVMVersion">
martin@2871
   169
      <classpath refid="diagnostic.class.path" />
martin@2871
   170
    </taskdef>
martin@2871
   171
    <checkJVMversion />
martin@2871
   172
  </target>
martin@2871
   173
martin@2871
   174
  <target name="check.tomcat.ant">
martin@2871
   175
    <taskdef name="checkTomcatAnt" classname="org.openbravo.task.CheckTomcatAntExecution">
martin@2871
   176
      <classpath refid="diagnostic.class.path" />
martin@2871
   177
    </taskdef>
martin@2871
   178
    <checkTomcatAnt />
martin@2871
   179
  </target>
martin@2871
   180
asier@2028
   181
  <target name="check.tomcat.x">
martin@2871
   182
    <taskdef name="CheckX" classname="org.openbravo.task.CheckX">
martin@2871
   183
      <classpath refid="diagnostic.class.path" />
martin@2871
   184
    </taskdef>
martin@2871
   185
    <CheckX />
martin@2871
   186
  </target>
asier@2001
   187
martin@2871
   188
martin@2871
   189
  <target name="deploy.context" unless="context.running">
martin@2871
   190
    <ant antfile="build-create.xml" target="war" />
martin@2871
   191
    <taskdef name="deploy.war" classname="org.apache.catalina.ant.DeployTask">
martin@2871
   192
      <classpath refid="diagnostic.class.path" />
asier@2021
   193
    </taskdef>
martin@2871
   194
    <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
martin@2871
   195
      <classpath refid="diagnostic.class.path" />
martin@2871
   196
    </taskdef>
martin@2871
   197
antonio@6907
   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" />
martin@2871
   199
martin@2871
   200
    <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" />
martin@2871
   201
martin@2871
   202
asier@2021
   203
  </target>
martin@2871
   204
martin@2871
   205
  <target name="check.tomcat.permissions" if="isCheckPerms">
martin@2871
   206
    <taskdef name="checkTomcatPermissions" classname="org.openbravo.task.CheckTomcatFilePermissions">
martin@2871
   207
      <classpath refid="diagnostic.class.path" />
martin@2871
   208
    </taskdef>
martin@2871
   209
    <checkTomcatPermissions />
martin@2871
   210
  </target>
martin@2871
   211
martin@2871
   212
  <target name="undeploy.context">
asier@2051
   213
    <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
martin@2871
   214
      <classpath refid="diagnostic.class.path" />
asier@2051
   215
    </taskdef>
martin@2871
   216
    <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" failonerror="false" />
martin@2871
   217
  </target>
martin@2871
   218
martin@2871
   219
  <target name="test1" description="simple ant task to be called from tomcat">
martin@2871
   220
    <echo message="testing..." />
martin@2871
   221
  </target>
martin@2871
   222
martin@2871
   223
  <target name="test2" description="simple compilation task">
martin@2871
   224
    <delete file="build/classes/Test.class" failonerror="false" />
stefan@11995
   225
    <javac srcdir="src" destdir="build/classes" includes="**/Test*" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" deprecation="on" includeantruntime="false" />
martin@2871
   226
  </target>
asier@2001
   227
</project>