build.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. <filename name="**/suda2-0.0.1.jar" />
  39. </or>
  40. </fileset>
  41. <fileset id="gui.jars" dir="lib/ant">
  42. <or>
  43. <filename name="**/libjhc-1.0.0-swt.jar" />
  44. <filename name="**/junit-4.11.jar" />
  45. <filename name="**/log4j-1.2.17.jar" />
  46. <filename name="**/swtknob-1.0.0.jar" />
  47. <filename name="**/swttable-0.0.1.jar" />
  48. <filename name="**/swtchoicesdialog-0.0.1.jar" />
  49. <filename name="**/swtrangeslider-0.0.1.jar" />
  50. <filename name="**/swttiles-0.0.1.jar" />
  51. <filename name="**/swtpreferences-0.0.1.jar" />
  52. <filename name="**/swtsimplebrowser-0.0.1.jar" />
  53. <filename name="**/jtds-1.3.1.jar" />
  54. <filename name="**/mysql-connector-java-5.1.38-bin.jar" />
  55. <filename name="**/postgresql-9.3-1101.jdbc41.jar" />
  56. <filename name="**/sqlite-jdbc-3.7.2.jar" />
  57. <filename name="**/ojdbc7.jar" />
  58. <filename name="**/org.eclipse.core.commands_3.9.700.v20191217-1850.jar" />
  59. <filename name="**/org.eclipse.core.runtime_3.18.0.v20200506-2143.jar" />
  60. <filename name="**/org.eclipse.draw2d_3.10.100.201606061308.jar" />
  61. <filename name="**/org.eclipse.equinox.common_3.12.0.v20200504-1602.jar" />
  62. <filename name="**/org.eclipse.jface_3.20.0.v20200505-1952.jar" />
  63. <filename name="**/org.eclipse.nebula.visualization.widgets_1.1.0.202006092019.jar" />
  64. <filename name="**/org.eclipse.nebula.visualization.xygraph_3.1.0.202006092019.jar" />
  65. <filename name="**/org.eclipse.nebula.widgets.nattable.core_1.6.0.201909181823.jar" />
  66. <filename name="**/org.eclipse.nebula.widgets.pagination_1.0.0.202006191828.jar" />
  67. <filename name="**/org.swtchart_0.8.0.v20120301.jar" />
  68. </or>
  69. </fileset>
  70. <fileset id="test.jars" dir="lib/ant">
  71. <or>
  72. <filename name="**/junit-4.11.jar" />
  73. <filename name="**/hamcrest-core-1.3.jar" />
  74. </or>
  75. </fileset>
  76. <available file=".git" type="dir" property="git.present" />
  77. <!-- https://stackoverflow.com/questions/2974106/how-to-lookup-the-latest-git-commit-hash-from-an-ant-build-script -->
  78. <target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
  79. <exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
  80. <arg value="describe" />
  81. <arg value="--tags" />
  82. <arg value="--always" />
  83. <arg value="HEAD" />
  84. </exec>
  85. <condition property="repository.version" value="${git.revision}" else="unknown">
  86. <and>
  87. <isset property="git.revision" />
  88. <length string="${git.revision}" trim="yes" length="0" when="greater" />
  89. </and>
  90. </condition>
  91. </target>
  92. <target name="compileTest">
  93. <delete dir="build/test" failonerror="true" />
  94. <mkdir dir="build/test" />
  95. <mkdir dir="build/junitReports" />
  96. <javac includeantruntime="false" srcdir="src/main:src/gui:src/example:src/test/" destdir="build/test" source="1.8" debug="true">
  97. <classpath>
  98. <fileset refid="lib.jars" />
  99. <fileset refid="gui.jars" />
  100. <fileset refid="test.jars" />
  101. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  102. </classpath>
  103. </javac>
  104. <copy todir="build/test/org/deidentifier/arx/gui/resources" overwrite="true">
  105. <fileset dir="src/gui/org/deidentifier/arx/gui/resources" defaultexcludes="yes">
  106. <exclude name="**/*.java" />
  107. </fileset>
  108. </copy>
  109. <copy todir="build/test/org/deidentifier/arx/risk/resources/us" overwrite="true">
  110. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  111. <exclude name="**/*.java" />
  112. <exclude name="**/*.txt" />
  113. </fileset>
  114. </copy>
  115. <copy todir="build/test/org/deidentifier/arx/certificate/resources" overwrite="true">
  116. <fileset dir="src/main/org/deidentifier/arx/certificate/resources" defaultexcludes="yes">
  117. <exclude name="**/*.java" />
  118. <exclude name="**/*.txt" />
  119. </fileset>
  120. </copy>
  121. </target>
  122. <target name="benchmark" depends="git.revision,compileTest">
  123. <junit showoutput="yes" fork="yes">
  124. <jvmarg value="-DBenchmark=build/junitReports" />
  125. <jvmarg value="-DVersion=${git.revision}" />
  126. <classpath>
  127. <fileset refid="lib.jars" />
  128. <fileset refid="test.jars" />
  129. <path path="build/test" />
  130. <path path="lib/ant/log4j/log4j-1.2.17.jar" />
  131. <path path="lib/ant/sqlite/sqlite-jdbc-3.7.2.jar" />
  132. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  133. </classpath>
  134. <batchtest todir="build/junitReports">
  135. <fileset dir="src/test/">
  136. <include name="**/TestAnonymizationKAnonymity.java" />
  137. <include name="**/TestAnonymizationLDiversity.java" />
  138. <include name="**/TestAnonymizationDPresence.java" />
  139. <include name="**/TestAnonymizationTCloseness.java" />
  140. <include name="**/TestAnonymizationCombinations.java" />
  141. <include name="**/TestAnonymizationDifferentialPrivacy.java" />
  142. <include name="**/TestAnonymizationKMap.java" />
  143. <include name="**/TestAnonymizationRiskBased.java" />
  144. <include name="**/TestAnonymizationLocalRecoding.java" />
  145. <include name="**/TestAnonymizationOrderedDistanceTCloseness.java" />
  146. <include name="**/TestAnonymizationEntropyLDiversity.java" />
  147. <include name="**/TestAnonymizationProfitability.java" />
  148. </fileset>
  149. <formatter type="plain" usefile="false" />
  150. <formatter type="xml" />
  151. </batchtest>
  152. </junit>
  153. <antcall target="analyse-benchmark" />
  154. </target>
  155. <target name="analyse-benchmark">
  156. <java jar="arx-analyse.jar" fork="true">
  157. </java>
  158. </target>
  159. <target name="test" depends="compileTest">
  160. <junit showoutput="yes">
  161. <classpath>
  162. <fileset refid="lib.jars" />
  163. <fileset refid="test.jars" />
  164. <path path="build/test" />
  165. <path path="lib/ant/log4j/log4j-1.2.17.jar" />
  166. <path path="lib/ant/sqlite/sqlite-jdbc-3.7.2.jar" />
  167. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  168. </classpath>
  169. <batchtest todir="build/junitReports" fork="yes">
  170. <fileset dir="src/test/" includes="**/Test*.java" />
  171. <formatter type="plain" usefile="false" />
  172. <formatter type="xml" />
  173. </batchtest>
  174. </junit>
  175. </target>
  176. <target name="release" depends="jars">
  177. </target>
  178. <target name="clean" depends="end-clean">
  179. <delete dir="jars" failonerror="true" />
  180. </target>
  181. <target name="end-clean">
  182. <delete dir="build/lib/ant" failonerror="true" />
  183. <delete dir="build/gui" failonerror="true" />
  184. <delete dir="build/extLibs" failonerror="true" />
  185. <delete dir="build" failonerror="true" />
  186. </target>
  187. <target name="prepare" depends="clean">
  188. <mkdir dir="build" />
  189. <mkdir dir="build/extLibs" />
  190. <mkdir dir="build/lib/ant" />
  191. <mkdir dir="build/gui" />
  192. <mkdir dir="jars" />
  193. </target>
  194. <target name="clean-javadoc">
  195. <delete includeEmptyDirs="true" failonerror="false">
  196. <fileset dir="doc/api" includes="**/*" defaultexcludes="yes">
  197. <exclude name="doc/api/.svn" />
  198. </fileset>
  199. </delete>
  200. <delete includeEmptyDirs="true" failonerror="false">
  201. <fileset dir="doc/gui" includes="**/*" defaultexcludes="yes">
  202. <exclude name="doc/gui/.svn" />
  203. </fileset>
  204. </delete>
  205. <delete includeEmptyDirs="true" failonerror="false">
  206. <fileset dir="doc/dev" includes="**/*" defaultexcludes="yes">
  207. <exclude name="doc/dev/.svn" />
  208. </fileset>
  209. </delete>
  210. </target>
  211. <target name="javadoc-api" depends="clean-javadoc">
  212. <mkdir dir="doc/api" />
  213. <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}">
  214. <classpath>
  215. <fileset refid="lib.jars" />
  216. <path path="src/main" />
  217. </classpath>
  218. <packageset dir="src/main/" defaultexcludes="yes">
  219. <exclude name="org/deidentifier/arx/algorithm/" />
  220. <exclude name="org/deidentifier/arx/framework/" />
  221. </packageset>
  222. </javadoc>
  223. </target>
  224. <target name="javadoc-dev" depends="clean-javadoc">
  225. <mkdir dir="doc/dev" />
  226. <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}">
  227. <classpath>
  228. <fileset refid="lib.jars" />
  229. <path path="src/main" />
  230. </classpath>
  231. <packageset dir="src/main/" defaultexcludes="yes">
  232. </packageset>
  233. </javadoc>
  234. </target>
  235. <target name="javadoc-gui" depends="clean-javadoc">
  236. <mkdir dir="doc/gui" />
  237. <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}">
  238. <classpath>
  239. <fileset refid="lib.jars" />
  240. <fileset refid="gui.jars" />
  241. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  242. <path path="src/main" />
  243. </classpath>
  244. <packageset dir="src/main/" defaultexcludes="yes">
  245. <exclude name="org/deidentifier/arx/algorithm/" />
  246. <exclude name="org/deidentifier/arx/framework/" />
  247. </packageset>
  248. <packageset dir="src/gui/" defaultexcludes="yes">
  249. </packageset>
  250. </javadoc>
  251. </target>
  252. <target name="javadoc" depends="javadoc-api,javadoc-gui,javadoc-dev">
  253. </target>
  254. <target name="compile" depends="prepare" description="compile the source ">
  255. <javac includeantruntime="false" srcdir="src/main/" destdir="build/lib/ant" source="1.8" debug="true">
  256. <classpath>
  257. <fileset refid="lib.jars" />
  258. <path path="src/main" />
  259. </classpath>
  260. </javac>
  261. <javac includeantruntime="false" srcdir="src/main:src/gui/" destdir="build/gui" source="1.8">
  262. <classpath>
  263. <fileset refid="lib.jars" />
  264. <fileset refid="gui.jars" />
  265. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  266. <path path="src/main" />
  267. </classpath>
  268. </javac>
  269. <copy todir="build/gui/org/deidentifier/arx/gui/resources" overwrite="true">
  270. <fileset dir="src/gui/org/deidentifier/arx/gui/resources" defaultexcludes="yes">
  271. <exclude name="**/*.java" />
  272. </fileset>
  273. </copy>
  274. <copy todir="build/main/org/deidentifier/arx/risk/resources/us" overwrite="true">
  275. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  276. <exclude name="**/*.java" />
  277. <exclude name="**/*.txt" />
  278. </fileset>
  279. </copy>
  280. <copy todir="build/main/org/deidentifier/arx/certificate/resources" overwrite="true">
  281. <fileset dir="src/main/org/deidentifier/arx/certificate/resources" defaultexcludes="yes">
  282. <exclude name="**/*.java" />
  283. <exclude name="**/*.txt" />
  284. </fileset>
  285. </copy>
  286. <copy todir="build/gui/org/deidentifier/arx/risk/resources/us" overwrite="true">
  287. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  288. <exclude name="**/*.java" />
  289. <exclude name="**/*.txt" />
  290. </fileset>
  291. </copy>
  292. <copy todir="build/gui/org/deidentifier/arx/certificate/resources" overwrite="true">
  293. <fileset dir="src/main/org/deidentifier/arx/certificate/resources" defaultexcludes="yes">
  294. <exclude name="**/*.java" />
  295. <exclude name="**/*.txt" />
  296. </fileset>
  297. </copy>
  298. </target>
  299. <target name="buildExternalLibs">
  300. <jar jarfile="build/extLibs/lib.jar">
  301. <zipgroupfileset refid="lib.jars" />
  302. </jar>
  303. <jar jarfile="build/extLibs/gui.jar">
  304. <zipgroupfileset refid="gui.jars" />
  305. </jar>
  306. </target>
  307. <target name="jar-win" depends="compile, buildExternalLibs">
  308. <jar destfile="jars/arx-${arx.version}-win-64.jar">
  309. <fileset dir="build/gui" defaultexcludes="no" />
  310. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  311. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  312. <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" />
  313. <manifest>
  314. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  315. </manifest>
  316. </jar>
  317. </target>
  318. <target name="jar-linux" depends="compile, buildExternalLibs">
  319. <jar destfile="jars/arx-${arx.version}-gtk-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/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" />
  324. <manifest>
  325. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  326. </manifest>
  327. </jar>
  328. </target>
  329. <target name="jar-osx" depends="compile, buildExternalLibs">
  330. <jar destfile="jars/arx-${arx.version}-osx-64.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/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" />
  335. <manifest>
  336. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  337. </manifest>
  338. </jar>
  339. </target>
  340. <target name="jar-libs" depends="compile, buildExternalLibs">
  341. <jar destfile="jars/arx-${arx.version}-src.jar">
  342. <fileset dir="src/gui" defaultexcludes="no" />
  343. <fileset dir="src/main" defaultexcludes="no" />
  344. </jar>
  345. <jar destfile="jars/libarx-${arx.version}-src.jar">
  346. <fileset dir="src/main" defaultexcludes="no" />
  347. <fileset dir="src/test" defaultexcludes="no" />
  348. <fileset dir="src/example" defaultexcludes="no" />
  349. </jar>
  350. <jar destfile="jars/libarx-${arx.version}.jar">
  351. <fileset dir="build/lib/ant" defaultexcludes="no" />
  352. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  353. </jar>
  354. <jar destfile="jars/libarx-${arx.version}-min.jar">
  355. <fileset dir="build/lib/ant" defaultexcludes="no" />
  356. <zipfileset src="lib/ant/objectselector/objectselector-0.1-lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  357. </jar>
  358. </target>
  359. <target name="jar-docs" depends="compile, javadoc">
  360. <jar destfile="jars/libarx-${arx.version}-doc.jar">
  361. <fileset dir="doc/api" defaultexcludes="no" />
  362. </jar>
  363. <jar destfile="jars/libarx-${arx.version}-dev-doc.jar">
  364. <fileset dir="doc/dev" defaultexcludes="no" />
  365. </jar>
  366. <jar destfile="jars/arx-${arx.version}-doc.jar">
  367. <fileset dir="doc/gui" defaultexcludes="no" />
  368. </jar>
  369. </target>
  370. <target name="jars" depends="jar-win, jar-linux, jar-osx, jar-libs, jar-docs">
  371. <antcall target="end-clean" />
  372. </target>
  373. </project>