src-util/diagnostic/build.xml
author Javier Armendáriz <javier.armendariz@openbravo.com>
Tue, 06 Nov 2018 13:50:43 +0100
changeset 35052 6474c4dae278
parent 35011 4099d7b5ceca
permissions -rw-r--r--
[log4j2] Fixing diagnostic build script path and removing missing old log4j cfg.
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
javier@35011
    15
* All portions are Copyright (C) 2008-2018 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" />
javier@35052
    41
    <pathelement path="${base.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">
javier@35011
    92
    <echo message="Checking for log4j2*.xml files..." />
javier@35011
    93
    <condition property="isLog4j">
javier@35011
    94
      <and>
javier@35011
    95
        <available file="../../config/log4j2.xml" />
javier@35011
    96
        <available file="../../config/log4j2-web.xml" />
javier@35011
    97
      </and>
javier@35011
    98
    </condition>
javier@35011
    99
javier@35011
   100
    <fail unless="isLog4j" message="log4j2.xml and/or log4j2-web.xml file not available. Tip: copy config/log4j2.xml.template and config/log4j2-web.xml files removing the .template prefix and configure them" />
javier@35011
   101
    <echo message="log4j2 configuration files OK" />
martin@2871
   102
  </target>
martin@2871
   103
martin@2871
   104
  <target name="check.permissions" if="isCheckPerms">
martin@2871
   105
    <echo message="Checking file permissions for current user, (this will take a while)..." />
martin@2871
   106
    <exec executable="./check-ob-perms.sh" failonerror="true">
martin@2871
   107
      <arg value=".." />
martin@2871
   108
    </exec>
martin@2871
   109
    <echo message="Permissions OK" />
martin@2871
   110
  </target>
martin@2871
   111
martin@2871
   112
  <target name="check.ant">
martin@2871
   113
    <antcall target="check.ant.version" />
martin@2871
   114
    <antcall target="check.ant.jvm.size" />
martin@2871
   115
    <antcall target="check.ant.jvm.version" />
martin@2871
   116
  </target>
martin@2871
   117
martin@2871
   118
  <target name="check.tomcat">
martin@2871
   119
    <antcall target="deploy.context" />
martin@2871
   120
martin@2871
   121
    <antcall target="check.tomcat.version" />
martin@2871
   122
    <antcall target="check.tomcat.jvm.size" />
martin@2871
   123
    <antcall target="check.tomcat.jvm.version" />
martin@2871
   124
    <antcall target="check.tomcat.ant" />
martin@2871
   125
    <antcall target="check.tomcat.permissions" />
martin@2871
   126
  </target>
martin@2871
   127
martin@2871
   128
  <target name="check.db">
martin@2871
   129
    <taskdef name="checkDB" classname="org.openbravo.task.CheckDB">
martin@2871
   130
      <classpath refid="diagnostic.class.path" />
martin@2871
   131
    </taskdef>
martin@2871
   132
    <checkDB />
martin@2871
   133
  </target>
martin@2871
   134
asier@2001
   135
  <target name="check.ant.version">
martin@2871
   136
    <echo message="Checking ant version..." />
martin@2871
   137
    <echo message="Minimun ${ant.min.version}, current ${ant.version}" />
asier@2001
   138
    <condition property="antversion">
martin@2871
   139
      <antversion atleast="${ant.min.version}" />
asier@2001
   140
    </condition>
martin@2871
   141
    <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
   142
    <echo message="Version OK" />
asier@2001
   143
  </target>
martin@2871
   144
martin@2871
   145
  <target name="check.ant.jvm.version">
martin@2871
   146
    <echo message="Checking ant's JVM version..." />
martin@2871
   147
    <compareVersion v1="${ant.java.version}" v2="${jvm-version}" />
martin@2871
   148
  </target>
martin@2871
   149
martin@2871
   150
  <target name="check.ant.jvm.size">
martin@2871
   151
    <taskdef name="checkAntMem" classname="org.openbravo.task.CheckMemory">
martin@2871
   152
      <classpath refid="diagnostic.class.path" />
asier@2001
   153
    </taskdef>
martin@2871
   154
    <checkAntMem />
asier@2001
   155
  </target>
martin@2871
   156
