-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
168 lines (131 loc) · 6.43 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
<project default="compile" basedir="." name="outercore">
<!-- Java 11 -->
<property name="sourceVersion" value="1.8"/>
<property name="targetVersion" value="1.8"/>
<!--*******************************************************************-->
<!-- Ant build fails if the repo dir isn't named beast-outercore -->
<property name="outercoreName" value="beast-outercore"/>
<!-- source code dir separated from test -->
<property name="outcorSrc" location="../${outercoreName}/src" />
<!-- source code dir of test -->
<property name="outcorLib" location="../${outercoreName}/lib" />
<property name="outcorTest" location="../${outercoreName}/test" />
<!-- Names of temporary build/test directories, which are deleted before build -->
<property name="outcorBuild" location="../${outercoreName}/build" />
<property name="outcorDist" location="../${outercoreName}/dist" />
<property name="outcor-build-test" location="../${outercoreName}/build-test"/>
<property name="outcor-test-reports" location="../${outercoreName}/test-reports"/>
<property name="outercoreBrief" value="outercore"/>
<!--*******************************************************************-->
<path id="outercore-clspath">
<!-- <pathelement path="${classpath}"/>-->
<pathelement path="${outcorBuild}"/>
<fileset dir="${outcorLib}" includes="*.jar"/>
</path>
<!-- Revert to pristine state. -->
<target name="clean">
<delete dir="${outcorBuild}"/>
<delete dir="${outcorDist}"/>
<delete dir="${outcor-build-test}"/>
<delete dir="${outcor-test-reports}"/>
</target>
<!-- Prepare for compilation -->
<target name="init" depends="clean">
<echo message="Local Java version: ${java.version}, but compile for Java ${targetVersion}."/>
<echo message="${ant.project.name}: ${ant.file}"/>
<echo message="Working dir is ${outercoreName}." />
<mkdir dir="${outcorBuild}"/>
<mkdir dir="${outcorDist}"/>
</target>
<!-- Compile -->
<target name="compile" depends="init">
<javac target="${targetVersion}" source="${sourceVersion}" srcdir="${outcorSrc}"
destdir="${outcorBuild}" classpathref="outercore-clspath" includeantruntime="false">
</javac>
<echo message="Successfully compiled ${outercoreBrief}."/>
</target>
<!-- Prepare for unit test compilation -->
<target name="init-test">
<echo message="Java version: ${java.version}"/>
<echo message="${ant.project.name}: ${ant.file}"/>
<echo message="Working dir is ${outercoreName}." />
<mkdir dir="${outcor-build-test}"/>
<mkdir dir="${outcor-test-reports}"/>
</target>
<!-- Compile unit tests -->
<target name="compile-test" depends="init-test">
<javac target="${targetVersion}" source="${sourceVersion}" srcdir="${outcorTest}" destdir="${outcor-build-test}"
classpathref="outercore-clspath" includeantruntime="false">
</javac>
<echo message="Successfully compiled ${outercoreBrief} tests."/>
</target>
<!-- Run unit tests -->
<target name="test" depends="compile, compile-test">
<junit printsummary="yes" failureproperty="testFailed">
<classpath>
<path refid="outercore-clspath"/>
<pathelement path="${outcor-build-test}"/>
</classpath>
<batchtest fork="yes" todir="${outcor-test-reports}">
<fileset dir="${outcorTest}">
<include name="**/*Test.java"/>
</fileset>
<formatter type="plain"/>
</batchtest>
</junit>
<fail if="testFailed" status="1" message="Unit test of ${outercoreBrief} failed."/>
</target>
<target name="github-actions" depends="compile, compile-test, test">
<fail if="testFailed" message="One or more ${outercoreBrief} tests failed."/>
</target>
<!-- Release -->
<property name="pkgDir" location="${outcorDist}/package"/>
<!-- Create BEAST 2 package, no dist task here -->
<target name="release" depends="compile">
<xmlproperty file="version.xml" collapseAttributes="true"/>
<echo>name=${addon.name}, version=${addon.version}</echo>
<echo>depends=${addon.depends.on}, atleast=${addon.depends.atleast}</echo>
<property name="projVersion" value="${addon.version}"/>
<property name="fullName" value="${outercoreBrief}.v${projVersion}"/>
<echo>fullName=${fullName}</echo>
<mkdir dir="${pkgDir}"/>
<!-- <mkdir dir="${pack}/examples"/>-->
<!-- <mkdir dir="${pack}/templates"/>-->
<!--mkdir dir="${pack}/lib"/-->
<!-- <mkdir dir="${pack}/doc"/>-->
<jar jarfile="${pkgDir}/${fullName}.src.jar" basedir="${outcorSrc}" />
<!--mkdir dir="${lib}" />
<copy todir="${pack}/lib">
<fileset dir="${lib}" includes="*.jar" />
</copy-->
<!-- use as BEAST 2 plugin -->
<jar jarfile="${pkgDir}/lib/${fullName}.jar" basedir="${outcorBuild}" includes="**/*.class" />
<!-- <jar jarfile="${pack}/${projName}.v${projVersion}.jar" basedir="${build}">-->
<!-- <manifest>-->
<!-- <attribute name="Main-Class" value="beast.app.beastapp.BeastMain"/>-->
<!-- </manifest>-->
<!-- <zipgroupfileset dir="${lib}" includes="*.jar"/>-->
<!-- </jar>-->
<copy file="README.md" tofile="${pkgDir}/README" />
<copy file="LICENSE" tofile="${pkgDir}/LICENSE" />
<!-- <mkdir dir="${examples}" />-->
<!-- <copy todir="${pack}/examples">-->
<!-- <fileset dir="${examples}" includes="**/*.xml" />-->
<!-- <fileset dir="${examples}" includes="**/*.nex" />-->
<!-- </copy>-->
<!-- <mkdir dir="${templates}" />-->
<!-- <copy todir="${pack}/templates">-->
<!-- <fileset dir="${templates}" includes="*.xml" />-->
<!-- </copy>-->
<!-- <mkdir dir="${doc}" />-->
<!-- <copy todir="${pack}/doc">-->
<!-- <fileset dir="${doc}" includes="*.tex,*.doc,*.lyx,*.txt"/>-->
<!-- </copy>-->
<copy file="version.xml" todir="${pkgDir}" />
<zip destfile="${outcorDist}/${fullName}.zip" basedir="${pkgDir}" />
<delete dir="${pkgDir}"/>
<echo/>
<echo/>
<echo>** Package ${dist}/${fullName}.zip created successfully! **</echo>
</target>
</project>