forked from nirvdrum/selenium-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·179 lines (153 loc) · 7.31 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
<project name="Selenium Grid Distribution" basedir=".">
<description>Selenium Grid Distribution</description>
<property file="${basedir}/project.properties"/>
<property name="artifact" value="selenium-grid"/>
<property name="version" value="SNAPSHOT"/>
<property file="${basedir}/project.properties"/>
<import file="${basedir}/lib/build/common-build.xml" />
<target name="sanity-check" description="Check that building tools are been installed and configured properly">
<property environment="env"/>
<echo>${ant.version}</echo>
<condition property="ant-7">
<antversion atleast="1.7.0"/>
</condition>
<fail message="You need Ant 1.7 or newer" unless="ant-7"/>
<echo>Java ${ant.java.version}</echo>
<condition property="java-5">
<not><matches pattern="^1\.[0-4]" string="${ant.java.version}"/></not>
</condition>
<fail message="Your must use Java 1.5 or newer. You are currrently using '${ant.java.version}'." unless="java-5"/>
<echo/>
<echo>******************************************************</echo>
<echo>Congratulations, your setup looks good. Happy hacking!</echo>
<echo>******************************************************</echo>
<echo/>
<echo>You can build the whole project by running 'ant dist'</echo>
</target>
<target name="ci:core" depends="clean, dist" description="Continuous Integration : Build and Unit Tests"/>
<target name="ci:metrics" depends="clean, metrics" description="Continuous Integration : Build and Unit Tests"/>
<target name="ci:demo" depends="clean, dist-bin, automated-demo" description="Continuous Integration : Demo"/>
<target name="ci:functionals" depends="clean, dist-bin, automated-ruby-example" description="Continuous Integration : Functional Tests"/>
<target name="clean" description="clean all generated artifacts">
<build-subprojects target="clean"/>
<delete dir="${dist}"/>
<delete dir="target"/>
</target>
<target name="build" description="Package subprojects">
<build-subprojects target="build"/>
</target>
<target name="dist" depends="dist-bin" description="Build binary and source distributions"/>
<target name="build-bin-dist" description="Package subprojects">
<build-subprojects target="dist"/>
<mkdir dir="${dist}/${artifact}-${version}"/>
<copy todir="${dist}/${artifact}-${version}/vendor" overwrite="true">
<fileset file="${basedir}/vendor/testng-5.7-jdk15.jar"/>
<fileset file="${basedir}/vendor/selenium-java-client-driver-${selenium.version}.jar"/>
<fileset file="${basedir}/vendor/selenium-server-${selenium.version}-standalone.jar"/>
<fileset file="${basedir}/vendor/commons-logging-1.1.1.jar"/>
</copy>
<copy todir="${dist}/${artifact}-${version}/lib" overwrite="true">
<fileset dir="${basedir}/hub/target/dist/lib"/>
<fileset dir="${basedir}/remote-control/target/dist/lib"/>
<fileset dir="${basedir}/tools/target/dist/lib"/>
<fileset dir="${basedir}/lib" includes="ruby/**/*.rb"/>
<fileset dir="${basedir}/lib" includes="build/common-build.xml"/>
<fileset dir="${basedir}/demo/target/dist/lib"/>
<fileset file="${basedir}/lib/testng.policy"/>
</copy>
<copy todir="${dist}/${artifact}-${version}" overwrite="true">
<fileset dir="${basedir}">
<include name="project.properties"/>
<include name="examples/**/*"/>
<exclude name="**/tmp/*"/>
</fileset>
</copy>
<mkdir dir="${dist}/${artifact}-${version}/sample-scripts"/>
<copy todir="${dist}/${artifact}-${version}/sample-scripts" overwrite="true">
<fileset dir="${basedir}/src/scripts">
<include name="*.sh"/>
<include name="*.rb"/>
<include name="*.osascript"/>
</fileset>
</copy>
<copy todir="${dist}/${artifact}-${version}" overwrite="true">
<fileset dir="${basedir}/src/scripts" includes="build.xml"/>
<fileset dir="${basedir}/src/scripts" includes="Rakefile"/>
<fileset dir="${basedir}/src/scripts" includes="Capfile"/>
<fileset dir="${basedir}/src/configuration" includes="*.yml"/>
<fileset dir="${basedir}">
<include name="doc/**/*"/>
<exclude name="doc/**/iMac.jpeg"/>
<exclude name="doc/**/macbookpro.jpg"/>
<exclude name="doc/**/DELL Server.jpg"/>
<exclude name="doc/**/applelogo.png"/>
<include name="README"/>
</fileset>
</copy>
<mkdir dir="${dist}/${artifact}-${version}/log"/>
</target>
<target name="dist-bin" depends="build-bin-dist" description="Package binary distribution">
<zip destfile="${dist}/selenium-grid-${version}-bin.zip">
<fileset dir="${dist}" includes="${artifact}-${version}/**/*"/>
</zip>
</target>
<target name="pmd-analysis" description="Uses PMD to perform static analysis of the code">
<build-subprojects target="pmd-analysis"/>
</target>
<target name="coverage-analysis" description="Uses Cobertura to perform code coverage analysis">
<build-subprojects target="coverage-analysis"/>
</target>
<target name="metrics" depends="coverage-analysis, pmd-analysis, aggregate-reports"/>
<macrodef name="copyreports">
<attribute name="project" />
<sequential>
<mkdir dir="${metrics.reports}/@{project}"/>
<copy todir="${metrics.reports}/@{project}" overwrite="true">
<fileset dir="${basedir}/@{project}/target/metrics" includes="**/*"/>
</copy>
</sequential>
</macrodef>
<target name="aggregate-reports" description="Aggregates subproject reports">
<copyreports project="infrastructure/core"/>
<copyreports project="infrastructure/webserver"/>
<copyreports project="hub"/>
<copyreports project="remote-control"/>
<copyreports project="agent"/>
<copyreports project="tools"/>
<copy todir="${metrics.reports}" overwrite="true">
<fileset dir="src/reports" includes="**/*"/>
</copy>
</target>
<target name="acceptance-tests" description="Test a new distribution"
depends="automated-demo, automated-java-example, automated-ruby-example">
</target>
<target name="automated-demo" description="Fully Automated Demo (for continuous integration)">
<exec executable="${rake}" dir="${dist}/selenium-grid-${version}" failonerror="true">
<arg value="--trace"/>
<arg value="ci:demo"/>
</exec>
</target>
<target name="automated-java-example">
<exec executable="${rake}" dir="${dist}/selenium-grid-${version}" failonerror="true">
<arg value="all:restart"/>
</exec>
<waitfor maxwait="10" maxwaitunit="second">
<socket server="localhost" port="4444"/>
</waitfor>
<exec executable="ant" dir="${dist}/selenium-grid-${version}/examples/java-testng" failonerror="true">
<arg value="run"/>
</exec>
<exec executable="ant" dir="${dist}/selenium-grid-${version}/examples/java-testng" failonerror="true">
<arg value="run-in-sequence"/>
</exec>
<exec executable="${rake}" dir="${dist}/selenium-grid-${version}" failonerror="true">
<arg value="all:stop"/>
</exec>
</target>
<target name="automated-ruby-example" description="Fully Automated Ruby Example (for continuous integration)">
<exec executable="${rake}" dir="${dist}/selenium-grid-${version}" failonerror="true">
<arg value="--trace"/>
<arg value="ci:ruby-example"/>
</exec>
</target>
</project>