build.xml 21 KB

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