This repository has been archived by the owner on Jul 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
222 lines (192 loc) · 6.6 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
<project>
<property name="sdk.dir" location="./appengine-java-sdk-1.7.2" />
<property name="buildLibDir" value="lib" />
<property name="runtimeLibDir" value="war/WEB-INF/lib" />
<!-- DB VARS -->
<property name="dbport" value="3306" />
<property name="dbuser" value="root" />
<property name="dbpassword" value="root" />
<property name="gae-email" value="[email protected]" />
<property name="gae-password" value="BlogTest1" />
<import file="${sdk.dir}/config/user/ant-macros.xml" />
<path id="project.classpath">
<pathelement path="war/WEB-INF/classes" />
<fileset dir="war/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
<fileset dir="war/WEB-INF/lib">
<include name="mysql-connector-java-5.1.22-bin.jar" />
</fileset>
<fileset dir="${sdk.dir}/lib">
<include name="shared/**/*.jar" />
</fileset>
</path>
<target name="copyjars"
description="Copies the App Engine JARs to the WAR.">
<!--
<copy
todir="war/WEB-INF/lib"
flatten="true">
<fileset dir="${sdk.dir}/lib/user">
<include name="**/*.jar" />
</fileset>
</copy>
-->
<copy
todir="${sdk.dir}/lib/impl"
flatten="true">
<fileset dir="war/WEB-INF/lib">
<include name="mysql-connector-java-5.1.22-bin.jar" />
</fileset>
</copy>
</target>
<target name="compile" depends="copyjars"
description="Compiles Java source and copies other source files to the WAR.">
<mkdir dir="war/WEB-INF/classes" />
<copy todir="war/WEB-INF/classes">
<fileset dir="src">
<exclude name="**/*.java" />
</fileset>
</copy>
<javac
srcdir="src"
destdir="war/WEB-INF/classes"
classpathref="project.classpath"
debug="on" />
</target>
<target name="datanucleusenhance" depends="compile"
description="Performs JDO enhancement on compiled data classes.">
<enhance_war war="war" />
</target>
<target name="runserver" depends="compile"
description="Starts the development server.">
<dev_appserver war="war" port="8888">
<options>
<arg value="--jvm_flag=-Drdbms.server=local"/>
<arg value="--jvm_flag=-Drdbms.driver=com.mysql.jdbc.Driver"/>
<arg value="--jvm_flag=-Drdbms.url=jdbc:mysql://localhost:${dbport}/blogaggregator?user=${dbuser}&password=${dbpassword}"/>
</options>
</dev_appserver>
</target>
<target name="update" depends="datanucleusenhance"
description="Uploads the application to App Engine.">
<appcfg action="update" war="war" />
</target>
<target name="update_indexes" depends="datanucleusenhance"
description="Uploads just the datastore index configuration to App Engine.">
<appcfg action="update_indexes" war="war" />
</target>
<target name="rollback" depends="datanucleusenhance"
description="Rolls back an interrupted application update.">
<appcfg action="rollback" war="war" />
</target>
<target name="request_logs"
description="Downloads log data from App Engine for the application.">
<appcfg action="request_logs" war="war">
<options>
<arg value="--num_days=5"/>
</options>
<args>
<arg value="logs.txt"/>
</args>
</appcfg>
</target>
<!-- DB -->
<target name="create-schema" description="Creates the database schema objects (tables etc).">
<sql
classpathref="project.classpath"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:${dbport}"
userid="${dbuser}"
password="${dbpassword}"
src="db/schema.sql">
</sql>
</target>
<target name="create-test-data" description="Inserts test data to database.">
<sql
classpathref="project.classpath"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:${dbport}"
userid="${dbuser}"
password="${dbpassword}"
src="db/test-data.sql">
</sql>
</target>
<target name="create-schema-and-test-data" depends="create-schema, create-test-data"
description="Creates the database schema objects and inserts test data." />
<target name="drop-schema" description="Deletes database schema objects.">
<sql
classpathref="project.classpath"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:${dbport}"
userid="${dbuser}"
password="${dbpassword}"
src="db/drop-schema.sql">
</sql>
</target>
<target name="runtests" description="Deletes database schema objects.">
<parallel threadCount="2">
<exec executable="python">
<arg value="test/AddBlogList.py"/>
</exec>
<exec executable="python">
<arg value="test/AddBlogToList.py"/>
</exec>
<exec executable="python">
<arg value="test/RemoveBlogFromList.py"/>
</exec>
<exec executable="python">
<arg value="test/UserLogInAndOut.py"/>
</exec>
</parallel>
</target>
<target name="deploy-app" description="Uploads and deploys the application to App Engine.">
<!--
<input message="Enter email" addproperty="gae-email"/>
<input message="Enter password :- " addproperty="gae-password">
<handler type="secure"/>
</input>
-->
<!-- Call dependencies here rather than with 'depends' attribute to get input first -->
<!-- <antcall target="runtests" /> -->
<java classname="com.google.appengine.tools.admin.AppCfg" inputstring="${gae-password}"
classpath="${sdk.dir}/lib/appengine-tools-api.jar" fork="true" failonerror="true">
<arg value="--email=${gae-email}" />
<arg value="--passin" />
<arg value="update" />
<arg value="war" />
</java>
</target>
<target name="js.minify" >
<antcall target="js.unminify"></antcall>
<copy todir="./war/js/original" flatten="true">
<fileset dir="./war/js">
<include name="*.js" />
</fileset>
</copy>
<apply executable="java" parallel="false">
<fileset dir="./war/js" includes="*.js"/>
<arg line="-jar"/>
<arg path="yuicompressor-2.4.jar"/>
<srcfile/>
<arg line="-o"/>
<mapper type="glob" from="*.js" to="*.js"/>
<targetfile/>
</apply>
<copy todir="./war/js/" flatten="true">
<fileset dir=".">
<include name="*.js" />
</fileset>
</copy>
<delete file="blogs.js"/>
<delete file="main.js"/>
<delete file="top.js"/>
</target>
<target name="js.unminify">
<copy todir="./war/js/" flatten="true" overwrite="true">
<fileset dir="./war/js/original">
<include name="*.js" />
</fileset>
</copy>
</target>
</project>