-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
executable file
·203 lines (188 loc) · 9.05 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="build" name="Java Information Dynamics Toolkit">
<description>
Build file for the Java Information Dynamics Toolkit
</description>
<!-- set global properties for this build -->
<property name="version" value="1.3"/>
<property name="mainfilename" value="infodynamics"/>
<property name="jarplainname" value="${mainfilename}.jar" />
<property name="jarversiondistnamezip" value="${mainfilename}-jar-${version}.zip" />
<property name="distname" value="${mainfilename}-dist-${version}" />
<property name="distnamezip" value="${distname}.zip" />
<property name="src" location="java/source"/>
<property name="bin" location="bin"/>
<property name="unittestsouttoplevel" location="unittests"/>
<property name="unittestssrc" location="java/unittests"/>
<property name="unittestsbin" location="${unittestsouttoplevel}/bin"/>
<property name="reports.tests" location="${unittestsouttoplevel}/reports"/>
<property name="javadocsdir" location="javadocs"/>
<property name="versionfile" value="version-${version}.txt"/>
<path id="project.classpath">
<pathelement location="bin"/>
</path>
<!-- Make required directories -->
<target name="init" description="Create the compiled code directories">
<mkdir dir="${bin}"/>
<mkdir dir="${unittestsbin}"/>
<mkdir dir="${reports.tests}"/>
</target>
<!-- Compile the java toolkit -->
<target name="compile" depends="init" description="compile the source and unittests">
<!-- Compile to Java 6 to provide compatibility for users with older JREs.
Caveat: The flags here only check the language compatibility, but
may still use newer libraries which may cause issues for users with JDK 6.
Indeed, one gets the warning: "bootstrap class path not set in conjunction with -source 1.6"
To fix this, one would use the bootstrap classpath to point our JDK to an rt.jar
for Java 6.
At this stage, I'm sure I'm not using new library calls from Java 7, so we can
ignore the warning, and I don't want to bother installing Java 6 just to compile
like this. I'll endeavour not to use JDK 7 libraries so as not to cause
any issues here ... -->
<javac srcdir="${src}" destdir="${bin}" includeAntRuntime="false" target="1.6" source="1.6"/>
</target>
<!-- Jar the toolkit -->
<target name="jar" depends="compile" description="Create the jar for distribution">
<!-- Put everything in ${bin} into the infodynamics-${version}.jar file -->
<jar jarfile="${jarplainname}" basedir="${bin}"/>
</target>
<!-- Compile and run the JUnit tests -->
<target name="junit" depends="compile" description="Run the junit tests and make sure they compile">
<!-- Compile the junit tests first -->
<javac destdir="${unittestsbin}" includeAntRuntime="true">
<!-- Need includeAntRuntime=true if you want to pick up junit.jar and ant-junit.jar in ANT_HOME/lib;
Otherwise you will need to set the classpath to include these here. -->
<src path="${unittestssrc}"/>
<classpath refid="project.classpath"/>
</javac>
<!-- Run the junit tests and make sure they complete ok -->
<junit printsummary="yes" showoutput="yes" haltonfailure="yes" haltonerror="yes" includeantruntime="true">
<classpath>
<path refid="project.classpath"/>
<pathelement path="${unittestsbin}"/>
</classpath>
<formatter type="plain"/>
<batchtest todir="${reports.tests}"> <!-- Writes full reports with stdout and stderr to ${reports.tests} -->
<fileset dir="${unittestsbin}">
<include name="**/*.class"/>
<exclude name="**/*AbstractTester.class"/>
<exclude name="**/ActiveInfoStorageCalculatorCorrelationIntegrals.class"/>
<exclude name="**/ActiveInfoStorageCalculatorKernelDirect.class"/>
</fileset>
</batchtest>
</junit>
</target>
<!-- Make javadocs, excluding the classes we've derived from Apache Commons Math -->
<target name="javadocs" depends="compile" description="Make the javadocs for the toolkit">
<delete dir="${javadocsdir}"/>
<javadoc destdir="${javadocsdir}">
<fileset dir="${src}">
<include name="**/*.java"/>
<exclude name="**/commonsmath3/*.java"/>
<exclude name="**/commonsmath3/**/*.java"/>
</fileset>
</javadoc>
<!-- Change some of the style in the javadocs css for our lists: -->
<concat destfile="${javadocsdir}/stylesheet.css" append="true">
.block ul li {list-style:disc; margin-left: 20px;}
.block ol li {list-style:decimal; margin-left: 40px;}
.block ol li ol li {list-style:lower-alpha; margin-left: 40px;}
.block ol li ul li {list-style:disc; margin-left: 40px;}
.block ol li ul li ol li {list-style:lower-alpha; margin-left: 40px;}
.block ol li ol li ol li {list-style:lower-roman; margin-left: 40px;}
.block ul li ol li {list-style:decimal; margin-left: 20px;}
</concat>
</target>
<!-- Clean up -->
<target name="clean">
<!-- Delete the compiled code directories -->
<delete dir="${bin}"/>
<delete dir="${unittestsbin}"/>
<delete dir="${reports.tests}"/>
<delete dir="${unittestsouttoplevel}"/>
<delete dir="${javadocsdir}"/>
<delete dir="demos/clojure/target"/>
<delete file="demos/clojure/pom.xml"/>
<delete file="demos/clojure/pom.xml.asc"/>
<delete file="demos/clojure/project.clj"/>
<delete file="${jarversiondistnamezip}"/>
<delete file="${distnamezip}"/>
<delete file="${jarplainname}"/>
<delete>
<fileset dir="demos/AutoAnalyser" includes="GeneratedCalculator.*"/>
</delete>
<delete>
<fileset dir="demos/java/infodynamics/demos/autoanalysis" includes="GeneratedCalculator.*"/>
</delete>
<!-- Don't delete the readme and version files - the user may not have the template to recreate them from -->
</target>
<!-- Build the project jar for users -->
<target name="build" depends="jar" description="user: build the project jar file">
<echo message="${ant.project.name}: ${ant.file}"/>
</target>
<!--
***********************************
Developer builds below here
***********************************
-->
<!-- Developer build - creates readme and version files -->
<target name="readmefiles" description="developer: create the readme and version files from templates">
<tstamp>
<format property="TODAY_DATE" pattern="dd/MM/yyyy" locale="en,UK"/>
<format property="TODAY_YEAR" pattern="yyyy" locale="en,UK"/>
</tstamp>
<copy file="readme-template.txt" toFile="readme.txt" failonerror="false" overwrite="true">
<!-- The template file only exists in SVN - this won't crash ant
if users try to run it though because failonerror="false" -->
<filterset>
<filter token="YEAR" value="${TODAY_YEAR}"/>
<filter token="DATE" value="${TODAY_DATE}"/>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<copy file="version-template.txt" toFile="${versionfile}" failonerror="false">
<!-- The template file only exists in SVN - this won't crash ant
if users try to run it though because failonerror="false" -->
<filterset>
<filter token="YEAR" value="${TODAY_YEAR}"/>
<filter token="DATE" value="${TODAY_DATE}"/>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
<copy file="demos/clojure/deploy/project-template.clj" toFile="demos/clojure/deploy/project.clj" failonerror="false" overwrite="true">
<!-- The template file only exists in SVN - this won't crash ant
if users try to run it though because failonerror="false" -->
<filterset>
<filter token="VERSION" value="${version}"/>
</filterset>
</copy>
</target>
<!-- Developer build - builds everything and makes the jar only distribution file -->
<target name="jardist" depends="build,readmefiles" description="developer: generate the jar distribution">
<zip destfile="${jarversiondistnamezip}">
<fileset file="${jarplainname}"/>
<fileset file="license-gplv3.txt"/>
<fileset file="readme.txt"/>
<fileset file="${versionfile}"/>
<zipfileset dir="notices" includes="**/*.*,**/*" prefix="notices"/>
</zip>
</target>
<!-- Developer build - builds everything and makes the full distribution file -->
<target name="dist" depends="jar,junit,javadocs,readmefiles" description="developer: generate the full distribution">
<echo message="${ant.project.name}: ${ant.file}"/>
<zip destfile="${distnamezip}">
<fileset file="build.xml"/>
<fileset file="${jarplainname}"/>
<fileset file="license-gplv3.txt"/>
<fileset file="readme.txt"/>
<fileset file="InfoDynamicsToolkit.pdf"/>
<fileset file="${versionfile}"/>
<zipfileset dir="java" includes="**/*.java" prefix="java"/>
<zipfileset dir="demos" includes="**/*.*,**/*" excludes="clojure/deploy,clojure/deploy/*.*,python/*.pyc" prefix="demos"/>
<zipfileset dir="javadocs" includes="**/*.*,**/*" prefix="javadocs"/>
<zipfileset dir="notices" includes="**/*.*,**/*" prefix="notices"/>
<zipfileset dir="tutorial" prefix="tutorial"/>
<zipfileset dir="web" includes="JIDT-logo.png" prefix=""/>
</zip>
</target>
</project>