build.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: disp
  5. (C) Copyright IBM Corp. 2005 2022
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. *****************************************************************************************************************
  10. This build script supports the following parameters:
  11. Command line options from build.bat (build.sh) :
  12. expand_location Specify the expand location, e.g. -Dexpand_location=e:\crnroot\expand. Default value is "temp/expand"
  13. context_root Specify the context root for ear file , e.g. -Dcontext_root=mygateway. Default value is "p2pd"
  14. ear_name Specify the ear file name if build ear file, e.g. -Dear_name=e:\crnroot\myp2pd.ear. Default value is "p2pd.ear"
  15. war_name Specify the war file name if build war file, e.g. -Dwar_name=e:\crnroot\myp2pd.war. Default value is "p2pd.war"
  16. cogroot_path Specify the path to the Cognos install if it's not the current install, e.g. -Dcogroot_path=e:\ibm_cog_install. Default value is the current install path.
  17. appserver_type Specify the type of application server, e.g. -Dappserver_type=jboss. Default value is "other"
  18. accepted values are :
  19. jboss Perform actions for a Red Hat JBoss application server
  20. sap Perform actions for a SAP NetWeaver application server
  21. sjsas Perform actions for a Sun Java Systems application server
  22. other(default) Perform actions for any other application server
  23. Default target:
  24. war
  25. Available targets:
  26. ear Build ear file including the content in webcontent folder.
  27. ear_without_webcontent Build war file without including the content in webcontent folder
  28. war Build war file including the content in webcontent folder.
  29. war_without_webcontent Build war file without including the content in webcontent folder
  30. expand Expand the content (including the webcontent folder) to a folder instead of building a war file
  31. expand_without_webcontent Expand the content(without including the webcontent folder) to a folder instead of building a war file
  32. Note the basedir of this project is (/crn_install_root).
  33. *****************************************************************************************************************
  34. -->
  35. <project name="CognosReportNetJ2EE" default="war" basedir="../..">
  36. <property name="expand_location" value="temp/expand" />
  37. <property name="context_root" value="p2pd" />
  38. <property name="ear_name" value="p2pd.ear" />
  39. <property name="war_name" value="p2pd.war" />
  40. <property name="appserver_type" value="other"/>
  41. <property name="is_${appserver_type}" value="true"/>
  42. <property name="cogroot_path" value="${basedir}"/>
  43. <property name="cogroot_link_file" value="webapps/p2pd/WEB-INF/classes/cogroot.link"/>
  44. <target name="checkCogRootLinkExists">
  45. <available file="${cogroot_link_file}" property="cogroot_link_file.exists"/>
  46. </target>
  47. <target name="chmodCogRootLink" depends="checkCogRootLinkExists" if="cogroot_link_file.exists">
  48. <chmod file="${cogroot_link_file}" perm="u+w"/>
  49. </target>
  50. <!-- create cogroot.link if it doesn't exist -->
  51. <target name="genCogRootLink" depends="chmodCogRootLink">
  52. <echo file="${cogroot_link_file}" append="false">${cogroot_path}</echo>
  53. </target>
  54. <target name="clean" depends="clean_war">
  55. <delete quiet="true" file="temp/war/p2pd.ear"/>
  56. </target>
  57. <target name="clean_war" depends="clean_jboss, clean_sap">
  58. <delete quiet="true" dir="temp/war/p2pd"/>
  59. <delete quiet="true" file="temp/war/p2pd.war"/>
  60. </target>
  61. <target name="CMcheck">
  62. <available property="webXMLName" value="web.xml.withCM" file="webapps/p2pd/WEB-INF/lib/CognosCM.jar"/>
  63. <property name="webXMLName" value="web.xml.noCM"/>
  64. </target>
  65. <target name="clean_jboss" if="is_jboss">
  66. <delete quiet="true" file="webapps/p2pd/WEB-INF/jboss-classloading.xml"/>
  67. <delete quiet="true" file="webapps/p2pd/WEB-INF/jboss-scanning.xml"/>
  68. </target>
  69. <target name="clean_sap" if="is_sap">
  70. <delete quiet="true" file="webapps/p2pd/WEB-INF/web-j2ee-engine.xml"/>
  71. </target>
  72. <target name="exclude_files_jboss">
  73. <delete quiet="true" file="temp/war/p2pd/lib/commons-logging-1.1.jar"/>
  74. <delete quiet="true" file="temp/war/p2pd/lib/commons-logging-api-1.1.jar"/>
  75. <delete quiet="true" file="temp/war/p2pd/lib/xalan.jar"/>
  76. <delete quiet="true" file="temp/war/p2pd/lib/xbean.jar"/>
  77. </target>
  78. <target name="exclude_files_sjsas">
  79. <delete quiet="true" file="temp/war/p2pd/lib/derbyclient.jar"/>
  80. </target>
  81. <target name="exclude_files_sap"/>
  82. <target name="exclude_files_other"/>
  83. <target name="move_files_jboss" if="is_jboss">
  84. <copy file="war/p2pd/jboss5/WEB-INF/jboss-classloading.xml" todir="webapps/p2pd/WEB-INF" overwrite="true"/>
  85. <copy file="war/p2pd/jboss5/WEB-INF/jboss-scanning.xml" todir="webapps/p2pd/WEB-INF" overwrite="true"/>
  86. <replace
  87. file="webapps/p2pd/WEB-INF/jboss-classloading.xml"
  88. token="p2pd"
  89. value="${context_root}">
  90. </replace>
  91. </target>
  92. <target name="move_files_sap" if="is_sap">
  93. <copy file="war/p2pd/sap/WEB-INF/web-j2ee-engine.xml" todir="webapps/p2pd/WEB-INF" overwrite="true"/>
  94. </target>
  95. <target name="move_files" depends="genCogRootLink, clean, move_files_jboss, move_files_sap">
  96. <copy todir="temp/war/p2pd/lib">
  97. <fileset dir="webapps/p2pd/WEB-INF/lib"/>
  98. <fileset dir="tomcat/lib">
  99. <include name="jcam_jni.jar"/>
  100. </fileset>
  101. </copy>
  102. <copy file="cmplst.txt" todir="webapps/p2pd/WEB-INF" overwrite="true"/>
  103. <move file="temp/war/p2pd/lib/jakarta-oro-2.0.8.jar" tofile="temp/war/p2pd/lib/jakarta-oro.jar"/>
  104. <move file="temp/war/p2pd/lib/log4j-over-slf4j-1.7.35.jar" tofile="temp/war/p2pd/lib/log4j.jar"/>
  105. <move file="temp/war/p2pd/lib/logkit-1.2.jar" tofile="temp/war/p2pd/lib/logkit.jar"/>
  106. <move file="temp/war/p2pd/lib/velocity-1.1.jar" tofile="temp/war/p2pd/lib/velocity.jar"/>
  107. <antcall target="exclude_files_${appserver_type}"/>
  108. </target>
  109. <target name="war" depends="gen_war">
  110. <move file="temp/war/p2pd.war" tofile="${war_name}" overwrite="true"/>
  111. <antcall target="clean_war"/>
  112. </target>
  113. <target name="gen_war" depends="genCogRootLink, move_files, CMcheck">
  114. <war warfile="temp/war/p2pd.war" webxml="webapps/p2pd/WEB-INF/${webXMLName}">
  115. <zipfileset dir="webcontent" prefix="servlet">
  116. <exclude name="index.html"/>
  117. <exclude name="default.html"/>
  118. </zipfileset>
  119. <fileset dir="war/p2pd" includes="index.html"/>
  120. <fileset dir="webapps/p2pd" includes="version.xml"/>
  121. <classes dir="webapps/p2pd/WEB-INF/classes" includes="*.*"/>
  122. <lib dir="temp/war/p2pd/lib"/>
  123. <webinf dir="webapps/p2pd/WEB-INF">
  124. <exclude name="*classes/*"/>
  125. <exclude name="*lib/**"/>
  126. <exclude name="web.xml"/>
  127. <exclude name="web.xml.noCM"/>
  128. <exclude name="PogoLogkitConfig.xml"/>
  129. </webinf>
  130. </war>
  131. </target>
  132. <!-- generate war without docs and samples -->
  133. <target name="war_without_docsamples" depends="gen_war_without_docsamples">
  134. <move file="temp/war/p2pd.war" tofile="${war_name}" overwrite="true"/>
  135. <antcall target="clean_war"/>
  136. </target>
  137. <!-- generate ear without docs and samples -->
  138. <target name="ear_without_docsamples" depends="gen_war_without_docsamples">
  139. <delete quiet="true" file="${ear_name}"/>
  140. <filter token="p2pd" value="${context_root}"/>
  141. <filter token="p2pdwar" value="p2pd.war"/>
  142. <copy file="war/p2pd/application.xml.template" tofile="war/p2pd/application.xml" filtering="true" overwrite="true"/>
  143. <ear earfile="temp/war/p2pd.ear" appxml="war/p2pd/application.xml">
  144. <fileset dir="temp/war" includes="p2pd.war"/>
  145. </ear>
  146. <move file="temp/war/p2pd.ear" tofile="${ear_name}" overwrite="true"/>
  147. <antcall target="clean"/>
  148. </target>
  149. <!-- generate war without docs and samples -->
  150. <target name="gen_war_without_docsamples" depends="genCogRootLink, move_files, CMcheck">
  151. <war warfile="temp/war/p2pd.war" webxml="webapps/p2pd/WEB-INF/${webXMLName}">
  152. <zipfileset dir="webcontent" prefix="servlet">
  153. <exclude name="index.html"/>
  154. <exclude name="default.html"/>
  155. <exclude name="samples/**"/>
  156. <exclude name="documentation/**"/>
  157. </zipfileset>
  158. <fileset dir="war/p2pd" includes="index.html"/>
  159. <fileset dir="webapps/p2pd" includes="version.xml"/>
  160. <classes dir="webapps/p2pd/WEB-INF/classes" includes="*.*"/>
  161. <lib dir="temp/war/p2pd/lib"/>
  162. <webinf dir="webapps/p2pd/WEB-INF">
  163. <exclude name="*classes/*"/>
  164. <exclude name="*lib/**"/>
  165. <exclude name="web.xml"/>
  166. <exclude name="web.xml.noCM"/>
  167. <exclude name="PogoLogkitConfig.xml"/>
  168. </webinf>
  169. </war>
  170. </target>
  171. <!-- war_without_webcontent -->
  172. <target name="war_without_webcontent" depends="gen_war_without_webcontent">
  173. <move file="temp/war/p2pd.war" tofile="${war_name}" overwrite="true"/>
  174. <antcall target="clean_war"/>
  175. </target>
  176. <target name="gen_war_without_webcontent" depends="genCogRootLink, move_files, CMcheck">
  177. <war warfile="temp/war/p2pd.war" webxml="webapps/p2pd/WEB-INF/${webXMLName}">
  178. <classes dir="webapps/p2pd/WEB-INF/classes" includes="*.*"/>
  179. <lib dir="temp/war/p2pd/lib"/>
  180. <fileset dir="webapps/p2pd" includes="version.xml"/>
  181. <webinf dir="webapps/p2pd/WEB-INF">
  182. <exclude name="*classes/*"/>
  183. <exclude name="*lib/**"/>
  184. <exclude name="web.xml"/>
  185. <exclude name="web.xml.noCM"/>
  186. <exclude name="PogoLogkitConfig.xml"/>
  187. </webinf>
  188. </war>
  189. </target>
  190. <target name="ear" depends="gen_war">
  191. <delete quiet="true" file="${ear_name}"/>
  192. <filter token="p2pd" value="${context_root}"/>
  193. <filter token="p2pdwar" value="p2pd.war"/>
  194. <copy file="war/p2pd/application.xml.template" tofile="war/p2pd/application.xml" filtering="true" overwrite="true"/>
  195. <ear earfile="temp/war/p2pd.ear" appxml="war/p2pd/application.xml">
  196. <fileset dir="temp/war" includes="p2pd.war"/>
  197. </ear>
  198. <move file="temp/war/p2pd.ear" tofile="${ear_name}" overwrite="true"/>
  199. <antcall target="clean"/>
  200. </target>
  201. <target name="ear_without_webcontent" depends="gen_war_without_webcontent">
  202. <delete quiet="true" file="${ear_name}"/>
  203. <filter token="p2pd" value="${context_root}"/>
  204. <filter token="p2pdwar" value="p2pd.war"/>
  205. <copy file="war/p2pd/application.xml.template" tofile="war/p2pd/application.xml" filtering="true" overwrite="true"/>
  206. <ear earfile="temp/war/p2pd.ear" appxml="war/p2pd/application.xml">
  207. <fileset dir="temp/war" includes="p2pd.war"/>
  208. </ear>
  209. <move file="temp/war/p2pd.ear" tofile="${ear_name}" overwrite="true"/>
  210. <antcall target="clean"/>
  211. </target>
  212. <target name="expand" depends="genCogRootLink, move_files, CMcheck">
  213. <copy todir="${expand_location}">
  214. <fileset dir="webapps/p2pd" includes="version.xml"/>
  215. </copy>
  216. <copy todir="${expand_location}/servlet">
  217. <fileset dir="webcontent">
  218. <exclude name="index.html"/>
  219. <exclude name="default.html"/>
  220. </fileset>
  221. </copy>
  222. <copy todir="${expand_location}">
  223. <fileset dir="war/p2pd" includes="index.html"/>
  224. </copy>
  225. <copy todir="${expand_location}/WEB-INF/classes">
  226. <fileset dir="webapps/p2pd/WEB-INF/classes"/>
  227. </copy>
  228. <copy todir="${expand_location}/WEB-INF/lib">
  229. <fileset dir="temp/war/p2pd/lib"/>
  230. </copy>
  231. <copy todir="${expand_location}/WEB-INF">
  232. <fileset dir="webapps/p2pd/WEB-INF">
  233. <include name="${webXMLName}"/>
  234. </fileset>
  235. </copy>
  236. <move file="${expand_location}/WEB-INF/${webXMLName}" tofile="${expand_location}/WEB-INF/web.xml"/>
  237. <copy todir="${expand_location}/WEB-INF">
  238. <fileset dir="webapps/p2pd/WEB-INF">
  239. <exclude name="*classes/*"/>
  240. <exclude name="*lib/**"/>
  241. <exclude name="web.xml"/>
  242. <exclude name="web.xml.noCM"/>
  243. <exclude name="PogoLogkitConfig.xml"/>
  244. </fileset>
  245. </copy>
  246. <antcall target="clean"/>
  247. </target>
  248. <target name="expand_without_webcontent" depends="genCogRootLink, move_files, CMcheck">
  249. <copy todir="${expand_location}">
  250. <fileset dir="webapps/p2pd" includes="version.xml"/>
  251. </copy>
  252. <copy todir="${expand_location}/WEB-INF/classes">
  253. <fileset dir="webapps/p2pd/WEB-INF/classes"/>
  254. </copy>
  255. <copy todir="${expand_location}/WEB-INF/lib">
  256. <fileset dir="temp/war/p2pd/lib"/>
  257. </copy>
  258. <copy todir="${expand_location}/WEB-INF">
  259. <fileset dir="webapps/p2pd/WEB-INF">
  260. <include name="${webXMLName}"/>
  261. </fileset>
  262. </copy>
  263. <move file="${expand_location}/WEB-INF/${webXMLName}" tofile="${expand_location}/WEB-INF/web.xml"/>
  264. <copy todir="${expand_location}/WEB-INF">
  265. <fileset dir="webapps/p2pd/WEB-INF">
  266. <exclude name="*classes/*"/>
  267. <exclude name="*lib/**"/>
  268. <exclude name="web.xml"/>
  269. <exclude name="web.xml.noCM"/>
  270. <exclude name="PogoLogkitConfig.xml"/>
  271. </fileset>
  272. </copy>
  273. <antcall target="clean"/>
  274. </target>
  275. <target name="expand_without_docsamples" depends="genCogRootLink, move_files, CMcheck">
  276. <copy todir="${expand_location}/servlet">
  277. <fileset dir="webcontent">
  278. <exclude name="index.html"/>
  279. <exclude name="default.html"/>
  280. <exclude name="samples/**"/>
  281. <exclude name="documentation/**"/>
  282. </fileset>
  283. </copy>
  284. <copy todir="${expand_location}">
  285. <fileset dir="webapps/p2pd" includes="version.xml"/>
  286. </copy>
  287. <copy todir="${expand_location}">
  288. <fileset dir="war/p2pd" includes="index.html"/>
  289. </copy>
  290. <copy todir="${expand_location}/WEB-INF/classes">
  291. <fileset dir="webapps/p2pd/WEB-INF/classes"/>
  292. </copy>
  293. <copy todir="${expand_location}/WEB-INF/lib">
  294. <fileset dir="temp/war/p2pd/lib"/>
  295. </copy>
  296. <copy todir="${expand_location}/WEB-INF">
  297. <fileset dir="webapps/p2pd/WEB-INF">
  298. <include name="${webXMLName}"/>
  299. </fileset>
  300. </copy>
  301. <move file="${expand_location}/WEB-INF/${webXMLName}" tofile="${expand_location}/WEB-INF/web.xml"/>
  302. <copy todir="${expand_location}/WEB-INF">
  303. <fileset dir="webapps/p2pd/WEB-INF">
  304. <exclude name="*classes/*"/>
  305. <exclude name="*lib/**"/>
  306. <exclude name="web.xml"/>
  307. <exclude name="web.xml.noCM"/>
  308. <exclude name="PogoLogkitConfig.xml"/>
  309. </fileset>
  310. </copy>
  311. <antcall target="clean"/>
  312. </target>
  313. </project>