-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
93 lines (71 loc) · 3.47 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
<project name="Anny" default="build.webapp" basedir=".">
<description>
This is the script to compile the anny web app into a WAR archive
</description>
<property name="build.tmpdir" value="${basedir}/anny_build/tmp" />
<property name="build.finaldir" value="${basedir}/anny_build/final" />
<property name="java.sources" value="${basedir}/server/src/one/anny/main" />
<property name="java.libraries" value="${basedir}/server/WebContent/WEB-INF/lib" />
<property name="java.output" value="${build.tmpdir}/java_bin" />
<property name="react.home" value="${basedir}/client" />
<property name="react.default.dir" value="${basedir}/client/build" />
<property name="react.output" value="${build.tmpdir}/react_bin" />
<property name="ant.build.javac.source" value="1.8" />
<property name="ant.build.javac.target" value="1.8"/>
<tstamp>
<format property="DATETIME" pattern="yyyy_MM_dd"/>
</tstamp>
<target name="build.init" description="Initialize the build environement">
<mkdir dir="${build.tmpdir}" />
<mkdir dir="${build.finaldir}" />
<mkdir dir="${java.output}" />
<mkdir dir="${react.output}" />
</target>
<target name="java.compile" description="Compile the Java sources" depends="build.init">
<echo message="Compiling the server Java sources..." />
<javac destdir="${java.output}/" srcdir="${java.sources}/">
<classpath>
<fileset dir="${java.libraries}/" includes="*.jar" />
</classpath>
</javac>
<echo message="Server compilation success !" />
</target>
<target name="react.compile" description="Compile the react application" depends="build.init">
<echo message="Compiling the client React application..." />
<exec executable="npm">
<arg value="run" />
<arg value="build" />
<arg value="--prefix" />
<arg value="${react.home}" />
</exec>
<move todir="${react.output}">
<fileset dir="${react.default.dir}" includes="**" />
</move>
<echo message="Client compilation success !" />
</target>
<target name="build.webapp" description="Create the war archive for the web project" depends="java.compile,react.compile">
<echo message="Creating the web application archive..." />
<mkdir dir="${build.finaldir}/cache/" />
<mkdir dir="${build.finaldir}/log/" />
<copy file="${basedir}/server/WebContent/config.json" todir="${build.finaldir}" />
<copy todir="${build.finaldir}/errors/">
<fileset dir="${basedir}/server/WebContent/errors/" includes="**" />
</copy>
<copy todir="${build.finaldir}/META-INF/">
<fileset dir="${basedir}/server/WebContent/META-INF/" includes="**" />
</copy>
<copy todir="${build.finaldir}/WEB-INF/">
<fileset dir="${basedir}/server/WebContent/WEB-INF/" includes="**" />
</copy>
<copy todir="${build.finaldir}/WEB-INF/classes/">
<fileset dir="${java.output}/" includes="**" />
</copy>
<copy todir="${build.finaldir}/">
<fileset dir="${react.output}/" includes="**" />
</copy>
<war destfile="${basedir}/anny_build/${DATETIME}/anny.war" basedir="${build.finaldir}/" />
<delete dir="${build.tmpdir}" />
<delete dir="${build.finaldir}" />
<echo message="WAR file created !" />
</target>
</project>