build.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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.2" />
  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-lang3-3.12.0.jar" />
  14. <filename name="**/commons-math3-3.6.1.jar" />
  15. <filename name="**/objectselector-0.1-lib.jar" />
  16. <filename name="**/commons-io-2.4.jar" />
  17. <filename name="**/commons-codec-1.5.jar" />
  18. <filename name="**/commons-logging-1.1.jar" />
  19. <filename name="**/commons-validator-1.4.1.jar" />
  20. <filename name="**/dom4j-1.6.1.jar" />
  21. <filename name="**/stax-api-1.0.1.jar" />
  22. <filename name="**/xmlbeans-2.3.0.jar" />
  23. <filename name="**/poi-3.10-FINAL-20140208.jar" />
  24. <filename name="**/poi-ooxml-3.10-FINAL-20140208.jar" />
  25. <filename name="**/poi-ooxml-schemas-3.10-FINAL-20140208.jar" />
  26. <filename name="**/hppc-0.6.0.jar" />
  27. <filename name="**/univocity-parsers-2.8.4.jar" />
  28. <filename name="**/newtonraphson-0.0.1.jar" />
  29. <filename name="**/jhpl-0.0.1.jar" />
  30. <filename name="**/mahout-core-0.9.jar" />
  31. <filename name="**/mahout-math-0.11.1.jar" />
  32. <filename name="**/hadoop-core-1.2.1.jar" />
  33. <filename name="**/guava-18.0.jar" />
  34. <filename name="**/slf4j-api-1.7.13.jar" />
  35. <filename name="**/pdfbox-app-2.0.1.jar" />
  36. <filename name="**/pdfbox-layout.jar" />
  37. <filename name="**/exp4j-0.4.8.jar" />
  38. <filename name="**/smile-1.3.1-java7.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-api-2.17.2.jar" />
  46. <filename name="**/log4j-api-2.17.2.jar" />
  47. <filename name="**/log4j-core-2.17.2.jar" />
  48. <filename name="**/swtknob-1.0.0.jar" />
  49. <filename name="**/swttable-0.0.1.jar" />
  50. <filename name="**/swtchoicesdialog-0.0.1.jar" />
  51. <filename name="**/swtrangeslider-0.0.1.jar" />
  52. <filename name="**/swttiles-0.0.1.jar" />
  53. <filename name="**/swtpreferences-0.0.1.jar" />
  54. <filename name="**/swtsimplebrowser-0.0.1.jar" />
  55. <filename name="**/jtds-1.3.1.jar" />
  56. <filename name="**/mysql-connector-java-5.1.38-bin.jar" />
  57. <filename name="**/postgresql-9.3-1101.jdbc41.jar" />
  58. <filename name="**/sqlite-jdbc-3.7.2.jar" />
  59. <filename name="**/ojdbc7.jar" />
  60. <filename name="**/org.eclipse.core.commands_3.9.700.v20191217-1850.jar" />
  61. <filename name="**/org.eclipse.core.runtime_3.18.0.v20200506-2143.jar" />
  62. <filename name="**/org.eclipse.draw2d_3.10.100.201606061308.jar" />
  63. <filename name="**/org.eclipse.equinox.common_3.12.0.v20200504-1602.jar" />
  64. <filename name="**/org.eclipse.jface_3.20.0.v20200505-1952.jar" />
  65. <filename name="**/org.eclipse.nebula.visualization.widgets_1.1.0.202006092019.jar" />
  66. <filename name="**/org.eclipse.nebula.visualization.xygraph_3.1.0.202006092019.jar" />
  67. <filename name="**/org.eclipse.nebula.widgets.nattable.core_1.6.0.201909181823.jar" />
  68. <filename name="**/org.eclipse.nebula.widgets.pagination_1.0.0.202006191828.jar" />
  69. <filename name="**/org.swtchart_0.8.0.v20120301.jar" />
  70. </or>
  71. </fileset>
  72. <fileset id="test.jars" dir="lib/ant">
  73. <or>
  74. <filename name="**/junit-4.11.jar" />
  75. <filename name="**/hamcrest-core-1.3.jar" />
  76. </or>
  77. </fileset>
  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" debug="true">
  99. <classpath>
  100. <fileset refid="lib.jars" />
  101. <fileset refid="gui.jars" />
  102. <fileset refid="test.jars" />
  103. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.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/ant/log4j/log4j-1.2-api-2.17.2.jar" />
  133. <path path="lib/ant/log4j/log4j-api-2.17.2.jar" />
  134. <path path="lib/ant/log4j/log4j-core-2.17.2.jar" />
  135. <path path="lib/ant/sqlite/sqlite-jdbc-3.7.2.jar" />
  136. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  137. </classpath>
  138. <batchtest todir="build/junitReports">
  139. <fileset dir="src/test/">
  140. <include name="**/TestAnonymizationKAnonymity.java" />
  141. <include name="**/TestAnonymizationLDiversity.java" />
  142. <include name="**/TestAnonymizationDPresence.java" />
  143. <include name="**/TestAnonymizationTCloseness.java" />
  144. <include name="**/TestAnonymizationCombinations.java" />
  145. <include name="**/TestAnonymizationDifferentialPrivacy.java" />
  146. <include name="**/TestAnonymizationKMap.java" />
  147. <include name="**/TestAnonymizationRiskBased.java" />
  148. <include name="**/TestAnonymizationLocalRecoding.java" />
  149. <include name="**/TestAnonymizationOrderedDistanceTCloseness.java" />
  150. <include name="**/TestAnonymizationEntropyLDiversity.java" />
  151. <include name="**/TestAnonymizationProfitability.java" />
  152. </fileset>
  153. <formatter type="plain" usefile="false" />
  154. <formatter type="xml" />
  155. </batchtest>
  156. </junit>
  157. <antcall target="analyse-benchmark" />
  158. </target>
  159. <target name="analyse-benchmark">
  160. <java jar="arx-analyse.jar" fork="true">
  161. </java>
  162. </target>
  163. <target name="test" depends="compileTest">
  164. <junit showoutput="yes">
  165. <classpath>
  166. <fileset refid="lib.jars" />
  167. <fileset refid="test.jars" />
  168. <path path="build/test" />
  169. <path path="lib/ant/log4j/log4j-1.2-api-2.17.2.jar" />
  170. <path path="lib/ant/log4j/log4j-api-2.17.2.jar" />
  171. <path path="lib/ant/log4j/log4j-core-2.17.2.jar" />
  172. <path path="lib/ant/sqlite/sqlite-jdbc-3.7.2.jar" />
  173. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  174. </classpath>
  175. <batchtest todir="build/junitReports" fork="yes">
  176. <fileset dir="src/test/" includes="**/Test*.java" />
  177. <formatter type="plain" usefile="false" />
  178. <formatter type="xml" />
  179. </batchtest>
  180. </junit>
  181. </target>
  182. <target name="release" depends="jars">
  183. </target>
  184. <target name="clean" depends="end-clean">
  185. <delete dir="jars" failonerror="true" />
  186. </target>
  187. <target name="end-clean">
  188. <delete dir="build/lib/ant" failonerror="true" />
  189. <delete dir="build/gui" failonerror="true" />
  190. <delete dir="build/extLibs" failonerror="true" />
  191. <delete dir="build" failonerror="true" />
  192. </target>
  193. <target name="prepare" depends="clean">
  194. <mkdir dir="build" />
  195. <mkdir dir="build/extLibs" />
  196. <mkdir dir="build/lib/ant" />
  197. <mkdir dir="build/gui" />
  198. <mkdir dir="jars" />
  199. </target>
  200. <target name="clean-javadoc">
  201. <delete includeEmptyDirs="true" failonerror="false">
  202. <fileset dir="doc/api" includes="**/*" defaultexcludes="yes">
  203. <exclude name="doc/api/.svn" />
  204. </fileset>
  205. </delete>
  206. <delete includeEmptyDirs="true" failonerror="false">
  207. <fileset dir="doc/gui" includes="**/*" defaultexcludes="yes">
  208. <exclude name="doc/gui/.svn" />
  209. </fileset>
  210. </delete>
  211. <delete includeEmptyDirs="true" failonerror="false">
  212. <fileset dir="doc/dev" includes="**/*" defaultexcludes="yes">
  213. <exclude name="doc/dev/.svn" />
  214. </fileset>
  215. </delete>
  216. </target>
  217. <target name="javadoc-api" depends="clean-javadoc">
  218. <mkdir dir="doc/api" />
  219. <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}">
  220. <classpath>
  221. <fileset refid="lib.jars" />
  222. <path path="src/main" />
  223. </classpath>
  224. <packageset dir="src/main/" defaultexcludes="yes">
  225. <exclude name="org/deidentifier/arx/algorithm/" />
  226. <exclude name="org/deidentifier/arx/framework/" />
  227. </packageset>
  228. </javadoc>
  229. </target>
  230. <target name="javadoc-dev" depends="clean-javadoc">
  231. <mkdir dir="doc/dev" />
  232. <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}">
  233. <classpath>
  234. <fileset refid="lib.jars" />
  235. <path path="src/main" />
  236. </classpath>
  237. <packageset dir="src/main/" defaultexcludes="yes">
  238. </packageset>
  239. </javadoc>
  240. </target>
  241. <target name="javadoc-gui" depends="clean-javadoc">
  242. <mkdir dir="doc/gui" />
  243. <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}">
  244. <classpath>
  245. <fileset refid="lib.jars" />
  246. <fileset refid="gui.jars" />
  247. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  248. <path path="src/main" />
  249. </classpath>
  250. <packageset dir="src/main/" defaultexcludes="yes">
  251. <exclude name="org/deidentifier/arx/algorithm/" />
  252. <exclude name="org/deidentifier/arx/framework/" />
  253. </packageset>
  254. <packageset dir="src/gui/" defaultexcludes="yes">
  255. </packageset>
  256. </javadoc>
  257. </target>
  258. <target name="javadoc" depends="javadoc-api,javadoc-gui,javadoc-dev">
  259. </target>
  260. <target name="compile" depends="prepare" description="compile the source ">
  261. <javac includeantruntime="false" srcdir="src/main/" destdir="build/lib/ant" source="1.8" debug="true">
  262. <classpath>
  263. <fileset refid="lib.jars" />
  264. <path path="src/main" />
  265. </classpath>
  266. </javac>
  267. <javac includeantruntime="false" srcdir="src/main:src/gui/" destdir="build/gui" source="1.8">
  268. <classpath>
  269. <fileset refid="lib.jars" />
  270. <fileset refid="gui.jars" />
  271. <path path="lib/ant/eclipse/org.eclipse.swt.gtk.linux.x86_64_3.114.100.v20200604-0951.jar" />
  272. <path path="src/main" />
  273. </classpath>
  274. </javac>
  275. <copy todir="build/gui/org/deidentifier/arx/gui/resources" overwrite="true">
  276. <fileset dir="src/gui/org/deidentifier/arx/gui/resources" defaultexcludes="yes">
  277. <exclude name="**/*.java" />
  278. </fileset>
  279. </copy>
  280. <copy todir="build/main/org/deidentifier/arx/risk/resources/us" overwrite="true">
  281. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  282. <exclude name="**/*.java" />
  283. <exclude name="**/*.txt" />
  284. </fileset>
  285. </copy>
  286. <copy todir="build/main/org/deidentifier/arx/certificate/resources" overwrite="true">
  287. <fileset dir="src/main/org/deidentifier/arx/certificate/resources" defaultexcludes="yes">
  288. <exclude name="**/*.java" />
  289. <exclude name="**/*.txt" />
  290. </fileset>
  291. </copy>
  292. <copy todir="build/gui/org/deidentifier/arx/risk/resources/us" overwrite="true">
  293. <fileset dir="src/main/org/deidentifier/arx/risk/resources/us" defaultexcludes="yes">
  294. <exclude name="**/*.java" />
  295. <exclude name="**/*.txt" />
  296. </fileset>
  297. </copy>
  298. <copy todir="build/gui/org/deidentifier/arx/certificate/resources" overwrite="true">
  299. <fileset dir="src/main/org/deidentifier/arx/certificate/resources" defaultexcludes="yes">
  300. <exclude name="**/*.java" />
  301. <exclude name="**/*.txt" />
  302. </fileset>
  303. </copy>
  304. </target>
  305. <target name="buildExternalLibs">
  306. <jar jarfile="build/extLibs/lib.jar">
  307. <zipgroupfileset refid="lib.jars" />
  308. </jar>
  309. <jar jarfile="build/extLibs/gui.jar">
  310. <zipgroupfileset refid="gui.jars" />
  311. </jar>
  312. </target>
  313. <target name="jar-win" depends="compile, buildExternalLibs">
  314. <jar destfile="jars/arx-${arx.version}-win-64.jar">
  315. <fileset dir="build/gui" defaultexcludes="no" />
  316. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  317. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  318. <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" />
  319. <manifest>
  320. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  321. </manifest>
  322. </jar>
  323. </target>
  324. <target name="jar-linux" depends="compile, buildExternalLibs">
  325. <jar destfile="jars/arx-${arx.version}-gtk-64.jar">
  326. <fileset dir="build/gui" defaultexcludes="no" />
  327. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  328. <zipfileset src="build/extLibs/gui.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  329. <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" />
  330. <manifest>
  331. <attribute name="Main-Class" value="org.deidentifier.arx.gui.Main" />
  332. </manifest>
  333. </jar>
  334. </target>
  335. <target name="jar-osx" depends="compile, buildExternalLibs">
  336. <jar destfile="jars/arx-${arx.version}-osx-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/eclipse/org.eclipse.swt.cocoa.macosx.x86_64_3.114.100.v20200604-0951.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-libs" depends="compile, buildExternalLibs">
  347. <jar destfile="jars/arx-${arx.version}-src.jar">
  348. <fileset dir="src/gui" defaultexcludes="no" />
  349. <fileset dir="src/main" defaultexcludes="no" />
  350. </jar>
  351. <jar destfile="jars/libarx-${arx.version}-src.jar">
  352. <fileset dir="src/main" defaultexcludes="no" />
  353. <fileset dir="src/test" defaultexcludes="no" />
  354. <fileset dir="src/example" defaultexcludes="no" />
  355. </jar>
  356. <jar destfile="jars/libarx-${arx.version}.jar">
  357. <fileset dir="build/lib/ant" defaultexcludes="no" />
  358. <zipfileset src="build/extLibs/lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  359. </jar>
  360. <jar destfile="jars/libarx-${arx.version}-min.jar">
  361. <fileset dir="build/lib/ant" defaultexcludes="no" />
  362. <zipfileset src="lib/ant/objectselector/objectselector-0.1-lib.jar" excludes="META-INF/*.RSA,META-INF/*.SF,META-INF/*.DSA" />
  363. </jar>
  364. </target>
  365. <target name="jar-docs" depends="compile, javadoc">
  366. <jar destfile="jars/libarx-${arx.version}-doc.jar">
  367. <fileset dir="doc/api" defaultexcludes="no" />
  368. </jar>
  369. <jar destfile="jars/libarx-${arx.version}-dev-doc.jar">
  370. <fileset dir="doc/dev" defaultexcludes="no" />
  371. </jar>
  372. <jar destfile="jars/arx-${arx.version}-doc.jar">
  373. <fileset dir="doc/gui" defaultexcludes="no" />
  374. </jar>
  375. </target>
  376. <target name="jars" depends="jar-win, jar-linux, jar-osx, jar-libs, jar-docs">
  377. <antcall target="end-clean" />
  378. </target>
  379. </project>