-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
188 lines (172 loc) · 8.13 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
<?xml version="1.0"?>
<project name="migraine" default="run-java" xmlns:artifact="urn:maven-artifact-ant">
<!-- Define your project information here -->
<property name="java.classname" value="coza.mambo.migraine.java.MigraineJava"/>
<property name="html.classname" value="coza.mambo.migraine.Migraine"/>
<!-- Everything below here shouldn't need to be modified -->
<!-- run 'ant -p' to see available targets -->
<property name="src.dir" value="src/main/java"/>
<property name="war.dir" value="src/main/webapp"/>
<property name="target.dir" value="target"/>
<property name="resource.dir" value="src/main/resources"/>
<property name="classes.dir" value="${target.dir}/classes"/>
<property name="webapp.dir" value="${target.dir}/webapp"/>
<!-- Maven Ant task wiring -->
<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}"/>
</target>
<target name="-prepare" depends="-init-maven-ant">
<mkdir dir="${target.dir}"/>
<artifact:pom id="pom" file="core/pom.xml"/>
<artifact:dependencies pathId="core.classpath" pomRefId="pom" useScope="compile"/>
</target>
<!-- unfortunately the Maven Ant Tasks don't handle multi-submodule projects well -->
<!-- so we have to do a bunch of manual dependency management in here -->
<target name="-prepare-java" depends="-prepare">
<artifact:dependencies pathId="java-extras.classpath">
<dependency groupId="com.googlecode.playn" artifactId="playn-java"
version="${pom.properties.playn.version}"/>
</artifact:dependencies>
<path id="java.classpath">
<path refid="core.classpath"/>
<path refid="java-extras.classpath"/>
</path>
</target>
<target name="-prepare-html" depends="-prepare">
<artifact:dependencies pathId="html-extras.classpath">
<dependency groupId="com.googlecode.playn" artifactId="playn-html"
version="${pom.properties.playn.version}"/>
<dependency groupId="com.googlecode.playn" artifactId="playn-html"
version="${pom.properties.playn.version}" classifier="sources"/>
<dependency groupId="com.google.gwt" artifactId="gwt-dev"
version="${pom.properties.gwt.version}"/>
</artifact:dependencies>
<path id="html.classpath">
<path refid="core.classpath"/>
<path refid="html-extras.classpath"/>
</path>
</target>
<target name="-prepare-android" depends="-prepare">
<artifact:dependencies pathId="android-extras.classpath">
<dependency groupId="com.googlecode.playn" artifactId="playn-android"
version="${pom.properties.playn.version}"/>
<dependency groupId="com.google.android" artifactId="android"
version="${pom.properties.android.version}"/>
</artifact:dependencies>
<path id="android.classpath">
<path refid="core.classpath"/>
<path refid="android-extras.classpath"/>
</path>
</target>
<target name="-prep-webapp" depends="-prepare-html">
<mkdir dir="${webapp.dir}"/>
<copy todir="${webapp.dir}">
<fileset dir="html/${war.dir}" includes="**"/>
</copy>
<!-- we need to resolve this for the GWT classpath to avoid a bunch of warnings -->
<artifact:dependencies sourcesFileSetId="validation.sources.fileset">
<dependency groupId="javax.validation" artifactId="validation-api" version="1.0.0.GA"/>
</artifact:dependencies>
<pathconvert property="validation.source.jar" refid="validation.sources.fileset"/>
</target>
<target name="clean" description="Cleans out all build results.">
<delete dir="${target.dir}"/>
</target>
<target name="compile" depends="-prepare-java" description="Compiles the core code.">
<mkdir dir="${classes.dir}"/>
<javac destdir="${classes.dir}" includeAntRuntime="false"
debug="on" deprecation="on" source="1.6" target="1.6">
<src path="core/${src.dir}"/>
<src path="java/${src.dir}"/>
<classpath refid="java.classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
<!-- copy all of our resources into the classes directory -->
<copy todir="${classes.dir}">
<fileset dir="assets/${resource.dir}"/>
</copy>
</target>
<target name="-compile-html" depends="-prepare-html,compile">
<javac srcdir="html/${src.dir}" destdir="${classes.dir}" includeAntRuntime="false"
debug="on" deprecation="on" source="1.6" target="1.6">
<classpath refid="html.classpath"/>
<compilerarg value="-Xlint"/>
<compilerarg value="-Xlint:-serial"/>
</javac>
</target>
<property name="gwt.style" value="obf"/>
<target name="compile-html" depends="-prep-webapp,-compile-html"
description="Compiles game to JavaScript.">
<java fork="true" maxmemory="1024M" failonerror="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${javax.validation:validation-api:jar}"/>
<pathelement location="${validation.source.jar}"/>
<pathelement path="core/${src.dir}"/>
<pathelement path="html/${src.dir}"/>
<pathelement location="${classes.dir}"/>
<path refid="html.classpath"/>
</classpath>
<jvmarg value="-Djava.awt.headless=true"/>
<arg value="-style"/><arg value="${gwt.style}"/>
<arg value="-war"/>
<arg value="${target.dir}/webapp"/>
<arg value="${html.classname}"/>
</java>
</target>
<target name="run-html" depends="compile-html" description="Serves HTML game on localhost.">
<artifact:dependencies pathId="jetty-ant.classpath">
<remoteRepository id="jetty-repo" url="http://oss.sonatype.org/content/groups/jetty/"/>
<Dependency groupId="org.mortbay.jetty" artifactId="jetty-ant"
version="7.4.2.v20110526" scope="runtime" />
</artifact:dependencies>
<taskdef classpathref="jetty-ant.classpath" resource="tasks.properties"/>
<echo>=================================================================</echo>
<echo>Browse to http://localhost:8080/${ant.project.name}/</echo>
<echo>=================================================================</echo>
<jetty tempDirectory="${target.dir}/jetty-temp">
<webApp name="html-server" warfile="${target.dir}/webapp" contextpath="/${ant.project.name}"/>
</jetty>
</target>
<target name="run-devmode" depends="-prep-webapp,-compile-html"
description="Runs game in GWT development mode.">
<java fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="${javax.validation:validation-api:jar}"/>
<pathelement location="${validation.source.jar}"/>
<pathelement path="core/${src.dir}"/>
<pathelement path="html/${src.dir}"/>
<pathelement location="${classes.dir}"/>
<path refid="html.classpath"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<arg value="-startupUrl"/>
<arg value="index.html"/>
<arg value="-war"/>
<arg value="${target.dir}/webapp"/>
<arg value="-startupUrl"/>
<arg value="index.html"/>
<arg value="${html.classname}"/>
</java>
</target>
<target name="run-java" depends="compile" description="Runs game in JVM.">
<java fork="true" dir="java" classname="${java.classname}">
<classpath>
<pathelement location="${classes.dir}"/>
<path refid="java.classpath"/>
</classpath>
</java>
</target>
</project>