build.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  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.9.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="**/libjhc-1.0.0-swt.jar" />
  43. <filename name="**/junit-4.11.jar" />
  44. <filename name="**/log4j-1.2.17.jar" />
  45. <filename name="**/swtknob-1.0.0.jar" />
  46. <filename name="**/swttable-0.0.1.jar" />
  47. <filename name="**/swtchoicesdialog-0.0.1.jar" />
  48. <filename name="**/swtrangeslider-0.0.1.jar" />
  49. <filename name="**/swttiles-0.0.1.jar" />
  50. <filename name="**/swtpreferences-0.0.1.jar" />
  51. <filename name="**/swtsimplebrowser-0.0.1.jar" />
  52. <filename name="**/jtds-1.3.1.jar" />
  53. <filename name="**/mysql-connector-java-5.1.38-bin.jar" />
  54. <filename name="**/postgresql-9.3-1101.jdbc41.jar" />
  55. <filename name="**/sqlite-jdbc-3.7.2.jar" />
  56. <filename name="**/ojdbc7.jar" />
  57. <filename name="**/org.eclipse.core.commands_3.9.700.v20191217-1850.jar" />
  58. <filename name="**/org.eclipse.core.runtime_3.18.0.v20200506-2143.jar" />
  59. <filename name="**/org.eclipse.draw2d_3.10.100.201606061308.jar" />
  60. <filename name="**/org.eclipse.equinox.common_3.12.0.v20200504-1602.jar" />
  61. <filename name="**/org.eclipse.jface_3.20.0.v20200505-1952.jar" />
  62. <filename name="**/org.eclipse.nebula.visualization.widgets_1.1.0.202006092019.jar" />
  63. <filename name="**/org.eclipse.nebula.visualization.xygraph_3.1.0.202006092019.jar" />
  64. <filename name="**/org.eclipse.nebula.widgets.nattable.core_1.6.0.201909181823.jar" />
  65. <filename name="**/org.eclipse.nebula.widgets.pagination_1.0.0.202006191828.jar" />
  66. <filename name="**/org.swtchart_0.8.0.v20120301.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/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.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/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.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/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.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/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.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/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.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-64.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/eclipse/org.eclipse.swt.win32.win32.x86_64_3.114.100.v20200604-0951.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. </target>
  317. <target name="jar-linux" depends="compile, buildExternalLibs">
  318. <jar destfile="jars/arx-${arx.version}-gtk-64.jar">
  319. <fileset dir="build/gui" defaultexcludes="no" />
  320. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  321. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  322. <zipfileset src="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  323. <manifest>
  324. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  325. </manifest>
  326. </jar>
  327. </target>
  328. <target name="jar-osx" depends="compile, buildExternalLibs">
  329. <jar destfile="jars/arx-${arx.version}-osx-64.jar">
  330. <fileset dir="build/gui" defaultexcludes="no" />
  331. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  332. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  333. <zipfileset src="lib/ant/eclipse/org.eclipse.swt.cocoa.macosx.x86_64_3.114.100.v20200604-0951.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  334. <manifest>
  335. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  336. </manifest>
  337. </jar>
  338. </target>
  339. <target name="jar-libs" depends="compile, buildExternalLibs">
  340. <jar destfile="jars/arx-${arx.version}-src.jar">
  341. <fileset dir="src/gui" defaultexcludes="no" />
  342. <fileset dir="src/main" defaultexcludes="no" />
  343. </jar>
  344. <jar destfile="jars/libarx-${arx.version}-src.jar">
  345. <fileset dir="src/main" defaultexcludes="no" />
  346. <fileset dir="src/test" defaultexcludes="no" />
  347. <fileset dir="src/example" defaultexcludes="no" />
  348. </jar>
  349. <jar destfile="jars/libarx-${arx.version}.jar">
  350. <fileset dir="build/lib/ant" defaultexcludes="no" />
  351. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  352. </jar>
  353. <jar destfile="jars/libarx-${arx.version}-min.jar">
  354. <fileset dir="build/lib/ant" defaultexcludes="no" />
  355. <zipfileset src="lib/ant/objectselector/objectselector-0.1-lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  356. </jar>
  357. </target>
  358. <target name="jar-docs" depends="compile, javadoc">
  359. <jar destfile="jars/libarx-${arx.version}-doc.jar">
  360. <fileset dir="doc/api" defaultexcludes="no" />
  361. </jar>
  362. <jar destfile="jars/libarx-${arx.version}-dev-doc.jar">
  363. <fileset dir="doc/dev" defaultexcludes="no" />
  364. </jar>
  365. <jar destfile="jars/arx-${arx.version}-doc.jar">
  366. <fileset dir="doc/gui" defaultexcludes="no" />
  367. </jar>
  368. </target>
  369. <target name="jars" depends="jar-win, jar-linux, jar-osx, jar-libs, jar-docs">
  370. <antcall target="end-clean" />
  371. </target>
  372. </project>