forked from google/firing-range
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
171 lines (142 loc) · 5.72 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
<!-- This is a Ant file for firing-range as a Google AppEngine project -->
<project name="firing-range" default="war">
<!-- Your working directories, change the value of appengine.sdk accordingly. -->
<property name="appengine.sdk" location="../.."/>
<!-- Check that the SDK value is set and seems sane, so we can give a nicer
error if not. -->
<fail message="Please define the appengine.sdk property to point to your SDK directory">
<condition>
<not> <and>
<isset property="appengine.sdk"/>
<available file="${appengine.sdk}/config/user/ant-macros.xml"/>
</and> </not>
</condition>
</fail>
<!-- Pick up the Ant macros and taskdefs for App Engine -->
<import file="${appengine.sdk}/config/user/ant-macros.xml"/>
<!-- Remote debug port for dev_appserver -->
<property name="debug.port" value="5005"/>
<!-- HTTP port for dev_appserver -->
<property name="http.port" value="8080"/>
<!-- Address for dev_appserver -->
<property name="address" value="localhost"/>
<!-- Name of log file to write logs to -->
<property name="log.file" value="app.log"/>
<!-- Number of days worth of logs to retrieve -->
<property name="log.days" value="2"/>
<property name="war.dir" location="war"/>
<path id="alljars">
<fileset dir="${war.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${appengine.sdk}/lib/shared">
<include name="*.jar"/>
</fileset>
</path>
<path id="compiledclasses">
<pathelement location="${war.dir}/WEB-INF/classes/"/>
</path>
<target name="war" depends="enhance"
description="Assemble the application directory">
<war warfile="firingrange.war" webxml="WEB-INF/web.xml"/>
</target>
<target name="enhance" depends="compile"
description="Enhance the classes after compilation">
<enhance_war war="${war.dir}"/>
</target>
<target name="getjars">
<mkdir dir="${war.dir}/WEB-INF/lib" />
<get src="https://repo1.maven.org/maven2/com/google/guava/guava/18.0/guava-18.0.jar" dest="${war.dir}/WEB-INF/lib"/>
<get src="https://repo1.maven.org/maven2/org/jsoup/jsoup/1.8.1/jsoup-1.8.1.jar" dest="${war.dir}/WEB-INF/lib"/>
<get src="https://repo1.maven.org/maven2/org/mockito/mockito-all/1.10.19/mockito-all-1.10.19.jar" dest="${war.dir}/WEB-INF/lib"/>
<get src="https://repo1.maven.org/maven2/junit/junit/4.12/junit-4.12.jar" dest="${war.dir}/WEB-INF/lib" />
<get src="https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.0/jsr305-3.0.0.jar" dest="${war.dir}/WEB-INF/lib"/>
</target>
<target name="compile" depends="clean, getjars"
description="Compile the application servlet code">
<mkdir dir="${war.dir}/WEB-INF/classes"/>
<javac srcdir="src" destdir="${war.dir}/WEB-INF/classes">
<classpath refid="alljars"/>
</javac>
<!-- copy data folders -->
<copy todir="${war.dir}/WEB-INF/classes/com/google/testing/security/firingrange/tests/">
<fileset dir="src/tests">
<exclude name="**/*.java" />
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/classes/com/google/testing/security/firingrange/utils/">
<fileset dir="src/utils">
<exclude name="**/*.java" />
</fileset>
</copy>
<!-- copy config files -->
<copy
todir="${war.dir}/WEB-INF/"
flatten="true">
<fileset dir="./WEB-INF">
<include name="**/*.*" />
</fileset>
</copy>
<!-- copy html pages -->
<copy todir="${war.dir}/pages/">
<fileset dir="src/pages">
<include name="**/*.*" />
</fileset>
</copy>
<!-- copy index.html to /pages, workaround for now -->
<copy file="${war.dir}/WEB-INF/index.html" todir="${war.dir}/pages/"/>
</target>
<target name="test" depends="compile">
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="alljars"/>
<path refid="compiledclasses"/>
</classpath>
<batchtest fork="no">
<fileset dir="${war.dir}/WEB-INF/classes/" includes="**/*Test.class"/>
</batchtest>
</junit>
</target>
<target name="clean"
description="Force a clean slate to rebuild">
<delete dir="${war.dir}"/>
</target>
<target name="runserver" depends="war"
description="Run the dev_appserver">
<dev_appserver war="${war.dir}" address="${address}" port="${http.port}"/>
</target>
<target name="dev_appserver" depends="runserver"/>
<target name="debug" depends="war"
description="Launches dev_appserver with remote debugging enabled">
<echo message="Launching dev_appserver on Web port ${http.port}, Java remote debug port ${debug.port}"/>
<dev_appserver war="${war.dir}" address="${address}" port="${http.port}">
<options>
<arg value="--jvm_flag=-Xdebug"/>
<arg value="--jvm_flag=-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug.port}"/>
</options>
</dev_appserver>
</target>
<target name="update" depends="war"
description="Uploads the application, including indexes">
<appcfg action="update" war="${war.dir}"/>
</target>
<target name="update_indexes" depends="war"
description="Uploads only the application's indexes">
<appcfg action="update_indexes" war="${war.dir}"/>
</target>
<target name="rollback" depends="war"
description="Rolls back any in-progress application update">
<appcfg action="rollback" war="${war.dir}"/>
</target>
<target name="request_logs"
description="Downloads the application's logs">
<appcfg action="request_logs" war="${war.dir}">
<options>
<arg value="--num_days=${log.days}"/>
</options>
<args>
<arg value="${log.file}"/>
</args>
</appcfg>
</target>
</project>