forked from pc2ccs/pc2v9
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateVERSIONandJar.xml
217 lines (183 loc) · 8.76 KB
/
createVERSIONandJar.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?xml version="1.0"?>
<project name="Create jars and VERSION file" default="jar" basedir=".">
<!--
Purpose: Create of dist/pc2.jar and VERSION file, no testing, no code style,
just a .jar file that can be used for unit testing using
pc2.jar (instead of inside eclipse).
Dependencies:
define JAVA_HOME to point to java directory
$JAVA_HOME/bin/java.exe should exist.
To Use this:
To run/use this file, insure JAVA_HOME is defined and
then Run As... Ant Build
-->
<description>
Create pc2.jar and create VERSION file for testing.
</description>
<!-- set global properties for this build -->
<property name="apt.build.javac.target" value="1.8" />
<property name="apt.build.javac.source" value="1.8" />
<property name="src.dir" location="src" />
<property name="test.dir" location="test" />
<property name="build.dir" location="build" />
<property name="build.prod.dir" location="${build.dir}/prod" />
<property name="build.test.dir" location="${build.dir}/test" />
<property name="test.xml.dir" location="${build.dir}/test-results" />
<property name="docs.dir" location="${build.dir}/docs" />
<property name="dist.dir" location="dist" />
<!-- this should change one the location of mclb.jar changes -->
<property name="vendor.lib.dir" location="${basedir}/vendor/lib" />
<property name="scripts.dir" location="${basedir}" />
<property name="samps.dir" location="${basedir}/samps" />
<!-- Compiler settings. -->
<property name="javacFailOnError" value="true" />
<property name="javacDebugInfo" value="on" />
<property name="javacVerbose" value="false" />
<property name="logExtension" value=".log" />
<property name="compilerArg" value="" />
<property name="javacSource" value="1.8" />
<property name="javacTarget" value="1.8" />
<path id="path_bootclasspath">
<fileset dir="${java.home}/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${vendor.lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<property name="bootclasspath" refid="path_bootclasspath" />
<property name="bundleJavacSource" value="${javacSource}" />
<property name="bundleJavacTarget" value="${javacTarget}" />
<property name="bundleBootClasspath" value="${bootclasspath}" />
<property name="name" value="pc2" />
<property name="jar.name" value="${name}.jar" />
<property name="jar.path" value="${dist.dir}/${jar.name}" />
<property name="test.jar.name" value="${name}.test.jar" />
<property name="test.jar.path" value="${dist.dir}/${test.jar.name}" />
<tstamp>
<format property="date" pattern="yyyyMMdd" timezone="UTC" />
</tstamp>
<tstamp>
<format property="time" pattern="HHmm" timezone="UTC" />
</tstamp>
<property name="timestamp" value="${date}${time}" />
<tstamp>
<format property="millisecond" pattern="S" timezone="UTC" />
</tstamp>
<property name="build.number" value="${millisecond}" />
<!-- version is used in the jar manifest & in package.xml -->
<property name="old_version" value="9_0_${timestamp}" />
<property name="version" value="9.DEBUG"/>
<property name="new_version" value="9"/>
<target name="properties">
<available classname="org.eclipse.jdt.core.JDTCompilerAdapter" property="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
</target>
<target name="init" depends="properties">
<!-- Create the time stamp -->
<tstamp />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.prod.dir}" />
<mkdir dir="${build.test.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<target name="compile" depends="init" description="compile the source ">
<!-- Compile the java code from ${src.dir} into ${build.dir} -->
<javac srcdir="${src.dir}" destdir="${build.prod.dir}" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}">
<compilerarg line="${compilerArg}" compiler="${build.compiler}" />
<!-- classpath refid="project.classpath" /> -->
<!-- <compilerarg value="" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/> -->
<compilerarg line="-log '${build.dir}/${name}.prod${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter" />
</javac>
</target>
<target name="compile-test" depends="init, jar" description="compile the test class source">
<!-- Compile the java code from ${test.dir} into ${build.dir} -->
<!-- had to move test boot classes here because dist/ does not exist, so
target jar must be run to create dist
-->
<path id="path_bootclasspath_test">
<fileset dir="${java.home}/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${vendor.lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${dist.dir}" includes="**/pc2*.jar"/>
</path>
<property name="testBootclasspath" refid="path_bootclasspath_test" />
<property name="testBundleBootClasspath" value="${testBootclasspath}" />
<javac srcdir="${test.dir}" destdir="${build.test.dir}" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no"
bootclasspath="${testBundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}">
<compilerarg line="${compilerArg}" compiler="${build.compiler}" />
<compilerarg line="-log '${build.dir}/${name}.test${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter" />
</javac>
</target>
<target name="test-jar" depends="jar, compile-test" description="creates a jar of test classes ">
<jar jarfile="${test.jar.path}" basedir="${build.test.dir}">
<manifest>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Implementation-Title" value="CSUS Programming Contest Control System Testing"/>
<attribute name="Implementation-Version" value="${build.number}"/>
<attribute name="Built-On" value="${timestamp.english}"/>
<attribute name="Main-Class" value="edu.csus.ecs.pc2.Starter"/>
</manifest>
</jar>
</target>
<target name="jar" depends="compile" description="creates a jar of our classes">
<mkdir dir="${dist.dir}" />
<!-- include the images in the jar -->
<copy file="images/csus_logo.png" todir="${build.prod.dir}/images"/>
<copy file="images/ICPCWebMast_small.png" todir="${build.prod.dir}/images"/>
<copy file="images/icpc_logo.png" todir="${build.prod.dir}/images"/>
<copy file="images/PC2Logo.png" todir="${build.prod.dir}/images"/>
<copy file="images/PC2Logo.ico" todir="${build.prod.dir}/images"/>
<!-- consider doing the manifest in a separate target
then the Version can be ommitted if not set -->
<jar jarfile="${jar.path}" basedir="${build.prod.dir}">
<manifest>
<attribute name="Specification-Version" value="${version}"/>
<attribute name="Implementation-Title" value="CSUS Programming Contest Control System"/>
<attribute name="Implementation-Version" value="${build.number}"/>
<attribute name="Built-On" value="${timestamp.english}"/>
<attribute name="Main-Class" value="edu.csus.ecs.pc2.Starter"/>
</manifest>
</jar>
<copy todir="${dist.dir}">
<fileset dir="${vendor.lib.dir}"/>
</copy>
<tstamp>
<format property="longdate" pattern="EEEE, MMMM dd yyyy" timezone="UTC" />
</tstamp>
<tstamp>
<format property="miltime" pattern="HH:mm" timezone="UTC" />
</tstamp>
<echo file="VERSION" message="CSUS Programming Contest Control System " />
<echo file="VERSION" message="Version ${version} ${date} ${millisecond} (${longdate} ${miltime} UTC)" append="true" />
<echo>VERSION file is</echo>
<echo message="CSUS Programming Contest Control System " />
<echo message="Version ${version} ${date} ${build.number} (${longdate} ${miltime} UTC)" append="true" />
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build.dir} and ${dist.dir} directory trees -->
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<property name="pc2srcpath" value="${src.dir}/edu/csus/ecs/pc2"/>
<property name="extraApiSource" value="${pc2srcpath}/core/model/ClientId.java,${pc2srcpath}/core/model/ElementId.java"/>
<target name="javadocs_api" description="Creates API javadocs">
<mkdir dir="${docs.dir}/api" />
<javadoc sourcepath="${src.dir}" destdir="${docs.dir}/api"
sourcefiles="${extraApiSource}"
defaultexcludes="yes"
packagenames="edu.csus.ecs.pc2.api.*"
nodeprecated="false"
nodeprecatedlist="false"
noindex="false"
nonavbar="false"
notree="false"
doctitle="PC^2 Version 9 API Documentation"
Use="yes"
SplitIndex="yes"
overview="api_overview.html"
linkoffline="http://java.sun.com/j2se/1.5.0/docs/api/ ${api.url}" />
</target>
</project>