forked from kemia/kemia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
153 lines (134 loc) · 5.74 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
<?xml version="1.0" encoding="utf-8"?>
<project name="kemia" default="usage">
<property name="base.dir" location="." />
<property name="build.dir" value="${base.dir}/build" />
<property name="test.dir" location="${base.dir}/test/java" />
<property name="doc.dir" value="${base.dir}/docs" />
<property name="jsdoc.dir" value="${base.dir}/third-party/jsdoc-toolkit" />
<property name="closure-library.dir" value="${base.dir}/third-party/closure/closure" />
<property name="closure-compiler.jar" value="${base.dir}/third-party/closure-compiler/compiler.jar" />
<property name="js-src.dir" value="${base.dir}/kemia" />
<property name="selenium-server.jar" value="${base.dir}/third-party/selenium-server-1.0.3/selenium-server.jar" />
<property name="selenium-java-client.jar" value="${base.dir}/third-party/selenium-java-client-driver-1.0.1/selenium-java-client-driver.jar" />
<property name="junit.jar" value="${base.dir}/third-party/junit/junit-4.8.2.jar" />
<property name="plovr.jar" value="${base.dir}/third-party/plovr/plovr.jar" />
<property name="api.plovr.config" value="${base.dir}/kemia/api_plovr.js" />
<property name="versioned.plovr.config" value="${base.dir}/kemia//versioned-plovr-config.js" />
<path id="classpath.test">
<pathelement location="${selenium-java-client.jar}" />
<pathelement location="${junit.jar}" />
<pathelement location="${test.dir}" />
</path>
<target name="compile-test">
<delete>
<fileset dir="${test.dir}" includes="**/*.class" />
</delete>
<javac srcdir="${test.dir}">
<classpath refid="classpath.test" />
</javac>
</target>
<target name="start-selenium-server">
<java jar="${selenium-server.jar}" fork="true" spawn="true">
<arg line="-timeout 30" />
<jvmarg value="-Dhttp.proxyHost=proxy.corporate.com" />
<jvmarg value="-Dhttp.proxyPort=3128" />
</java>
</target>
<target name="stop-selenium-server">
<get taskname="selenium-shutdown" src="http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer" dest="result.txt" ignoreerrors="true" />
<echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" />
</target>
<target name="test" description="Start Selenium ; Run Junit tests ; stop Selenium">
<parallel>
<antcall target="start-selenium-server">
</antcall>
<sequential>
<echo taskname="waitfor" message="Wait for server launch" />
<waitfor maxwait="2" maxwaitunit="minute" checkevery="100">
<http url="http://localhost:4444/selenium-server/driver/?cmd=testComplete" />
</waitfor>
<antcall target="run-junit">
</antcall>
<antcall target="stop-selenium-server">
</antcall>
</sequential>
</parallel>
</target>
<target name="run-junit" depends="compile-test">
<junit>
<classpath refid="classpath.test" />
<formatter type="brief" usefile="false" />
<test name="com.kemia.TestRunner" />
</junit>
</target>
<!-- Prepare for use in NodeJs -->
<macrodef name="addnamespaces">
<attribute name="inputfile" />
<attribute name="outputfile" />
<sequential>
<exec executable="python" failonerror="true" logError="true">
<arg value="scripts/addnamespaces.py" />
<arg value='${build.dir}/@{inputfile}' />
<arg value='${build.dir}/@{outputfile}' />
</exec>
</sequential>
</macrodef>
<target name="clean" description="delete generated files">
<delete dir="${build.dir}" />
<delete dir="${doc.dir}" />
</target>
<target name="git.revision" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="describe" />
<arg value="--match=v*" />
</exec>
<echo>"version: ${git.revision}"</echo>
</target>
<target name="init" depends="clean, git.revision">
<tstamp />
<mkdir dir="${build.dir}" />
</target>
<available file=".git" type="dir" property="git.present" />
<target name="set-version" depends="init">
<copy file="${api.plovr.config}" tofile="${versioned.plovr.config}" />
<replace file="${versioned.plovr.config}" token="%REVISION%" value="${git.revision}" />
<replace file="${versioned.plovr.config}" token="%TIMESTAMP%" value="${TODAY}" />
</target>
<target name="build-docs" description="build the JsDoc documentation">
<exec executable="java" failonerror="true" logError="true" output="${base.dir}/jsdoc.log">
<arg line="-jar ${jsdoc.dir}/jsrun.jar ${jsdoc.dir}/app/run.js -r=10 ${js-src.dir} -t=${jsdoc.dir}/templates/kemia/ -d=${doc.dir}" />
</exec>
</target>
<target name="compile" description="compile with plovr" depends="set-version">
<java jar="${plovr.jar}" fork="true" failonerror="true" maxmemory="512m" output="${build.dir}/kemia.js" logError="true">
<arg value="build" />
<arg value="${versioned.plovr.config}" />
<classpath>
<pathelement location="${plovr.jar}" />
</classpath>
</java>
<delete file="${versioned.plovr.config}" />
</target>
<target name="run-compile-server" description="run plovr dynamic compilation server">
<fileset dir="${base.dir}/kemia" id="plovr-configs">
<include name="**/*plovr.js" />
</fileset>
<pathconvert property="plovr.configs" refid="plovr-configs" pathsep=" " />
<pathconvert property="echo.plovr.configs" refid="plovr-configs" pathsep="${line.separator}| |-- " />
<echo message="|-- found plovr configs:" />
<echo message="| |" />
<echo message="| |-- ${echo.plovr.configs}" />
<java jar="${plovr.jar}" fork="true" failonerror="true" maxmemory="512m" logError="true">
<arg value="serve" />
<arg line="${plovr.configs}" />
<classpath>
<pathelement location="${plovr.jar}" />
</classpath>
</java>
</target>
<target name="usage" description="Display main targets by running 'ant -projecthelp'">
<java classname="org.apache.tools.ant.Main">
<arg value="-projecthelp" />
</java>
</target>
</project>