build.xml 21 KB

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