You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.xml 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <?xml version="1.0"?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. -->
  18. <project name="POI Testbuild" default="run" basedir=".">
  19. <description>Test-Ant file which verifies that the Apache POI distribution build sources can be compiled successfully.
  20. Before running this, you should execute the "jar" target in the main build.gradle to have the packaged files created correctly.
  21. </description>
  22. <property name="dist" value="../build/dist"/>
  23. <property name="build" value="../build/distsourcebuild"/>
  24. <condition property="gradle.executable" value="../gradlew.bat" else="../gradlew">
  25. <os family="windows" />
  26. </condition>
  27. <target name="init" depends="">
  28. </target>
  29. <target name="run" depends="init,runSourceBuild,runCompileTest"/>
  30. <target name="runSourceBuild" depends="init">
  31. <!-- clean out old stuff in build-dir -->
  32. <delete dir="${build}"/>
  33. <mkdir dir="${build}"/>
  34. <!-- select latest built source zip -->
  35. <pathconvert property="srcpackage">
  36. <last>
  37. <sort>
  38. <date xmlns="antlib:org.apache.tools.ant.types.resources.comparators"/>
  39. <resources>
  40. <fileset dir="${dist}">
  41. <include name="poi-src-*.zip"/>
  42. </fileset>
  43. </resources>
  44. </sort>
  45. </last>
  46. </pathconvert>
  47. <echo message="Found source package at ${srcpackage}"/>
  48. <unzip src="${srcpackage}" dest="${build}" failOnEmptyArchive="true"/>
  49. <!-- look for name of sub-dir, do this dynamically as it changes with every (beta|rc)-release -->
  50. <pathconvert property="dirversion">
  51. <dirset dir="${build}">
  52. <include name="*"/>
  53. </dirset>
  54. </pathconvert>
  55. <!-- copy over required libs to avoid re-downloading them always -->
  56. <mkdir dir="${dirversion}/lib"/>
  57. <copy todir="${dirversion}/lib">
  58. <fileset dir="../lib"/>
  59. </copy>
  60. <!-- finally call Ant on the extracted source to check if we can build the packages -->
  61. <echo message="Building in temporary dir ${dirversion}/"/>
  62. <!--ant dir="${dirversion}" target="assemble" inheritAll="false" inheritRefs="false" useNativeBasedir="true"/-->
  63. <exec executable="${gradle.executable}" dir="." failonerror="true">
  64. <arg value="assemble" />
  65. </exec>
  66. </target>
  67. <target name="runCompileTest" depends="init" description="Verify that we can compile most examples without including excelant or scratchpad jars">
  68. <!-- clean out old stuff in build-dir -->
  69. <delete dir="${build}" quiet="true" failonerror="false"/>
  70. <!-- ... try again - on Windows, the JaCoCo ant task seems to keep files open and hence the lib directory can't be removed -->
  71. <delete dir="${build}" quiet="true" failonerror="false"/>
  72. <mkdir dir="${build}"/>
  73. <!-- select latest built jar files without scratchpad.jar -->
  74. <pathconvert property="jarpackage">
  75. <sort>
  76. <resources>
  77. <fileset dir="${dist}">
  78. <include name="**/poi-5.*.jar"/>
  79. <include name="**/poi-ooxml-5.*.jar"/>
  80. <include name="**/poi-ooxml-lite-5.*.jar"/>
  81. <exclude name="**/*-javadoc*"/>
  82. <exclude name="**/*-sources*"/>
  83. </fileset>
  84. </resources>
  85. </sort>
  86. </pathconvert>
  87. <fail message="Did not find jar packages looking in directory ${dist}">
  88. <condition>
  89. <or>
  90. <equals arg1="${jarpackage}" arg2=""/>
  91. <not>
  92. <isset property="jarpackage"/>
  93. </not>
  94. </or>
  95. </condition>
  96. </fail>
  97. <echo message="Found jar packages at ${jarpackage}, dist: ${dist}"/>
  98. <path id="libs">
  99. <fileset dir="../lib/main" includes="*.jar"/>
  100. <fileset dir="../lib/ooxml" includes="*.jar"/>
  101. <fileset dir="../lib/main-tests">
  102. <include name="junit*.jar"/>
  103. </fileset>
  104. </path>
  105. <echo message="Compiling examples without linking to scratchpad.jar to ensure that only some specific ones require this jar"/>
  106. <javac srcdir="../poi-examples/src/main/java" destdir="${build}"
  107. target="1.8" source="1.8" debug="true"
  108. encoding="ASCII" fork="yes" includeantruntime="false"
  109. excludes="org/apache/poi/examples/hslf/**,org/apache/poi/examples/hsmf/**,org/apache/poi/examples/hwmf/**,**/EmbeddedObjects.java,**/EmeddedObjects.java,**/LoadEmbedded.java,**/Word2Forrest.java"
  110. classpath="${jarpackage}" classpathref="libs">
  111. </javac>
  112. <!-- select latest built jar files with additionally scratchpad.jar -->
  113. <pathconvert property="jarpackagescratchpad">
  114. <sort>
  115. <resources>
  116. <fileset dir="${dist}">
  117. <include name="**/poi-5.*.jar"/>
  118. <include name="**/poi-ooxml-5.*.jar"/>
  119. <include name="**/poi-ooxml-lite-5.*.jar"/>
  120. <include name="**/poi-scratchpad-5.*.jar"/>
  121. <exclude name="**/*-javadoc*"/>
  122. <exclude name="**/*-sources*"/>
  123. </fileset>
  124. </resources>
  125. </sort>
  126. </pathconvert>
  127. <echo message="Compiling all examples with the additional scratchpad.jar"/>
  128. <javac srcdir="../poi-examples/src/main/java" destdir="${build}"
  129. target="1.8" source="1.8" debug="true"
  130. encoding="ASCII" fork="yes" includeantruntime="false"
  131. classpath="${jarpackagescratchpad}" classpathref="libs">
  132. </javac>
  133. </target>
  134. </project>