build-common.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <project name="build-common" basedir="." default="...">
  2. <property name="javac.debug" value="true"/>
  3. <property name="javac.deprecation" value="false"/>
  4. <property file="${buildconfig.dir}/prerequisites.properties"/>
  5. <property file="${buildconfig.dir}/orionplaces.properties"/>
  6. <property name="coverage.tool" value="none"/>
  7. <import file="${buildconfig.dir}/build-coverage.${coverage.tool}.xml"/>
  8. <property name="checkstyle.xsl" location="${buildconfig.dir}/checkstyle-report.xsl"/>
  9. <property name="checkstyle.config" location="${buildconfig.dir}/checkstyle.xml"/>
  10. <!--
  11. Common source code and destination code structure
  12. -->
  13. <property name="src.main.java.dir" location="src/main/java"/>
  14. <property name="src.main.resources.dir" location="src/main/resources"/>
  15. <property name="src.test.java.dir" location="src/test/java"/>
  16. <property name="src.test.resources.dir" location="src/test/resources"/>
  17. <property name="build.dir" location="target"/>
  18. <property name="lib.dir" location="${build.dir}/lib"/>
  19. <property name="gsrc.dir" location="${build.dir}/java"/>
  20. <property name="dest.dir" location="${build.dir}/classes"/>
  21. <property name="depcache.dir" location="depcache"/>
  22. <property name="utresults.dir" location="utresults"/>
  23. <property name="checkstyle.output.dir" location="checkstyle.output"/>
  24. <property name="utdest.dir" location="${build.dir}/tests"/>
  25. <macrodef name="xjc-16">
  26. <attribute name="target"/>
  27. <attribute name="schema"/>
  28. <attribute name="package"/>
  29. <sequential>
  30. <exec executable="xjc">
  31. <arg value="-d"/>
  32. <arg value="@{target}"/>
  33. <!--
  34. <arg value="-b"/>
  35. <arg value="@{b}"/>
  36. -->
  37. <arg value="-p"/>
  38. <arg value="@{package}"/>
  39. <arg value="@{schema}"/>
  40. </exec>
  41. </sequential>
  42. </macrodef>
  43. <presetdef name="my.javac">
  44. <javac debug="${javac.debug}"
  45. deprecation="${javac.deprecation}"
  46. includes="**/*.java">
  47. <compilerarg value="-source"/>
  48. <compilerarg value="1.5"/>
  49. <!--<compilerarg value="-Xlint:unchecked"/>-->
  50. <!--<compilerarg value="-Xlint:deprecation"/>-->
  51. </javac>
  52. </presetdef>
  53. <target name="clean">
  54. <delete dir="${build.dir}"/>
  55. <delete dir="${lib.dir}"/>
  56. <delete dir="${utdest.dir}"/>
  57. <delete dir="${dest.dir}"/>
  58. <delete dir="${utresults.dir}"/>
  59. <delete dir="${checkstyle.output.dir}"/>
  60. <antcall target="clean.project"/>
  61. <antcall target="clean.${coverage.tool}"/>
  62. </target>
  63. <target name="init">
  64. <mkdir dir="${build.dir}"/>
  65. <mkdir dir="${lib.dir}"/>
  66. <mkdir dir="${utdest.dir}"/>
  67. <mkdir dir="${dest.dir}"/>
  68. <mkdir dir="${utresults.dir}"/>
  69. <mkdir dir="${checkstyle.output.dir}"/>
  70. <antcall target="init.project"/>
  71. <antcall target="init.${coverage.tool}"/>
  72. </target>
  73. <path id="tests.run.classpath.base">
  74. <pathelement location="${dest.dir}"/>
  75. <pathelement location="${utdest.dir}"/>
  76. <path refid="classpath.code"/>
  77. </path>
  78. <target name="tests.run">
  79. <antcall target="tests.before"/>
  80. <antcall target="tests.execute"/>
  81. <antcall target="tests.after"/>
  82. </target>
  83. <target name="tests.execute">
  84. <junit.orion fork="yes"
  85. printsummary="yes"
  86. haltonerror="no"
  87. haltonfailure="no">
  88. <classpath refid="tests.run.classpath"/>
  89. <formatter type="plain"/>
  90. <formatter type="xml" if="junit.xml.needed"/>
  91. <batchtest todir="${utresults.dir}">
  92. <fileset dir="${utdest.dir}">
  93. <include name="**/Test*.class"/>
  94. </fileset>
  95. </batchtest>
  96. </junit.orion>
  97. </target>
  98. <target name="checkstyle">
  99. <taskdef resource="checkstyletask.properties"
  100. classpath="${checkstyle.home}/${checkstyle.jar}"/>
  101. <checkstyle config="${checkstyle.config}" failOnViolation="false">
  102. <fileset dir="${src.main.java.dir}">
  103. <include name="**/*.java"/>
  104. </fileset>
  105. <formatter type="xml" toFile="${checkstyle.output.dir}/checkstyle_errors.xml"/>
  106. </checkstyle>
  107. <style in="${checkstyle.output.dir}/checkstyle_errors.xml"
  108. out="${checkstyle.output.dir}/checkstyle_errors.html"
  109. style="${checkstyle.xsl}"/>
  110. </target>
  111. </project>