build.xml 21 KB

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