-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
140 lines (117 loc) · 4.6 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="vizualizacija" basedir="." default="package">
<property name="app.name" value="vizualizacija"/>
<property name="config.dir" value="configuration"/>
<property name="build.dir" value="build"/>
<property name="lib.dir" value="lib"/>
<property name="jlib.dir" value="jlib"/>
<property name="src.tests" value="tests"/>
<property file="configuration/tomcat.properties"/>
<path id="src.class.path">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${jlib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${build.dir}/web"/>
</path>
<path id="test.class.path">
<path refid="src.class.path"/>
<pathelement path="${build.dir}/tests"/>
<pathelement path="${build.dir}/web"/>
</path>
<target name="init">
<available file="${lib.dir}/junit.jar" property="junit.jar.present"/>
<fail unless="junit.jar.present">
"${lib.dir}/junit.jar" file is not present.
</fail>
<available file="${lib.dir}/servlet-api.jar" property="servlet-api.jar.present"/>
<fail unless="servlet-api.jar.present">
"${lib.dir}/servlet-api.jar" file is not present. You can copy it from $CATALINA_HOME/common/lib/servlet-api.jar.
</fail>
<tstamp/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.dir}/web"/>
<mkdir dir="${build.dir}/tests"/>
<mkdir dir="${jlib.dir}"/>
</target>
<target name="clean">
<delete includeEmptyDirs="true">
<fileset dir="${build.dir}"/>
<fileset dir="${jlib.dir}"/>
</delete>
</target>
<target name="compile-web" depends="init">
<javac destdir="${build.dir}/web" includes="**/*.java" includeAntRuntime="false" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
<src path="src"/>
<classpath refid="src.class.path"/>
</javac>
</target>
<target name="package-web" depends="compile-web, run-tests">
<jar destfile="${jlib.dir}/${app.name}.jar">
<fileset dir="${build.dir}/web" includes="**/*.class"/>
</jar>
</target>
<target name="compile-tests" depends="compile-web">
<javac destdir="${build.dir}/tests" includes="**/*.java" includeAntRuntime="false" debug="true" debuglevel="lines,vars,source" encoding="UTF-8">
<src path="tests"/>
<classpath refid="src.class.path"/>
</javac>
</target>
<target name="compile" depends="compile-web, compile-tests"/>
<target name="package" depends="package-web"/>
<!--
Da bi ovi testovi radili, potrebno je iskopirati junit-4.1.jar u direktorij
[Eclipse]\plugins\org.apache.ant_1.6.5\lib i promijeniti mu ime u junit.jar.
Zatim je potreno ga dodati preko Eclipsea na način
Window->Preferences->Ant->Runtime->Ant Home entries pa onda kliknuti na
Add External JAR i dodati junit.jar
-->
<target name="run-tests" depends="compile-web, compile-tests" if="junit.jar.present">
<junit fork="yes" printsummary="withOutAndErr" forkmode="once">
<classpath refid="test.class.path"/>
<formatter type="plain" usefile="false" />
<test name="hr.fer.zemris.java.tim5.projekt.test.TokenizerTest"/>
<test name="hr.fer.zemris.java.tim5.projekt.test.InfixParserTest"/>
<test name="hr.fer.zemris.java.tim5.projekt.test.PrefixParserTest"/>
</junit>
</target>
<target name="war" depends="package">
<mkdir dir="${build.dir}/configuration"/>
<war destfile="${build.dir}/${app.name}.war" webxml="${config.dir}/web.xml">
<lib dir="${lib.dir}" includes="**" excludes="servlet-api.jar, junit-4.1.jar"/>
<lib dir="${jlib.dir}" includes="**"/>
<classes dir="${build.dir}/configuration" includes="**"/>
<webinf dir="web/private" includes="**"/>
<fileset dir="web/public" includes="**"/>
</war>
</target>
<target name="shutdownTomcat">
<fail unless="tomcat.dir">
Tomcat directory is not set!
</fail>
<echo>Pokrecem postupak zaustavljanja Tomcata...</echo>
<exec dir="${tomcat.dir}/bin" executable="cmd.exe">
<arg line="/c shutdown.bat"/>
</exec>
</target>
<target name="startupTomcat">
<fail unless="tomcat.dir">
Tomcat directory is not set!
</fail>
<echo>Pokrecem postupak startanja Tomcata...</echo>
<exec dir="${tomcat.dir}/bin" executable="cmd.exe" spawn="true">
<arg line="/c startup.bat"/>
</exec>
</target>
<target name="copyToTomcat" depends="war">
<fail unless="tomcat.dir">
Tomcat directory is not set!
</fail>
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${tomcat.dir}/webapps/${app.name}"/>
</delete>
<copy file="${build.dir}/${app.name}.war" todir="${tomcat.dir}/webapps"/>
</target>
</project>