-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
124 lines (112 loc) · 4.26 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
<project name="laba3_web"
basedir="."
default="build"
xmlns:ac="antlib:net.sf.antcontrib"
xmlns:if="ant:if">
<property file="build.properties"/>
<path id="classpath-runtime">
<fileset dir="${lib}" includes="*.jar"/>
</path>
<path id="test.classpath">
<pathelement path="dist"/>
<pathelement path="${build.classes}"/>
<pathelement path="${build.tests}"/>
<fileset dir="${ant.home}/lib" includes="*.jar" />
</path>
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.tests}"/>
<mkdir dir="${dist}"/>
<mkdir dir="${dist.lib}"/>
</target>
<target name="resolve dependencies" description="resolve dependencies">
<mkdir dir="${dist.lib}"/>
<copy todir="${dist.lib}">
<fileset dir="${lib}"/>
</copy>
</target>
<target name="compile" depends="init, resolve dependencies" description="build classes">
<javac includeantruntime="false"
srcdir="${src}"
destdir="${build.classes}"
source="11"
target="11">
<classpath refid="classpath-runtime"/>
</javac>
<copy todir="${build.classes}">
<fileset dir="${src.main.resources}"/>
</copy>
</target>
<target name="build" depends="compile" description="Build .war">
<war destfile="${dist.war.name}" webxml="${src.webapp.webxml}">
<fileset dir="${src.webapp}">
<include name="**/*.*"/>
</fileset>
<lib dir="${dist.lib}"/>
<classes dir="${build.classes}"/>
<manifest>
<section name="Common">
<attribute name="Project-Name" value="${project.name}"/>
<attribute name="Project-Version" value="${project.version}"/>
</section>
</manifest>
</war>
</target>
<target name="compile-tests" depends="compile" description="--> compile tests">
<javac includeantruntime="false"
srcdir="${src.test}"
destdir="${build.tests}">
<classpath >
<path refid="classpath-runtime"/>
<path path="${src.test}"/>
<pathelement location="${build.classes}"/>
</classpath>
</javac>
</target>
<target name="test" depends="build, compile-tests" description="--> run tests">
<mkdir dir="${dist.test}"/>
<junitlauncher printsummary="true">
<classpath refid="test.classpath"/>
<testclasses outputdir="${dist.test}">
<fileset dir="${build.tests}">
<include name="**/*.class"/>
</fileset>
<listener type="legacy-xml"
sendSysOut="true"
sendSysErr="true"/>
<fork/>
</testclasses>
</junitlauncher>
</target>
<target name="diff">
<exec executable="git" dir=".">
<arg value="diff"/>
<arg value="--name-only"/>
<arg value="--cached"/>
<redirector outputproperty="git.diff"/>
</exec>
<condition property="has.changes">
<length string="${git.diff}" trim="true" when="greater" length="0"/>
</condition>
<echo message="Changes detected: ${git.diff}" if:true="${has.changes}"/>
<exec executable="git" dir="." if:true="${has.changes}">
<arg value="commit"/>
<arg value="-m"/>
<arg value="ant: commit with diff"/>
</exec>
</target>
<target name="native2ascii" description="Преобразование native2ascii для копий файлов локализации">
<native2ascii src="${src.main.resources}"
dest="${native2ascii.resources}"
includes="**/*.properties"/>
</target>
<target name="clean" description="clean up">
<delete dir="${build}"/>
<delete dir="${dist.lib}"/>
<delete dir="${dist}"/>
<delete dir="${ivy.jar.dir}"/>
<delete dir="${native2ascii.resources}"/>
</target>
</project>