forked from rponte/jsf-loja-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
152 lines (137 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
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
<?xml version="1.0" encoding='UTF-8' ?>
<project name="Jsf-Loja-Project" basedir="." default="all">
<property file="build.properties" />
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
<!--
<fileset dir="${target.jar.dir}">
<include name="**/*.jar" />
</fileset>
-->
</path>
<path id="webinf-classpath">
<fileset dir="${webroot.dir}/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<path id="build-classpath">
<fileset dir="${lib.dir}/build">
<include name="*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${default.target.dir}" />
<mkdir dir="${test.classes.dir}" />
<mkdir dir="${classes.dir}" />
<mkdir dir="${war.dir}" />
</target>
<target name="compile" depends="clean">
<!-- Compila App classes -->
<copy todir="${classes.dir}">
<fileset dir="${source.dir}" excludes="**/*.java" />
</copy>
<javac destdir="${classes.dir}" srcdir="${source.dir}" debug="true" debuglevel="vars,lines,source"
source="1.5" target="1.5" encoding="UTF-8">
<classpath>
<path refid="webinf-classpath" />
</classpath>
</javac>
<!-- Compila Test classes -->
<copy todir="${test.classes.dir}">
<fileset dir="${test.source.dir}" excludes="**/*.java" />
</copy>
<javac destdir="${test.classes.dir}" srcdir="${test.source.dir}" debug="true" debuglevel="vars,lines,source"
source="1.5" target="1.5" encoding="UTF-8">
<classpath>
<path refid="classpath" />
<path refid="webinf-classpath" />
<path refid="build-classpath" />
<pathelement path="${classes.dir}" />
</classpath>
</javac>
</target>
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
<target name="instrument" depends="compile">
<mkdir dir="${instrumented.dir}" />
<mkdir dir="${coverage.xml.dir}" />
<cobertura-instrument datafile="${coverage.xml.dir}/cobertura.ser" todir="${instrumented.dir}">
<ignore regex="org.apache.log4j.*" />
<fileset dir="${classes.dir}">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="test" depends="instrument">
<mkdir dir="${test.report.dir}" />
<junit printsummary="on" fork="yes" forkmode="once" haltonfailure="true" haltonerror="true">
<sysproperty key="net.sourceforge.cobertura.datafile" file="${coverage.xml.dir}/cobertura.ser" />
<sysproperty key="basedir" value="." />
<formatter type="xml" />
<classpath>
<!-- Adiciona libs necessarias para o build -->
<path refid="build-classpath" />
<!-- Adiciona libs da App -->
<path refid="webinf-classpath"></path>
<!-- Cobertura -->
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
</fileset>
<!-- Classpaths -->
<pathelement path="${instrumented.dir}" />
<pathelement path="${classes.dir}" />
<pathelement path="${test.classes.dir}" />
</classpath>
<test name="${testcase}" todir="${test.report.dir}" if="testcase" />
<batchtest todir="${test.report.dir}" unless="testcase">
<!-- Unit Tests -->
<fileset dir="${test.source.dir}/unit">
<include name="${test.pattern}" />
</fileset>
<!-- Integration Tests -->
<fileset dir="${test.source.dir}/integration">
<include name="${test.pattern}" />
</fileset>
</batchtest>
</junit>
</target>
<target name="coverage-check">
<cobertura-check branchrate="34" totallinerate="100" />
</target>
<target name="coverage" depends="test">
<cobertura-report datafile="${coverage.xml.dir}/cobertura.ser"
srcdir="${source.dir}" destdir="${coverage.xml.dir}" format="xml" />
</target>
<target name="war" description="create war file" depends="coverage">
<war destfile="${war.file}" webxml="${webroot.dir}/WEB-INF/web.xml">
<classes dir="${classes.dir}" />
<lib dir="${webroot.dir}/WEB-INF/lib"></lib>
<fileset dir="${webroot.dir}/">
<include name="js/**"/>
<include name="css/**"/>
<include name="images/**"/>
<include name="META-INF/**"/>
<include name="pages/**"/>
<include name="*.jsp" />
<include name="*.jspx" />
<include name="*.html" />
<include name="*.xhtml" />
</fileset>
<zipfileset dir="${webroot.dir}/WEB-INF/config"
prefix="WEB-INF/config" excludes="**/*-test.xml" />
</war>
</target>
<!--target name="all" depends="deploy"-->
<target name="all" depends="war">
<delete dir="${test.classes.dir}" />
<delete dir="${classes.dir}" />
</target>
</project>