Skip to content
Newer
Older
100644 188 lines (164 sloc) 6.45 KB
0cebaf6 @josedonizetti ant build.xml
josedonizetti authored May 20, 2009
1 <!-- ************************************* -->
2 <!-- Ant build script for JForum 3 -->
3 <!-- ************************************* -->
4 <project name="JForum3" default="test" basedir=".">
5 <description>JForum 3</description>
6
7 <property name="build.compiler" value="javac1.5" />
8
9 <property name="project.name" value="JForum3" />
10 <property name="author" value="JForum Team - http://www.jforum.net/team.jsp" />
11 <property name="copyright" value="(c) JForum Team" />
12 <property name="version" value="3.0" />
13 <property name="filename" value="jforum-${version}" />
14 <property name="warfile" value="${filename}.war" />
15 <property name="custom.libs" location="compile-lib" />
16 <property name="srcfile" value="${filename}-src.zip"/>
17 <property name="cobertura.libs.dir" value="${custom.libs}/cobertura"/>
18 <property name="instrumentation.dir" value="target/tests"/>
19 <property name="build.dir" location="webapp" />
8df8697 Changed lib dir
Jakob Vad Nielsen authored Oct 21, 2009
20 <property name="project.libs" location="lib" />
0cebaf6 @josedonizetti ant build.xml
josedonizetti authored May 20, 2009
21 <property name="src.dir" value="src/main/java" />
22 <property name="resources.dir" value="src/main/resources"/>
23 <property name="tests.dir" value="src/test/java" />
24 <property name="tests.resources.dir" value="src/test/resources"/>
25 <property name="classes.dir" value="${build.dir}/WEB-INF/classes" />
26 <property name="tests.classes.dir" value="tmp/tests" />
27 <property name="web.dir" value="webapp" />
28 <property name="build.style" value="${cobertura.libs.dir}/style"/>
29 <property name="hsqldb.test.dir" value="${java.io.tmpdir}/jforum-test-database"/>
30 <property name="artifacts.dir" value="tmp/artifacts"/>
31
32 <!-- Cobertura -->
33 <path id="cobertura.classpath">
34 <fileset dir="${cobertura.libs.dir}">
35 <include name="*.jar"/>
36 </fileset>
37 </path>
38
39 <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>
40
41 <!-- Classpath declaration -->
42 <path id="project.classpath">
43 <fileset dir="${project.libs}">
44 <include name="**/*.jar"/>
45 </fileset>
46 </path>
47
48 <path id="base.path">
49 <fileset dir="${project.libs}">
50 <include name="**/*.jar" />
51 </fileset>
52 <fileset dir="${custom.libs}">
53 <include name="**/*.jar" />
54 </fileset>
55 </path>
56
57 <!-- Init -->
58 <target name="init">
59 <tstamp>
60 <format property="TODAY" pattern="yyyy-MM-dd HH:mm:ss" />
61 </tstamp>
62
63 <mkdir dir="${classes.dir}" />
64 <mkdir dir="${instrumentation.dir}" />
65 <mkdir dir="${tests.classes.dir}"/>
66 <mkdir dir="${artifacts.dir}"/>
67 <mkdir dir="${artifacts.dir}/junit-output"/>
68 </target>
69
70 <!-- Clean -->
71 <target name="clean" description="clean-up">
72 <delete dir="${classes.dir}" />
73 <delete dir="${instrumentation.dir}"/>
74 <delete dir="tmp"/>
75 </target>
76
77 <!-- Compile -->
78 <target name="compile" depends="init" description="Compiles the source code">
79 <!-- Main code -->
80 <javac fork="true" debug="true" optimize="false" deprecation="false" source="1.5" target="1.5" srcdir="${src.dir}" destdir="${classes.dir}">
81 <classpath>
82 <path refid="base.path" />
83 </classpath>
84 </javac>
85
86 <copy todir="${classes.dir}">
87 <fileset dir="${resources.dir}"/>
88 </copy>
89
90 <!-- Tests -->
91 <javac fork="true" debug="true" optimize="false" deprecation="false" source="1.5" target="1.5" srcdir="${tests.dir}" destdir="${tests.classes.dir}">
92 <classpath>
93 <path refid="base.path" />
94 <pathelement path="${classes.dir}"/>
95 </classpath>
96 </javac>
97
98 <copy todir="${tests.classes.dir}">
99 <fileset dir="${tests.resources.dir}"/>
100 </copy>
101 </target>
102
103 <!-- Test -->
104 <target name="test" depends="compile">
105 <fileset dir="${tests.classes.dir}" id="unittests.fileset">
106 <include name="**/*TestCase.class" />
107 <exclude name="**/AbstractDAOTestCase.class" />
108 <exclude name="**/AdminTestCase.class" />
109 <exclude name="**/MailTestCase.class" />
110 </fileset>
111
112 <delete file="cobertura.ser" verbose="false" />
113
114 <cobertura-instrument todir="${instrumentation.dir}">
115 <fileset dir="${classes.dir}" >
116 <include name="**/*.class" />
117 <exclude name="**/support/spring/*" />
118 <exclude name="**/support/vraptor/*" />
119 <exclude name="**/util/JForumConfig.class" />
120 <exclude name="**/util/ConfigKeys.class" />
121 <exclude name="**/util/mail/EmailSenderTask.class" />
122 <exclude name="**/util/mail/IdentifiableMimeMessage.class" />
123 <exclude name="**/util/mail/SpammerTaskExecutor.class" />
124 <exclude name="**/support/hibernate/OpenSessionInViewFilter.class" />
125 <exclude name="**/JForumServlet.class" />
126 </fileset>
127 </cobertura-instrument>
128
129 <echo message="Running unit tests..." />
130 <junit fork="yes" forkmode="once" haltonfailure="no" printsummary="false" showoutput="true" failureproperty="failed-test">
131 <sysproperty key="net.sourceforge.cobertura.datafile" file="cobertura.ser" />
132
133 <classpath>
134 <pathelement path="${instrumentation.dir}" />
135 <pathelement path="${tests.classes.dir}" />
136 <pathelement path="${classes.dir}" />
137 </classpath>
138 <classpath refid="base.path" />
139
140 <formatter type="xml" />
141 <batchtest fork="yes" todir="${artifacts.dir}/junit-output">
142 <fileset refid="unittests.fileset" />
143 </batchtest>
144 </junit>
145
146 <antcall target="cobertura-report" />
147 <antcall target="test-report" />
148 </target>
149
150 <target name="test-report">
151 <junitreport todir="${artifacts.dir}/">
152 <fileset dir="${artifacts.dir}/junit-output">
153 <include name="TEST-*.xml" />
154 </fileset>
155 <report styledir="${build.style}" format="frames" todir="${artifacts.dir}/junit" />
156 </junitreport>
6f821fa @rcarneiro getting started to migration from VRaptor 2.x to VRaptor 3.4.0
rcarneiro authored Nov 19, 2011
157 <fail if="failed-test" message="Unit test with problems!" />
0cebaf6 @josedonizetti ant build.xml
josedonizetti authored May 20, 2009
158 </target>
159
160 <target name="cobertura-report">
161 <cobertura-report format="html" destdir="${artifacts.dir}/cobertura">
162 <fileset dir="${src.dir}">
163 <include name="**/*.java" />
164 <exclude name="**/*TestCase.java" />
165 <exclude name="**/util/JForumConfig.java" />
166 <exclude name="**/util/ConfigKeys.java" />
167 <exclude name="**/util/mail/EmailSenderTask.java" />
168 <exclude name="**/util/mail/IdentifiableMimeMessage.java" />
169 <exclude name="**/util/mail/SpammerTaskExecutor.java" />
170 <exclude name="**/JForumServlet.java" />
171 </fileset>
172 </cobertura-report>
173 </target>
174
175 <!-- Start the HSQL DB server -->
176 <target name="startHsqldb" description="Run HSQL database server with clean DB">
177 <!-- Delete database files -->
178 <delete dir="${database.dir}"/>
179 <java classname="org.hsqldb.Server"
180 fork="yes"
181 classpathref="project.classpath"
182 failonerror="true">
183 <arg value="-database.0"/>
184 <arg value="file:${hsqldb.test.dir}/db"/>
185 </java>
186 </target>
187 </project>
Something went wrong with that request. Please try again.