forked from eucalyptus/n4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
100 lines (87 loc) · 4.61 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="N4J" basedir="." default="clean-build" xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- These properties' default values can be overridden on the ant command line, e.g: -->
<!-- ant clean-build -Deucarc=/my/path/to/eucarc -Dtests=CI-run.xml -->
<property name="src.dir" value="src/main/java"/>
<property name="build.dir" value="build"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="deps.dir" value="dependencies"/>
<property name="testng.output.dir" value="n4j_results"/>
<property name="clcip" value="192.168.0.10"/>
<property name="user" value="root"/>
<property name="password" value="foobar"/>
<property name="endpoints" value="endpoints.xml"/>
<property name="inifile" value="euca-admin.ini"/>
<property name="tests" value="DefaultSuite.xml"/>
<property name="ivy.cache.ttl.default" value="1d"/>
<property name="javac.source" value="1.8"/>
<property name="javac.target" value="${javac.source}"/>
<!-- bootstrap-ivy -->
<target name="bootstrap-ivy" description="Install ivy">
<mkdir dir="${user.home}/.ant/lib"/>
<get dest="${user.home}/.ant/lib/ivy.jar" src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
<ivy:settings file="ivysettings.xml"/>
</target>
<!-- download testng and AWS JAVA SDK -->
<target name="download-deps" depends="bootstrap-ivy">
<mkdir dir="${deps.dir}"/>
<ivy:retrieve conf="default" pattern="${deps.dir}/[artifact]-[revision].[ext]"/>
<gunzip src="zerofile.gz" dest="." />
</target>
<!-- set classpath to include dependencies and build output -->
<path id="classpath">
<fileset dir="${deps.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${classes.dir}"/>
</path>
<!-- delete build and results directories -->
<target name="clean" description="Clean build work, and artifacts">
<delete dir="${build.dir}"/>
<delete dir="${deps.dir}"/>
</target>
<!-- delete build, results and dependencies directories -->
<target name="clean-all" depends="clean" description="Clean build work, artifacts and test results">
<delete dir="${testng.output.dir}"/>
</target>
<!-- compile all classes of src.dir -->
<target name="compile" depends="download-deps" description="Compile tests">
<mkdir dir="${classes.dir}"/>
<taskdef name="groovyc"
classname="org.codehaus.groovy.ant.Groovyc"
classpathref="classpath"/>
<groovyc srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeAntRuntime="no" fork="yes">
<javac source="${javac.source}" target="${javac.target}" />
</groovyc>
<copy file="log4j.properties" todir="${classes.dir}"/>
<gunzip src="zerofile.gz" dest="${classes.dir}" />
</target>
<!-- Run the tests defined by ${tests}, WITHOUT doing any of the dependent tasks -->
<!-- Only do this if you're sure all dependencies are there and nothing needs to be recompiled! -->
<!-- TODO: Have the other tasks check to see if they need to run, or what (if anything) -->
<!-- needs to be recompiled, to speed up the process. Then we could do away with this target -->
<!-- and roll it back into runTestNG. -->
<target name="test-only" description="Run tests without building">
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath>
<fileset dir="${deps.dir}">
<include name="testng-*.jar"/>
</fileset>
</classpath>
</taskdef>
<mkdir dir="${testng.output.dir}"/>
<testng outputdir="${testng.output.dir}" classpathref="classpath" haltonfailure="true">
<xmlfileset dir="./TestSuites" includes="${tests}"/>
<jvmarg value="-Dclcip=${clcip}" />
<jvmarg value="-Duser=${user}" />
<jvmarg value="-Dpassword=${password}" />
<jvmarg value="-Dcom.amazonaws.regions.RegionUtils.fileOverride=${endpoints}"/>
</testng>
</target>
<!-- compile all and run the tests defined by ${tests} -->
<target name="runTestNG" depends="compile, test-only" description="Build and run tests"/>
<!-- clean, build and run tests -->
<target name="clean-build" depends="clean, runTestNG" description="Clean, build and run tests"/>
<!-- clean all, build and run tests -->
<target name="clean-all-build" depends="clean-all, runTestNG" description="Clean all, build and run tests"/>
</project>