martin@2871
   157
martin@2871
   158
martin@2871
   159
  <target name="check.tomcat.version">
martin@2871
   160
    <taskdef name="checkTomcatVersion" classname="org.openbravo.task.CheckTomcatVersion">
martin@2871
   161
      <classpath refid="diagnostic.class.path" />
martin@2871
   162
    </taskdef>
martin@2871
   163
    <checkTomcatVersion />
martin@2871
   164
  </target>
martin@2871
   165
martin@2871
   166
  <target name="check.tomcat.jvm.size">
martin@2871
   167
    <taskdef name="checkMem" classname="org.openbravo.task.CheckTomcatMemory">
martin@2871
   168
      <classpath refid="diagnostic.class.path" />
martin@2871
   169
    </taskdef>
martin@2871
   170
    <checkMem />
martin@2871
   171
  </target>
martin@2871
   172
martin@2871
   173
  <target name="check.tomcat.jvm.version">
martin@2871
   174
    <taskdef name="checkJVMversion" classname="org.openbravo.task.CheckJVMVersion">
martin@2871
   175
      <classpath refid="diagnostic.class.path" />
martin@2871
   176
    </taskdef>
martin@2871
   177
    <checkJVMversion />
martin@2871
   178
  </target>
martin@2871
   179
martin@2871
   180
  <target name="check.tomcat.ant">
martin@2871
   181
    <taskdef name="checkTomcatAnt" classname="org.openbravo.task.CheckTomcatAntExecution">
martin@2871
   182
      <classpath refid="diagnostic.class.path" />
martin@2871
   183
    </taskdef>
martin@2871
   184
    <checkTomcatAnt />
martin@2871
   185
  </target>
martin@2871
   186
asier@2028
   187
  <target name="check.tomcat.x">
martin@2871
   188
    <taskdef name="CheckX" classname="org.openbravo.task.CheckX">
martin@2871
   189
      <classpath refid="diagnostic.class.path" />
martin@2871
   190
    </taskdef>
martin@2871
   191
    <CheckX />
martin@2871
   192
  </target>
asier@2001
   193
martin@2871
   194
martin@2871
   195
  <target name="deploy.context" unless="context.running">
martin@2871
   196
    <ant antfile="build-create.xml" target="war" />
martin@2871
   197
    <taskdef name="deploy.war" classname="org.apache.catalina.ant.DeployTask">
martin@2871
   198
      <classpath refid="diagnostic.class.path" />
asier@2021
   199
    </taskdef>
martin@2871
   200
    <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
martin@2871
   201
      <classpath refid="diagnostic.class.path" />
martin@2871
   202
    </taskdef>
martin@2871
   203
antonio@6907
   204
    <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
   205
martin@2871
   206
    <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" />
martin@2871
   207
martin@2871
   208
asier@2021
   209
  </target>
martin@2871
   210
martin@2871
   211
  <target name="check.tomcat.permissions" if="isCheckPerms">
martin@2871
   212
    <taskdef name="checkTomcatPermissions" classname="org.openbravo.task.CheckTomcatFilePermissions">
martin@2871
   213
      <classpath refid="diagnostic.class.path" />
martin@2871
   214
    </taskdef>
martin@2871
   215
    <checkTomcatPermissions />
martin@2871
   216
  </target>
martin@2871
   217
martin@2871
   218
  <target name="undeploy.context">
asier@2051
   219
    <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
martin@2871
   220
      <classpath refid="diagnostic.class.path" />
asier@2051
   221
    </taskdef>
martin@2871
   222
    <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/OpenbravoDiagnostics" failonerror="false" />
martin@2871
   223
  </target>
martin@2871
   224
martin@2871
   225
  <target name="test1" description="simple ant task to be called from tomcat">
martin@2871
   226
    <echo message="testing..." />
martin@2871
   227
  </target>
martin@2871
   228
martin@2871
   229
  <target name="test2" description="simple compilation task">
martin@2871
   230
    <delete file="build/classes/Test.class" failonerror="false" />
stefan@11995
   231
    <javac srcdir="src" destdir="build/classes" includes="**/Test*" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" deprecation="on" includeantruntime="false" />
martin@2871
   232
  </target>
asier@2001
   233
</project>