build.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="ARX" default="release" basedir=".">
  3. <description>Builds, tests, and runs the project.</description>
  4. <!-- defines the version number -->
  5. <property name="arx.version" value="3.3.0" />
  6. <!-- defines the to be included libraries -->
  7. <fileset id="lib.jars" dir="lib">
  8. <or>
  9. <filename name="**/colt-1.2.0.jar" />
  10. <filename name="**/commons-math3-3.1.1.jar" />
  11. <filename name="**/objectselector-0.1-lib.jar" />
  12. <filename name="**/commons-io-2.4.jar" />
  13. <filename name="**/commons-codec-1.5.jar" />
  14. <filename name="**/commons-logging-1.1.jar" />
  15. <filename name="**/commons-validator-1.4.1.jar" />
  16. <filename name="**/dom4j-1.6.1.jar" />
  17. <filename name="**/stax-api-1.0.1.jar" />
  18. <filename name="**/xmlbeans-2.3.0.jar" />
  19. <filename name="**/poi-3.10-FINAL-20140208.jar" />
  20. <filename name="**/poi-ooxml-3.10-FINAL-20140208.jar" />
  21. <filename name="**/poi-ooxml-schemas-3.10-FINAL-20140208.jar" />
  22. <filename name="**/hppc-0.6.0.jar" />
  23. <filename name="**/univocity-parsers-1.3.1.jar" />
  24. <filename name="**/newtonraphson-0.0.1.jar" />
  25. <filename name="**/jhpl-0.0.1.jar" />
  26. </or>
  27. </fileset>
  28. <fileset id="gui.jars" dir="lib">
  29. <or>
  30. <filename name="**/commons-lang-2.6.jar" />
  31. <filename name="**/org.eclipse.draw2d_3.8.1.201301141834.jar" />
  32. <filename name="**/org.eclipse.core.commands_3.6.2.v20130123-162658.jar" />
  33. <filename name="**/org.eclipse.core.runtime_3.8.0.v20120912-155025.jar" />
  34. <filename name="**/org.eclipse.equinox.common_3.6.100.v20120522-1841.jar" />
  35. <filename name="**/org.eclipse.jface_3.8.102.v20130123-162658.jar" />
  36. <filename name="**/libjhc-1.0.0-swt.jar" />
  37. <filename name="**/junit-4.11.jar" />
  38. <filename name="**/log4j-1.2.17.jar" />
  39. <filename name="**/swtknob-1.0.0.jar" />
  40. <filename name="**/org.eclipse.nebula.widgets.nattable.core_1.1.0.201405012245.jar" />
  41. <filename name="**/org.swtchart_0.8.0.v20120301.jar" />
  42. <filename name="**/swttable-0.0.1.jar" />
  43. <filename name="**/swtchoicesdialog-0.0.1.jar" />
  44. <filename name="**/swtrangeslider-0.0.1.jar" />
  45. <filename name="**/swttiles-0.0.1.jar" />
  46. <filename name="**/swtpreferences-0.0.1.jar" />
  47. <filename name="**/swtsimplebrowser-0.0.1.jar" />
  48. <filename name="**/jtds-1.3.1.jar" />
  49. <filename name="**/mysql-connector-java-5.1.27-bin.jar" />
  50. <filename name="**/postgresql-9.3-1101.jdbc41.jar" />
  51. <filename name="**/sqlite-jdbc-3.7.2.jar" />
  52. <filename name="**/ojdbc7.jar" />
  53. </or>
  54. </fileset>
  55. <fileset id="test.jars" dir="lib">
  56. <or>
  57. <filename name="**/junit-4.11.jar" />
  58. <filename name="**/hamcrest-core-1.3.jar" />
  59. </or>
  60. </fileset>
  61. <available file=".git" type="dir" property="git.present" />
  62. <!-- https://stackoverflow.com/questions/2974106/how-to-lookup-the-latest-git-commit-hash-from-an-ant-build-script -->
  63. <target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
  64. <exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
  65. <arg value="describe" />
  66. <arg value="--tags" />
  67. <arg value="--always" />
  68. <arg value="HEAD" />
  69. </exec>
  70. <condition property="repository.version" value="${git.revision}" else="unknown">
  71. <and>
  72. <isset property="git.revision" />
  73. <length string="${git.revision}" trim="yes" length="0" when="greater" />
  74. </and>
  75. </condition>
  76. </target>
  77. <target name="compileTest">
  78. <delete dir="build/test" failonerror="true" />
  79. <mkdir dir="build/test" />
  80. <mkdir dir="build/junitReports" />
  81. <javac includeantruntime="false" srcdir="src/main:src/gui:src/example:src/test/" destdir="build/test" source="1.7">
  82. <classpath>
  83. <fileset refid="lib.jars" />
  84. <fileset refid="gui.jars" />
  85. <fileset refid="test.jars" />
  86. <path path="lib/swt/swt-4.2.1-gtk-linux-x86.jar" />
  87. </classpath>
  88. </javac>
  89. <copy todir="build/test/org/deidentifier/arx/gui/resources" overwrite="true">
  90. <fileset dir="src/gui/org/deidentifier/arx/gui/resources" defaultexcludes="yes">
  91. <exclude name="**/*.java" />
  92. </fileset>
  93. </copy>
  94. <copy todir="build/test/org/deidentifier/arx/risk/resources/us" overwrite="true">
  95. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  96. <exclude name="**/*.java" />
  97. <exclude name="**/*.txt" />
  98. </fileset>
  99. </copy>
  100. </target>
  101. <target name="benchmark" depends="git.revision,compileTest">
  102. <junit showoutput="yes" fork="yes">
  103. <jvmarg value="-DBenchmark=build/junitReports" />
  104. <jvmarg value="-DVersion=${git.revision}" />
  105. <classpath>
  106. <fileset refid="lib.jars" />
  107. <fileset refid="test.jars" />
  108. <path path="build/test" />
  109. <path path="lib/log4j/log4j-1.2.17.jar" />
  110. <path path="lib/sqlite/sqlite-jdbc-3.7.2.jar" />
  111. <path path="lib/swt/swt-4.2.1-gtk-linux-x86.jar" />
  112. </classpath>
  113. <batchtest todir="build/junitReports">
  114. <fileset dir="src/test/">
  115. <include name="**/TestAnonymizationKAnonymity.java" />
  116. <include name="**/TestAnonymizationLDiversity.java" />
  117. <include name="**/TestAnonymizationDPresence.java" />
  118. <include name="**/TestAnonymizationTCloseness.java" />
  119. <include name="**/TestAnonymizationCombinations.java" />
  120. <include name="**/TestAnonymizationDifferentialPrivacy.java" />
  121. </fileset>
  122. <formatter type="plain" usefile="false" />
  123. <formatter type="xml" />
  124. </batchtest>
  125. </junit>
  126. <antcall target="analyse-benchmark" />
  127. </target>
  128. <target name="analyse-benchmark">
  129. <java jar="arx-analyse.jar" fork="true">
  130. </java>
  131. </target>
  132. <target name="test" depends="compileTest">
  133. <junit showoutput="yes">
  134. <classpath>
  135. <fileset refid="lib.jars" />
  136. <fileset refid="test.jars" />
  137. <path path="build/test" />
  138. <path path="lib/log4j/log4j-1.2.17.jar" />
  139. <path path="lib/sqlite/sqlite-jdbc-3.7.2.jar" />
  140. <path path="lib/swt/swt-4.2.1-gtk-linux-x86.jar" />
  141. </classpath>
  142. <batchtest todir="build/junitReports" fork="yes">
  143. <fileset dir="src/test/" includes="**/Test*.java" />
  144. <formatter type="plain" usefile="false" />
  145. <formatter type="xml" />
  146. </batchtest>
  147. </junit>
  148. </target>
  149. <target name="release" depends="jars">
  150. </target>
  151. <target name="clean" depends="end-clean">
  152. <delete dir="jars" failonerror="true" />
  153. </target>
  154. <target name="end-clean">
  155. <delete dir="build/lib" failonerror="true" />
  156. <delete dir="build/gui" failonerror="true" />
  157. <delete dir="build/extLibs" failonerror="true" />
  158. <delete dir="build" failonerror="true" />
  159. </target>
  160. <target name="prepare" depends="clean">
  161. <mkdir dir="build" />
  162. <mkdir dir="build/extLibs" />
  163. <mkdir dir="build/lib" />
  164. <mkdir dir="build/gui" />
  165. <mkdir dir="jars" />
  166. </target>
  167. <target name="clean-javadoc">
  168. <delete includeEmptyDirs="true" failonerror="true">
  169. <fileset dir="doc/api" includes="**/*" defaultexcludes="yes">
  170. <exclude name="doc/api/.svn" />
  171. </fileset>
  172. </delete>
  173. <delete includeEmptyDirs="true" failonerror="true">
  174. <fileset dir="doc/gui" includes="**/*" defaultexcludes="yes">
  175. <exclude name="doc/gui/.svn" />
  176. </fileset>
  177. </delete>
  178. <delete includeEmptyDirs="true" failonerror="true">
  179. <fileset dir="doc/dev" includes="**/*" defaultexcludes="yes">
  180. <exclude name="doc/dev/.svn" />
  181. </fileset>
  182. </delete>
  183. </target>
  184. <target name="javadoc-api" depends="clean-javadoc">
  185. <javadoc overview="doc/overview-api.html" destdir="doc/api" source="1.7" notree="false" nonavbar="false" noindex="false" splitindex="true" access="public" use="true" author="Florian Kohlmayer and Fabian Praßer" version="${arx.version}" windowtitle="ARX API Documentation" private="false" failonerror="true" additionalparam="-notimestamp">
  186. <classpath>
  187. <fileset refid="lib.jars" />
  188. <path path="src/main" />
  189. </classpath>
  190. <packageset dir="src/main/" defaultexcludes="yes">
  191. <exclude name="org/deidentifier/arx/algorithm/" />
  192. <exclude name="org/deidentifier/arx/framework/" />
  193. </packageset>
  194. </javadoc>
  195. </target>
  196. <target name="javadoc-dev" depends="clean-javadoc">
  197. <javadoc overview="doc/overview-dev.html" destdir="doc/dev" source="1.7" notree="false" use="true" nonavbar="false" noindex="false" splitindex="false" author="Florian Kohlmayer and Fabian Praßer" version="${arx.version}" windowtitle="ARX Developer Documentation" private="false" failonerror="true" additionalparam="-notimestamp">
  198. <classpath>
  199. <fileset refid="lib.jars" />
  200. <path path="src/main" />
  201. </classpath>
  202. <packageset dir="src/main/" defaultexcludes="yes">
  203. </packageset>
  204. </javadoc>
  205. </target>
  206. <target name="javadoc-gui" depends="clean-javadoc">
  207. <javadoc overview="doc/overview-gui.html" destdir="doc/gui" source="1.7" notree="false" use="true" nonavbar="false" noindex="false" splitindex="false" author="Florian Kohlmayer and Fabian Praßer" version="${arx.version}" windowtitle="ARX GUI Documentation" private="false" failonerror="true" additionalparam="-notimestamp">
  208. <classpath>
  209. <fileset refid="lib.jars" />
  210. <fileset refid="gui.jars" />
  211. <path path="lib/swt/swt-4.2.1-gtk-linux-x86.jar" />
  212. <path path="src/main" />
  213. </classpath>
  214. <packageset dir="src/main/" defaultexcludes="yes">
  215. <exclude name="org/deidentifier/arx/algorithm/" />
  216. <exclude name="org/deidentifier/arx/framework/" />
  217. </packageset>
  218. <packageset dir="src/gui/" defaultexcludes="yes">
  219. </packageset>
  220. </javadoc>
  221. </target>
  222. <target name="javadoc" depends="javadoc-api,javadoc-gui,javadoc-dev">
  223. </target>
  224. <target name="compile" depends="prepare" description="compile the source ">
  225. <javac includeantruntime="false" srcdir="src/main/" destdir="build/lib" source="1.7">
  226. <classpath>
  227. <fileset refid="lib.jars" />
  228. <path path="src/main" />
  229. </classpath>
  230. </javac>
  231. <javac includeantruntime="false" srcdir="src/main:src/gui/" destdir="build/gui" source="1.7">
  232. <classpath>
  233. <fileset refid="lib.jars" />
  234. <fileset refid="gui.jars" />
  235. <path path="lib/swt/swt-4.2.1-gtk-linux-x86.jar" />
  236. <path path="src/main" />
  237. </classpath>
  238. </javac>
  239. <copy todir="build/gui/org/deidentifier/arx/gui/resources" overwrite="true">
  240. <fileset dir="src/gui/org/deidentifier/arx/gui/resources" defaultexcludes="yes">
  241. <exclude name="**/*.java" />
  242. </fileset>
  243. </copy>
  244. <copy todir="build/main/org/deidentifier/arx/risk/resources/us" overwrite="true">
  245. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  246. <exclude name="**/*.java" />
  247. <exclude name="**/*.txt" />
  248. </fileset>
  249. </copy>
  250. <copy todir="build/gui/org/deidentifier/arx/risk/resources/us" overwrite="true">
  251. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  252. <exclude name="**/*.java" />
  253. <exclude name="**/*.txt" />
  254. </fileset>
  255. </copy>
  256. </target>
  257. <target name="buildExternalLibs">
  258. <jar jarfile="build/extLibs/lib.jar">
  259. <zipgroupfileset refid="lib.jars" />
  260. </jar>
  261. <jar jarfile="build/extLibs/gui.jar">
  262. <zipgroupfileset refid="gui.jars" />
  263. </jar>
  264. </target>
  265. <target name="jar-win" depends="compile, buildExternalLibs">
  266. <jar destfile="jars/arx-${arx.version}-win.jar">
  267. <fileset dir="build/gui" defaultexcludes="no" />
  268. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  269. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  270. <zipfileset src="lib/swt/swt-4.2.1-win32-win32-x86.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  271. <manifest>
  272. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  273. </manifest>
  274. </jar>
  275. <jar destfile="jars/arx-${arx.version}-win-64.jar">
  276. <fileset dir="build/gui" defaultexcludes="no" />
  277. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  278. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  279. <zipfileset src="lib/swt/swt-4.2.1-win32-win32-x86_64.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  280. <manifest>
  281. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  282. </manifest>
  283. </jar>
  284. </target>
  285. <target name="jar-linux" depends="compile, buildExternalLibs">
  286. <jar destfile="jars/arx-${arx.version}-gtk.jar">
  287. <fileset dir="build/gui" defaultexcludes="no" />
  288. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  289. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  290. <zipfileset src="lib/swt/swt-4.2.1-gtk-linux-x86.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  291. <manifest>
  292. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  293. </manifest>
  294. </jar>
  295. <jar destfile="jars/arx-${arx.version}-gtk-64.jar">
  296. <fileset dir="build/gui" defaultexcludes="no" />
  297. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  298. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  299. <zipfileset src="lib/swt/swt-4.2.1-gtk-linux-x86_64.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  300. <manifest>
  301. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  302. </manifest>
  303. </jar>
  304. </target>
  305. <target name="jar-osx" depends="compile, buildExternalLibs">
  306. <jar destfile="jars/arx-${arx.version}-osx.jar">
  307. <fileset dir="build/gui" defaultexcludes="no" />
  308. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  309. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  310. <zipfileset src="lib/swt/swt-4.2.1-cocoa-macosx.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  311. <manifest>
  312. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  313. </manifest>
  314. </jar>
  315. <jar destfile="jars/arx-${arx.version}-osx-64.jar">
  316. <fileset dir="build/gui" defaultexcludes="no" />
  317. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  318. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  319. <zipfileset src="lib/swt/swt-4.2.1-cocoa-macosx-x86_64.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  320. <manifest>
  321. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  322. </manifest>
  323. </jar>
  324. </target>
  325. <target name="jar-libs" depends="compile, buildExternalLibs">
  326. <jar destfile="jars/arx-${arx.version}-src.jar">
  327. <fileset dir="src/gui" defaultexcludes="no" />
  328. <fileset dir="src/main" defaultexcludes="no" />
  329. </jar>
  330. <jar destfile="jars/libarx-${arx.version}-src.jar">
  331. <fileset dir="src/main" defaultexcludes="no" />
  332. <fileset dir="src/test" defaultexcludes="no" />
  333. <fileset dir="src/example" defaultexcludes="no" />
  334. </jar>
  335. <jar destfile="jars/libarx-${arx.version}.jar">
  336. <fileset dir="build/lib" defaultexcludes="no" />
  337. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  338. </jar>
  339. <jar destfile="jars/libarx-${arx.version}-min.jar">
  340. <fileset dir="build/lib" defaultexcludes="no" />
  341. <zipfileset src="lib/objectselector/objectselector-0.1-lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  342. </jar>
  343. </target>
  344. <target name="jar-docs" depends="compile, javadoc">
  345. <jar destfile="jars/libarx-${arx.version}-doc.jar">
  346. <fileset dir="doc/api" defaultexcludes="no" />
  347. </jar>
  348. <jar destfile="jars/libarx-${arx.version}-dev-doc.jar">
  349. <fileset dir="doc/dev" defaultexcludes="no" />
  350. </jar>
  351. <jar destfile="jars/arx-${arx.version}-doc.jar">
  352. <fileset dir="doc/gui" defaultexcludes="no" />
  353. </jar>
  354. </target>
  355. <target name="jars" depends="jar-win, jar-linux, jar-osx, jar-libs, jar-docs">
  356. <antcall target="end-clean" />
  357. </target>
  358. </project>