-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
92 lines (83 loc) · 3.57 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
<project name="Picochat" default="dist" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property name="ivy.install.version" value="2.5.0"/>
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME"/>
</condition>
<property name="ivy.home" value="${user.home}/.ant"/>
<property name="ivy.jar.dir" value="${ivy.home}/lib"/>
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/>
<property name="address" value="localhost"/>
<property name="port" value="6969"/>
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<!-- try to load Ivy here from Ivy home, in case the user has not already dropped
it into Ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
Ivy is in at least one of Ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="libs" depends="init-ivy" description="--> retrieve dependencies with Ivy">
<ivy:retrieve/>
</target>
<target name="init" depends="libs">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/shared"/>
<mkdir dir="${build}/server"/>
<mkdir dir="${build}/client"/>
</target>
<target name="compile" depends="init">
<!-- Compile the Java code from ${src} into ${build} -->
<javac destdir="${build}/server" debug="true">
<src path="${src}/server"/>
<src path="${src}/shared"/>
</javac>
<javac destdir="${build}/client" debug="true">
<src path="${src}/client"/>
<src path="${src}/shared"/>
</javac>
</target>
<target name="dist" depends="compile">
<jar basedir="${build}/client" jarfile="${dist}/client.jar">
<manifest>
<attribute name="Main-Class" value="RootGUI"/>
</manifest>
</jar>
<jar basedir="${build}/server" jarfile="${dist}/server.jar">
<zipgroupfileset dir="lib" includes="postgresql.jar" />
<manifest>
<attribute name="Main-Class" value="Main"/>
<attribute name="DependencyFinder" value="main"/>
</manifest>
</jar>
</target>
<target name="run-server" depends="dist">
<java jar="${dist}/server.jar" fork="true">
<arg value="${port}"/>
</java>
</target>
<target name="run-client" depends="dist">
<java jar="${dist}/client.jar" fork="true">
<arg value="${address}"/>
<arg value="${port}"/>
</java>
</target>
<target name="clean"
description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>