-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
241 lines (177 loc) · 9.38 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<?xml version="1.0" encoding="UTF-8" ?> <!-- Déclaration de la version XML -->
<project name="Bataille_navale" default="compile" basedir=".">
<!-- App properties -->
<property name="app.name" value="Bataille_navale"/>
<property name="app.version" value="1.0"/>
<!-- Paths -->
<property name="src.dir" value="src"/>
<property name="livraison.dir" value="livraison"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="lib.dir" value="lib"/>
<property name="doc.dir" value="doc"/>
<property name="test.dir" value="tests"/>
<property name="deliverable.dir" value="deliverable"/>
<!-- Java properties -->
<property name="java.compilerargs" value="-Xlint:unchecked"/>
<!-- Javadoc properties -->
<property name="javadoc.version" value="1.8"/>
<property name="javadoc.source" value="1.8"/>
<property name="javadoc.target" value="1.8"/>
<property name="javadoc.encoding" value="UTF-8"/>
<property name="javadoc.author" value="true"/>
<property name="javadoc.version" value="true"/>
<property name="javadoc.use" value="true"/>
<property name="javadoc.windowtitle" value="${app.name} ${app.version} API"/>
<property name="javadoc.doctitle" value="${app.name} ${app.version} API"/>
<property name="javadoc.header" value="<h1>${app.name} ${app.version} API</h1>"/>
<property name="javadoc.footer" value="<h2>${app.name} ${app.version} API</h2>"/>
<property name="javadoc.bottom" value="<h3>${app.name} ${app.version} API</h3>"/>
<!-- JAR properties -->
<property name="jar.manifest" value="manifest.mf"/>
<property name="jar.file" value="${app.name}-${app.version}.jar"/>
<property name="jar.dir" value="jar"/>
<!-- Path -->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- Init target -->
<target name="init" description="Create principal directories">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${doc.dir}"/>
<mkdir dir="${jar.dir}"/>
<mkdir dir="${deliverable.dir}"/>
<echo message="Initialisation"/>
<echo>
Initialisation des traitements du projet ${ant.project.name}
</echo>
</target>
<!-- Clean target -->
<target name="clean" description="Clean unnecessary files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${doc.dir}"/>
<delete dir="${jar.dir}"/>
</target>
<!-- Compile target -->
<target name="compile" depends="clean, init" description="Compile all sources">
<javac srcdir="${src.dir}" destdir="${build.dir}"
debuglevel="lines,vars,source" includeantruntime="false"
encoding="UTF-8">
<classpath refid="classpath"/>
<compilerarg line="${java.compilerargs}"/>
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}">
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<!-- Javadoc target -->
<!-- Javadoc target -->
<target name="javadoc" depends="compile" description="Generate javadoc">
<javadoc sourcepath="${src.dir}" destdir="${doc.dir}" author="${javadoc.author}"
version="${javadoc.version}" use="${javadoc.use}" windowtitle="${javadoc.windowtitle}"
doctitle="${javadoc.doctitle}" header="${javadoc.header}" footer="${javadoc.footer}"
bottom="${javadoc.bottom}" source="${javadoc.source}"
encoding="${javadoc.encoding}">
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- Jar target -->
<target name="jar" depends="compile" description="Generate jar file">
<jar destfile="${jar.dir}/${jar.file}" basedir="${build.dir}">
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Main-Class" value="main.bataillenavale.core.Demo"/>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
<jar destfile="${jar.dir}/Graphique${jar.file}" basedir="${build.dir}">
<manifest>
<attribute name="Manifest-Version" value="1.0"/>
<attribute name="Main-Class" value="main.bataillenavale.vue.Demo"/>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
</target>
<!-- Dist target -->
<target name="dist" depends="jar, javadoc" description="Generate distribution">
<copy todir="${dist.dir}">
<fileset dir="${jar.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
</target>
<!-- Run target à partir du jar -->
<target name="run" depends="jar" description="Run application">
<java classname="main.bataillenavale.core.Demo" fork="true">
<classpath refid="classpath"/>
<classpath path="${jar.dir}/${jar.file}"/>
</java>
</target>
<!-- RunGraphique target à partir du jar -->
<target name="runGraphique" depends="jar" description="Run application">
<java classname="main.bataillenavale.vue.Demo" fork="true">
<classpath refid="classpath"/>
<classpath path="${jar.dir}/Graphique${jar.file}"/>
</java>
</target>
<!-- Help target -->
<target name="help" description="Display help">
<echo>Available targets:</echo>
<echo> init: Permet de créer les dossiers de base</echo>
<echo> clean : Permet de supprimer les fichiers inutiles</echo>
<echo> compile: Permet de compiler le main</echo>
<echo> javadoc: Permet de générer la javadoc qui permet de comprendre le code</echo>
<echo> jar: Permet de générer le jar</echo>
<echo> dist: Permet de générer la distribution du projet</echo>
<echo> run: Permet de lancer le main</echo>
<echo> runGraphique: Permet de lancer le main graphique</echo>
<echo> help: Permet d'afficher l'aide</echo>
<echo> install junit4: Permet d'installer les librairies de test</echo>
<echo> install junit5 : meme chose que junit4 mais pour junit5</echo>
<echo> install: Permet d'installer les librairies de test</echo>
</target>
<!-- Install target -->
<!-- Install test libraries -->
<target name="install junit4" description="Install junit4 and hamcrest-core">
<get src="http://search.maven.org/remotecontent?filepath=junit/junit/4.13.1/junit-4.13.1.jar" dest="${basedir}/lib/junit-4.13.1.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar" dest="${basedir}/lib/hamcrest-core-1.3.jar"/>
</target>
<target name="install junit5" description="Install junit5">
<get src="http://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar" dest="/lib/junit-jupiter-5.8.1.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar" dest="/lib/junit-jupiter-api-5.8.1.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar" dest="/lib/junit-jupiter-engine-5.8.1.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar" dest="/lib/junit-jupiter-params-5.8.1.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar" dest="/lib/junit-platform-engine-1.8.1.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar" dest="/lib/junit-platform-commons-1.8.1.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar" dest="/lib/opentest4j-1.2.0.jar"/>
<get src="http://search.maven.org/remotecontent?filepath=org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar" dest="/lib/apiguardian-api-1.1.2.jar"/>
</target>
<target name="install" depends="install junit4" description="Install test libraries"/>
<!-- Test target -->
<!-- Compile test classes -->
<target name="test compile" depends="compile,install" description="Compile test classes">
<mkdir dir="${build.dir}/test"/>
<javac srcdir="${test.dir}" destdir="${build.dir}" debug="on" includeantruntime="false">
<classpath refid="classpath"/>
<classpath path="${build.dir}"/>
</javac>
</target>
<target name="test" depends="test compile" description="Run tests">
<junit fork="true" printsummary="yes" haltonfailure="yes" showoutput="yes">
<classpath refid="classpath"/>
<classpath location="${build.dir}"/>
<formatter type="plain" usefile="false"/>
<batchtest todir="${build.dir}/test-reports">
<fileset dir="${test.dir}">
<include name="**/*.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>