-
Notifications
You must be signed in to change notification settings - Fork 204
/
build.xml
139 lines (120 loc) · 5.18 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
<project name="pm-75-leiloes" default="relatorio-jacoco" xmlns:jacoco="antlib:org.jacoco.ant">
<property name="build.dir" value="target"/>
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
<classpath path="lib/test/jacocoant.jar"/>
</taskdef>
<path id="tests.classpath" path=".">
<fileset dir="lib/test">
<include name="*.jar" />
</fileset>
<pathelement path="${build.dir}/classes/" />
</path>
<path id="libs.classpath" path=".">
<fileset dir="WebContent/WEB-INF/lib">
<include name="*.jar" />
</fileset>
</path>
<target name="compilar">
<mkdir dir="${build.dir}/classes/"/>
<mkdir dir="${build.dir}/classes-teste/"/>
<javac destdir="${build.dir}/classes/" srcdir="src/main/" classpathref="libs.classpath" debug="true" encoding="UTF-8" />
<javac destdir="${build.dir}/classes-teste/" srcdir="src/test/" classpathref="tests.classpath" debug="true" encoding="UTF-8" />
</target>
<target name="executar-os-testes" depends="compilar">
<mkdir dir="${build.dir}/reports" />
<jacoco:coverage excludes="**/BoasVindasTest.java">
<junit haltonfailure="true" showoutput="true" haltonerror="true" printsummary="true" fork="true" forkmode="once">
<formatter type="plain" />
<classpath location="${build.dir}/classes-teste/" />
<classpath refid="tests.classpath" />
<batchtest fork="yes" todir="${build.dir}/reports">
<fileset dir="src/test" >
<include name="**/*Test.java" />
<exclude name="**/BoasVindasTest.java" />
<exclude name="**/IntegrationTest.java" />
</fileset>
</batchtest>
<formatter type="brief" usefile="false" />
</junit>
</jacoco:coverage>
</target>
<target name="executar-os-testes-de-integracao" depends="levanta-servidor-tomcat">
<property environment="env"/>
<property name="browser" value="${env.browser}"/>
<junit haltonfailure="true" showoutput="true" haltonerror="true" printsummary="true" fork="true" forkmode="once">
<sysproperty key="browser_driver" value="${browser}"/>
<formatter type="plain" />
<classpath location="${build.dir}/classes-teste/" />
<classpath refid="tests.classpath" />
<batchtest>
<fileset dir="src/test">
<include name="**/BoasVindasTest.java" />
</fileset>
</batchtest>
<formatter type="brief" usefile="false" />
</junit>
<antcall target="derruba-servidor-tomcat"/>
</target>
<target name="relatorio-jacoco" depends="executar-os-testes">
<mkdir dir="${build.dir}/jacoco"/>
<mkdir dir="${build.dir}/jacoco/report"/>
<echo>${basedir}/jacoco.exec</echo>
<jacoco:report>
<executiondata>
<file file="${basedir}/jacoco.exec"/>
</executiondata>
<structure name="pm-75-leiloes">
<classfiles>
<fileset dir="${build.dir}"/>
</classfiles>
<sourcefiles encoding="UTF-8">
<fileset dir="src/main" />
</sourcefiles>
</structure>
<html destdir="${build.dir}/jacoco/report" />
</jacoco:report>
</target>
<property name="apache.tomcat7" value="apache-tomcat-7.0.42"/>
<target name="gera-war" depends="executar-os-testes">
<war destfile="${apache.tomcat7}/webapps/pm-75-leiloes.war">
<classes dir="${build.dir}/classes"/>
<zipfileset dir="WebContent" />
</war>
</target>
<target name="prepara-servidor-tomcat-7">
<delete dir="${apache.tomcat7}"/>
<delete dir="${apache.tomcat7}.zip"/>
<get dest="." src="http://ftp.unicamp.br/pub/apache/tomcat/tomcat-7/v7.0.42/bin/${apache.tomcat7}.zip"/>
<unzip dest="." src="${apache.tomcat7}.zip"/>
<delete dir="${apache.tomcat7}/conf/server.xml"/>
<copy file="server.xml" todir="${apache.tomcat7}/conf/"/>
</target>
<target name="levanta-servidor-tomcat" depends="derruba-servidor-tomcat,prepara-servidor-tomcat-7, gera-war">
<java classname="org.apache.catalina.startup.Bootstrap" fork="true" spawn="true">
<classpath path="${apache.tomcat7}/bin/bootstrap.jar:${apache.tomcat7}/bin/tomcat-juli.jar"/>
<jvmarg value="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"/>
<jvmarg value="-Djava.util.logging.config.file=${apache.tomcat7}/conf/logging.properties"/>
<jvmarg value="-Dcatalina.home=${apache.tomcat7}"/>
<jvmarg value="-Dcatalina.base=${apache.tomcat7}"/>
<jvmarg value="-Djava.io.tmpdir=${apache.tomcat7}/temp"/>
<arg line="start"/>
</java>
<waitfor maxwait="2" maxwaitunit="minute" checkevery="3" checkeveryunit="second" timeoutproperty="waittimedout">
<http url="http://localhost:7070/pm-75-leiloes/" />
</waitfor>
<fail if="waittimedout" message="Server is not running or returned an error."/>
</target>
<target name="derruba-servidor-tomcat">
<java classname="org.apache.catalina.startup.Bootstrap" fork="true">
<classpath path="${apache.tomcat7}/bin/bootstrap.jar:${apache.tomcat7}/bin/tomcat-juli.jar"/>
<jvmarg value="-Dcatalina.home=${apache.tomcat7}"/>
<arg line="stop"/>
</java>
</target>
<target name="gerar-jar" depends="executar-os-testes">
<jar destfile="pm-75-leiloes.jar" basedir="${build.dir}/classes/" />
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
</project>