-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
284 lines (252 loc) · 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
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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<?xml version="1.0" encoding="UTF-8"?>
<project name="StarMalaccamax" default="help" basedir=".">
<!-- [email protected], first cut, Nov-02-2012 -->
<!-- [email protected], migrated -->
<!-- Arguments to compile and run targets -->
<property name="gwt.args" value="" />
<!-- make sure to set GWT_DIR env var -->
<property environment="env"/>
<property name="gwt.sdk" value="${env.GWT_DIR}" />
<property name="appengine.sdk" value="${env.APPENGINE_DIR}" />
<property name="webapps.dir" value="${env.WEBAPPS_DIR}" />
<property name="oauthparams.java" value="${basedir}/src/com/qagwaai/starmalaccamax/server/OAuth/OurOAuthParams.java"/>
<property name="callbackurl.java" value="${basedir}/src/com/qagwaai/starmalaccamax/client/OAuth/OurCallbackUrl.java"/>
<property name="script-dir" value="${basedir}/scripts"/>
<property name="gaetest.yaml" value="${basedir}/private/gae_test.yaml"/>
<property name="gaeprod.yaml" value="${basedir}/private/gae_production.yaml"/>
<property name="devlocal.yaml" value="${basedir}/private/local.yaml"/>
<property name="beforepush.yaml" value="${basedir}/private/template.yaml"/>
<path id="project.class.path">
<pathelement location="war/WEB-INF/classes"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<pathelement location="${appengine.sdk}/lib/testing/appengine-testing.jar"/>
<pathelement location="${appengine.sdk}/lib/impl/appengine-api.jar"/>
<pathelement location="${appengine.sdk}/lib/impl/appengine-api-labs.jar"/>
<pathelement location="${appengine.sdk}/lib/impl/appengine-api-stubs.jar"/>
<pathelement location="${appengine.sdk}/lib/impl/appengine-local-runtime.jar"/>
<pathelement location="${appengine.sdk}/lib/impl/google_sql.jar"/>
<pathelement location="war/WEB-INF/lib/quartz-2.1.6.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="war/WEB-INF/lib" includes="**/*.jar"/>
</path>
<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="war/WEB-INF/lib" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
<copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet-deps.jar" />
<!-- Add any additional server libs that need to be copied -->
<!-- <copy todir="war/WEB-INF/lib" file="${appengine.sdk}/lib/testing/appengine-testing.jar"/>
<copy todir="war/WEB-INF/lib" file="${appengine.sdk}/lib/impl/appengine-api.jar"/>
<copy todir="war/WEB-INF/lib" file="${appengine.sdk}/lib/impl/appengine-api-labs.jar"/>
<copy todir="war/WEB-INF/lib" file="${appengine.sdk}/lib/impl/appengine-api-stubs.jar"/>
<copy todir="war/WEB-INF/lib" file="${appengine.sdk}/lib/impl/appengine-local-runtime.jar"/>
<copy todir="war/WEB-INF/lib" file="${appengine.sdk}/lib/impl/google_sql.jar"/> -->
</target>
<target name="compile" depends="checkgwtdir,checkappenginedir,clean,javac" description="GWT compile to JavaScript (production mode)">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx1024M"/>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<!--<arg line="-compileReport"/>-->
<arg line="-logLevel" />
<arg value="TRACE" />
<arg line="-localWorkers"/>
<arg value="1"/>
<arg line="-style"/>
<arg value="PRETTY"/>
<arg line="-saveSource"/>
<arg line="-saveSourceOutput"/>
<arg value="war"/>
<arg line="${gwt.args}"/>
<arg value="com.qagwaai.starmalaccamax.StarMalaccamax"/>
</java>
</target>
<target name="compile-and-run-local" depends="compile,run" description="compile and run in dev mode"/>
<target name="javac" depends="libs" description="Compile java source to bytecode">
<mkdir dir="war/WEB-INF/classes"/>
<mkdir dir="war/WEB-INF/deploy" />
<javac includeantruntime="false" srcdir="src" includes="**" encoding="utf-8"
destdir="war/WEB-INF/classes"
source="1.5" target="1.5" nowarn="true"
debug="true" debuglevel="lines,vars,source">
<classpath refid="project.class.path"/>
</javac>
<copy todir="war/WEB-INF/classes">
<fileset dir="src" excludes="**/*.java"/>
</copy>
</target>
<target name="run" depends="killdev,javac" description="Run development mode">
<!--<copy file="${basedir}/log4j/log4j.properties" tofile="${basedir}/war/WEB-INF/classes/log4j.properties" overwrite="true" />-->
<java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="src"/>
<path refid="project.class.path"/>
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar" />
<pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar" />
</classpath>
<jvmarg value="-Xmx1024M"/>
<jvmarg value="-Dlog4j.ignoreTCL=true"/>
<arg value="-startupUrl"/>
<arg value="StarMalaccamax.html"/>
<arg line="-war"/>
<arg value="war"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg line="${gwt.args}"/>
<arg value="com.qagwaai.starmalaccamax.StarMalaccamax"/>
</java>
</target>
<target name="clean" description="Cleans this project">
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/WEB-INF/deploy" failonerror="false" />
<delete dir="war/com.qagwaai.starmalaccamax.StarMalaccamax" failonerror="false" />
<delete dir="reports" failonerror="false" />
<delete file="war/StarMalaccamax.war" failonerror="false" />
</target>
<target name="build" depends="compile" description="Build StarMalaccamax project"/>
<target name="war" depends="build,copy" description="Create StarMalaccamax.war">
<zip destfile="war/StarMalaccamax.war" basedir="war"/>
</target>
<target name="copy">
<echo message="Copying log4j.properties to classes directory"/>
<copy file="${basedir}/log4j/log4j.properties"
tofile="${basedir}/war/WEB-INF/classes/log4j.properties"
overwrite="true"/>
</target>
<target name="help" description="Show help">
<echo>
Before running any of the ant tasks. Please set the GWT_DIR environemnt
variable to the location where GWT SK is installed.
Example:
In Linux:
$ GWT_DIR=/usr/local/gwt-2.6.1; export GWT_DIR
MacOS X:
$ launchctl setenv GWT_DIR /usr/local/gwt-2.6.1
o Type: "ant -p" to see all the Ant tasks
</echo>
</target>
<target name="checkgwtdirexists">
<condition property="dir">
<available file="#{env.GWT_DIR}" type="dir"/>
</condition>
</target>
<target name="checkgwtdir" description="Check GWT_DIR env var is set or not">
<fail unless="env.GWT_DIR"
message="GWT_DIR environemnt variable is not set"/>
<echo message="GWT_DIR=${env.GWT_DIR}"/>
</target>
<target name="checkappenginedirexists">
<condition property="dir">
<available file="#{env.APPENGINE_DIR}" type="dir"/>
</condition>
</target>
<target name="checkappenginedir" description="Check APPENGINE_DIR env var is set or not">
<fail unless="env.APPENGINE_DIR"
message="APPENGINE_DIR environemnt variable is not set"/>
<echo message="APPENGINE_DIR=${env.APPENGINE_DIR}"/>
</target>
<target name="checkwebappsdir" description="Check WEBAPPS_DIR env var is set or not">
<fail unless="env.WEBAPPS_DIR" message="WEBAPPS_DIR environemnt variable is not set"/>
<echo message="WEBAPPS_DIR=${env.WEBAPPS_DIR}"/>
</target>
<target name="killdev" description="Kill GWT Devmode process">
<!-- replace with powershell script <exec dir="${basedir}" executable="ruby">
<arg value="killgwtdevmode.rb"/>
</exec> -->
</target>
<target name="deploy" depends="checkwebappsdir,war" description="Deploy GWTOAuthLoginDemo.war to a Servlet container">
<fail unless="env.WEBAPPS_DIR"
message="WEBAPPS_DIR environemnt variable is not set"/>
<echo message="webapps directory: ${env.WEBAPPS_DIR}"/>
<copy file="${basedir}/war/GWTOAuthLoginDemo.war"
tofile="${env.WEBAPPS_DIR}/GWTOAuthLoginDemo.war"/>
</target>
<target name="gencallback-url-local" description="Generate CallbackUrl.java file for local dev">
<echo message="Running ${script-dir}/gen_callback_url.rb"/>
<echo message="Updating: ${callbackurl.java}"/>
<exec dir="${script-dir}" executable="ruby" output="${callbackurl.java}">
<arg value="gen_callback_url.rb"/>
<arg value="${devlocal.yaml}"/>
</exec>
</target>
<target name="gencallback-url-gae-test" description="Generate CallbackUrl.java file for GAE Test">
<echo message="Running ${script-dir}/gen_callback_url.rb"/>
<echo message="Updating: ${callbackurl.java}"/>
<exec dir="${script-dir}" executable="ruby" output="${callbackurl.java}">
<arg value="gen_callback_url.rb"/>
<arg value="${gaetest.yaml}"/>
</exec>
</target>
<target name="gencallback-url-gae-prod" description="Generate CallbackUrl.java file for GAE Production">
<echo message="Running ${script-dir}/gen_callback_url.rb"/>
<echo message="Updating: ${callbackurl.java}"/>
<exec dir="${script-dir}" executable="ruby" output="${callbackurl.java}">
<arg value="gen_callback_url.rb"/>
<arg value="${gaeprod.yaml}"/>
</exec>
</target>
<target name="gencallback-url-before-push" description="Generate CallbackUrl.java file with dummy URL">
<echo message="Running ${script-dir}/gen_callback_url.rb"/>
<echo message="Updating: ${callbackurl.java}"/>
<exec dir="${script-dir}" executable="ruby" output="${callbackurl.java}">
<arg value="gen_callback_url.rb"/>
<arg value="${beforepush.yaml}"/>
</exec>
</target>
<target name="prepare-gae-test" depends="gencallback-url-gae-test" description="Update callback URL and OAuth parameters for GAE Test">
<echo message="Running ${script-dir}/yaml2java.rb"/>
<echo message="Input file: ${gaetest.yaml}"/>
<echo message="Onput file: ${oauthparams.java}"/>
<echo message="Did you update OAuthLoginServiceImpl.java?"/>
<echo message="NOTE: Do not forget to refresh in eclipse!"/>
<echo message=">>>>>>>> Did you update OAuthLoginServiceImpl.java?"/>
<exec dir="${script-dir}" executable="ruby" output="${oauthparams.java}">
<arg value="yaml2java.rb"/>
<arg value="${gaetest.yaml}"/>
</exec>
</target>
<target name="prepare-gae-production" depends="gencallback-url-gae-prod" description="Update callback URL and OAuth parameters for GAE Production">
<echo message="Running ${script-dir}/yaml2java.rb"/>
<echo message="Input file: ${gaeprod.yaml}"/>
<echo message="Onput file: ${oauthparams.java}"/>
<echo message="NOTE: Do not forget to refresh in eclipse!"/>
<echo message=">>>>>>>> Did you update OAuthLoginServiceImpl.java?"/>
<exec dir="${script-dir}" executable="ruby" output="${oauthparams.java}">
<arg value="yaml2java.rb"/>
<arg value="${gaeprod.yaml}"/>
</exec>
</target>
<target name="prepare-dev-local" depends="gencallback-url-local" description="Update callback URL and OAuth parameters for testing at local">
<echo message="Running ${script-dir}/yaml2java.rb"/>
<echo message="Input file: ${devlocal.yaml}"/>
<echo message="Onput file: ${oauthparams.java}"/>
<echo message="NOTE: Do not forget to refresh in eclipse!"/>
<echo message=">>>>>>>> Did you update OAuthLoginServiceImpl.java?"/>
<exec dir="${script-dir}" executable="ruby" output="${oauthparams.java}">
<arg value="yaml2java.rb"/>
<arg value="${devlocal.yaml}"/>
</exec>
</target>
<!--
I run this task before pushing to github, it generates OAuthParams.java with
dummy data instead of data with my registered key and secret
-->
<target name="prepare-before-push" depends="gencallback-url-before-push" description="Update callback URL and OAuth parameters with blank data">
<echo message="Running ${script-dir}/yaml2java.rb"/>
<echo message="Input file: ${beforepush.yaml}"/>
<echo message="Onput file: ${oauthparams.java}"/>
<echo message="NOTE: Do not forget to refresh in eclipse!"/>
<echo message=">>>>>>>> Did you update OAuthLoginServiceImpl.java?"/>
<exec dir="${script-dir}" executable="ruby" output="${oauthparams.java}">
<arg value="yaml2java.rb"/>
<arg value="${beforepush.yaml}"/>
</exec>
</target>
</project>