-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
143 lines (122 loc) · 5.86 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
<project name="fantasm" default="test" basedir=".">
<property environment="env"/>
<property name="test.verbosity" value="1"/>
<property name="test.loglevel" value="40"/>
<property name="tests" value=""/>
<property name="srcdir" value="${basedir}/src"/>
<property name="testdir" value="${basedir}/test"/>
<property name="toolsdir" value="${basedir}/tools"/>
<property name="releasedir" value="${basedir}/release"/>
<property name="appenginedir" value="/usr/local/google_appengine"/>
<property name="tests.pythonpath" value="${testdir}:${srcdir}:${basedir}:${appenginedir}:${appenginedir}/lib/simplejson:${appenginedir}/lib/yaml/lib:${appenginedir}/lib/webob-1.1.1:${appenginedir}/lib/django:${appenginedir}/lib/fancy_urllib:${toolsdir}"/>
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="${basedir}/tools/ant/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<target name="clean">
<delete>
<fileset dir="${srcdir}" includes="**/*.pyc"/>
<fileset dir="${srcdir}" includes="**/*.pyo"/>
<fileset dir="${testdir}" includes="**/*.pyc"/>
<fileset dir="${testdir}" includes="**/*.pyo"/>
</delete>
<delete dir="${releasedir}"/>
</target>
<target name="test-python">
<property name="python.executable" value="python"/>
</target>
<target name="test-python27">
<property name="python.executable" value="python2.7"/>
</target>
<target name="_test">
<echo>${python.executable}</echo>
<exec dir="${basedir}" executable="${python.executable}" failonerror="true">
<env key="PYTHONPATH" value="${tests.pythonpath}"/>
<env key='APPENGINEDIR' value='${appenginedir}'/>
<env key="UNITTEST_VERBOSITY" value="${test.verbosity}"/>
<env key="UNITTEST_LOGLEVEL" value="${test.loglevel}"/>
<arg line="${toolsdir}/test_runner.py ${tests}"/>
</exec>
</target>
<target name="test" depends="test-python, _test"/>
<target name="test27" depends="test-python27, _test"/>
<target name="pylint-module-src">
<property name="pylint.module" value="fantasm"/>
<property name="pylint.cwd" value="${srcdir}"/>
</target>
<target name="pylint-module-test">
<property name="pylint.module" value="fantasm_tests complex_machine email_batch main simple_machine url_fanout"/>
<property name="pylint.cwd" value="${testdir}"/>
</target>
<target name="_pylint">
<exec dir="${pylint.cwd}" executable="pylint" failonerror="false" outputproperty="pylint.output">
<env key="PATH" value="/usr/local/bin" />
<env key="PYTHONPATH" value="${tests.pythonpath}" />
<arg line="--rcfile=${toolsdir}/pylintrc --include-ids=y ${pylint.module}"/>
</exec>
<!-- echo for debugging -->
<echo>${pylint.output}</echo>
<!-- make sure the output is as expected -->
<fail message="Pylint produced output. It must have failed.">
<condition>
<not>
<equals arg1="${pylint.output}" arg2=""/>
</not>
</condition>
</fail>
</target>
<target name="pylint" depends="pylint-module-src, _pylint"/>
<target name="pylint-test" depends="pylint-module-test, _pylint"/>
<target name="copy-test-files" depends="clean">
<!-- copy src files to builddir -->
<delete dir="${releasedir}"/>
<mkdir dir="${releasedir}"/>
<copy todir="${releasedir}">
<fileset dir="${testdir}">
<exclude name="*.pyc"/>
</fileset>
</copy>
<delete file="${releasedir}/fantasm" failonerror="false"/> <!-- remove bum symlink -->
<copy todir="${releasedir}/fantasm" overwrite="true">
<fileset dir="${srcdir}/fantasm">
<exclude name="*.pyc"/>
</fileset>
</copy>
</target>
<target name="rewrite-app-yaml" depends="copy-test-files">
<!-- rewrite app.yaml -->
<replaceregexp file="${releasedir}/app.yaml"
match="application:.+"
replace="application: ${app.yaml.application}"/>
<replaceregexp file="${releasedir}/app.yaml"
match="version:.+"
replace="version: ${app.yaml.version}"/>
</target>
<target name="_setup-integration-test-properties">
<property name="integration-test-url" value="integration-test"/>
</target>
<target name="_setup-ndb-integration-test-properties">
<property name="integration-test-url" value="ndb-integration-test"/>
</target>
<target name="_integration-test" depends="copy-test-files, rewrite-app-yaml">
<!--
This target is used to run a consistent integration test by the owners of Fantasm.
-->
<exec executable="${appenginedir}/appcfg.py" resultproperty="appcfg.retcode" inputstring="${env.gae.pwd}">
<arg line="update ${releasedir} --no_cookies --email=${env.gae.email} --passin"/>
</exec>
<fail message="App Engine deployment failed; non-zero return code.">
<condition>
<not>
<equals arg1="${appcfg.retcode}" arg2="0"/>
</not>
</condition>
</fail>
<!-- kick off the integration run -->
<tempfile property="temp.file" suffix=".html"/>
<get src="http://${app.yaml.version}.${app.yaml.application}.appspot.com/${integration-test-url}/?token=${integration_test_token}" dest="${temp.file}"/>
</target>
<target name="integration-test" depends="_setup-integration-test-properties, _integration-test"/>
<target name="ndb-integration-test" depends="_setup-ndb-integration-test-properties, _integration-test"/>
</project>