-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.xml
191 lines (175 loc) · 8.58 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
<?xml version="1.0" standalone="yes"?>
<project name="clyde" default="compile" basedir="." xmlns:artifact="urn:maven-artifact-ant">
<property name="src.dir" value="core/src/main/java"/>
<property name="tsrc.dir" value="core/src/test/java"/>
<property name="deploy.dir" value="dist"/>
<property name="classes.dir" value="${deploy.dir}/classes"/>
<property name="tclasses.dir" value="${deploy.dir}/test-classes"/>
<property name="maven-ant.vers" value="2.1.3"/>
<property name="maven-ant.dir" value="${user.home}/.m2/ant-support"/>
<property name="maven-ant.jar" value="${maven-ant.dir}/maven-ant-tasks-${maven-ant.vers}.jar"/>
<property name="maven-ant.url"
value="http://mirrors.ibiblio.org/apache/maven/ant-tasks/${maven-ant.vers}/binaries"/>
<condition property="maven-ant.exists"><available file="${maven-ant.jar}"/></condition>
<target name="-download-maven-ant" unless="maven-ant.exists">
<mkdir dir="${maven-ant.dir}"/>
<get src="${maven-ant.url}/maven-ant-tasks-${maven-ant.vers}.jar"
dest="${maven-ant.jar}" usetimestamp="true"/>
</target>
<target name="-init-maven-ant" depends="-download-maven-ant">
<taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="urn:maven-artifact-ant" classpath="${maven-ant.jar}"/>
<artifact:pom id="pom" file="pom.xml"/>
<artifact:pom id="core-pom" file="core/pom.xml"/>
<artifact:dependencies pathId="compile.classpath" pomRefId="core-pom" useScope="compile"/>
<artifact:dependencies pathId="testlibs.classpath" pomRefId="core-pom" useScope="test"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<mkdir dir="${deploy.dir}"/>
<!-- Copy local libraries -->
<copy todir="${deploy.dir}/lib">
<fileset dir="lib" includes="**/*.jar"/>
</copy>
<path id="classpath">
<path refid="compile.classpath"/>
<fileset dir="${deploy.dir}/lib" includes="**/*.jar"/>
</path>
<path id="built.classpath">
<path refid="classpath"/>
<pathelement location="${classes.dir}"/>
</path>
<path id="test.classpath">
<path refid="testlibs.classpath"/>
<fileset dir="lib" includes="**/*.jar"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${tclasses.dir}"/>
</path>
</target>
<target name="-preptools" depends="-prepare">
<artifact:dependencies pathId="tools.classpath">
<dependency groupId="com.threerings" artifactId="narya-tools" version="1.11"/>
</artifact:dependencies>
<taskdef resource="com/threerings/presents/tools.properties" classpathref="tools.classpath"/>
</target>
<target name="clean" description="Cleans out build results">
<delete dir="${deploy.dir}/classes"/>
<delete dir="${deploy.dir}/docs"/>
<delete failonerror="false"><fileset dir="${deploy.dir}" includes="*.jar"/></delete>
</target>
<target name="distclean" description="Scorched earth clean">
<delete dir="${deploy.dir}"/>
</target>
<target name="compile" depends="-prepare" description="Builds the Java code.">
<mkdir dir="${classes.dir}"/>
<copy todir="${classes.dir}/rsrc">
<fileset dir="core/rsrc" includes="**/*"/>
</copy>
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.6" target="1.6">
<classpath refid="classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
<mkdir dir="${tclasses.dir}"/>
<copy todir="${tclasses.dir}"><fileset dir="core/src/test/resources" includes="**"/></copy>
<javac srcdir="${tsrc.dir}" destdir="${tclasses.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" source="1.6" target="1.6"
encoding="utf-8" classpathref="test.classpath">
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<target name="javadoc" depends="-prepare" description="Builds the Java documentation">
<mkdir dir="${deploy.dir}/docs"/>
<javadoc sourcepath="${src.dir}" packagenames="com.threerings.*"
destdir="${deploy.dir}/docs" stylesheetfile="docs/stylesheet.css"
additionalparam="-breakiterator">
<classpath refid="built.classpath"/>
<link href="http://download.oracle.com/javase/6/docs/api/"/>
<link href="http://www.lwjgl.org/javadoc"/>
<link href="http://samskivert.googlecode.com/svn/apidocs"/>
<link href="http://threerings.github.com/narya/apidocs/"/>
<link href="http://threerings.github.com/nenya/apidocs/"/>
<link href="http://threerings.github.com/vilya/apidocs/"/>
</javadoc>
</target>
<target name="-colorpos">
<artifact:dependencies pathId="colorpos.classpath">
<dependency groupId="com.threerings" artifactId="nenya-tools" version="1.4"/>
</artifact:dependencies>
<taskdef name="confcomp" classpathref="colorpos.classpath"
classname="com.threerings.tools.CompiledConfigTask"/>
<confcomp target="${deploy.dir}/rsrc/config/media/colordefs.dat"
parser="com.threerings.media.image.tools.xml.ColorPositoryParser"
configdef="core/src/test/resources/rsrc/config/media/colordefs.xml"/>
</target>
<property name="test" value=""/>
<target name="tests" depends="compile,-colorpos"
description="Runs unit tests. Use -Dtest=Foo to run only FooTest.">
<taskdef name="unit" classpathref="test.classpath"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"/>
<mkdir dir="${deploy.dir}/test-reports"/>
<unit printsummary="off" haltonfailure="yes">
<classpath refid="test.classpath"/>
<sysproperty key="test_dir" value="${tclasses.dir}"/>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<batchtest todir="${deploy.dir}/test-reports">
<fileset dir="${tsrc.dir}" includes="**/*${test}*Test.java"/>
</batchtest>
</unit>
</target>
<!-- a target for rebuilding everything -->
<target name="all" depends="clean,compile,javadoc,tests,dist"/>
<target name="dist" depends="compile" description="Builds jar files.">
<jar destfile="${deploy.dir}/${ant.project.name}.jar">
<fileset dir="${classes.dir}" includes="com/**"/>
<fileset dir="${classes.dir}" includes="rsrc/**"/>
</jar>
</target>
<target name="gendobj" depends="-preptools"
description="Generates additional methods for distributed object classes">
<!-- make sure the dobject class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/*Object.java"/>
</javac>
<!-- now generate the associated files -->
<gendobj classpathref="built.classpath">
<fileset dir="${src.dir}" includes="**/*Object.java"/>
</gendobj>
</target>
<target name="genservice" depends="-preptools"
description="Generates marshaller and dispatcher classes for all invocation services">
<!-- make sure the service class files are all compiled -->
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" optimize="${build.optimize}" deprecation="on"
source="1.6" target="1.6">
<classpath refid="classpath"/>
<include name="**/*Service.java"/>
</javac>
<!-- now generate the associated files -->
<genservice header="lib/SOURCE_HEADER" classpathref="built.classpath">
<fileset dir="${src.dir}" includes="**/*Service.java"/>
</genservice>
</target>
<property name="maven.deploy.repo" value="file://${user.home}/.m2/repository"/>
<target name="maven-deploy" depends="dist,tests,javadoc"
description="Deploys our build artifacts to a Maven repository.">
<jar basedir="${src.dir}" destfile="${deploy.dir}/${ant.project.name}-sources.jar"/>
<jar basedir="${deploy.dir}/docs" destfile="${deploy.dir}/${ant.project.name}-javadoc.jar"/>
<artifact:deploy file="pom.xml" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="pom"/>
</artifact:deploy>
<artifact:deploy file="${deploy.dir}/${ant.project.name}.jar" uniqueVersion="false">
<remoteRepository url="${maven.deploy.repo}"/>
<pom refid="core-pom"/>
<attach file="${deploy.dir}/${ant.project.name}-sources.jar" classifier="sources"/>
<attach file="${deploy.dir}/${ant.project.name}-javadoc.jar" classifier="javadoc"/>
</artifact:deploy>
</target>
</project>