-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
143 lines (119 loc) · 4.28 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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="deploy" name="sprout">
<!-- you can change these to match your project -->
<property name="db" value="mysql"/><!-- also oracle or postgresql -->
<property name="name" value="sprout"/>
<property name="port" value="9000"/>
<property name="pass" value="secret"/>
<condition property="unix">
<os family="unix"/>
</condition>
<path id="lib">
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<property name="lib" refid="lib"/>
<target name="check-page">
<available property="page-exists" file="../page/build.xml"/>
</target>
<target name="page" depends="check-page" if="page-exists">
<ant antfile="../page/build.xml" target="build" inheritall="false"/>
<copy file="../page/bin/page.jar" todir="lib"/>
</target>
<target name="check-util">
<available property="util-exists" file="../util/build.xml"/>
</target>
<target name="util" depends="check-util" if="util-exists">
<ant antfile="../util/build.xml" target="build" inheritall="false"/>
<copy file="../util/bin/util.jar" todir="lib"/>
</target>
<target name="check-memory">
<available property="memory-exists" file="../memory/build.xml"/>
</target>
<target name="memory" depends="check-memory" if="memory-exists">
<ant antfile="../memory/build.xml" target="build" inheritall="false"/>
<copy file="../memory/bin/memory.jar" todir="lib"/>
</target>
<target name="check-http">
<available property="http-exists" file="../http/build.xml"/>
</target>
<target name="http" depends="check-http" if="http-exists">
<ant antfile="../http/build.xml" target="build" inheritall="false"/>
<copy file="../http/bin/http.jar" todir="lib"/>
</target>
<target name="check-create">
<uptodate property="create-required" targetfile="bin/${name}.jar">
<srcfiles file="res/${name}.xml"/>
<srcfiles file="lib/memory.jar"/>
</uptodate>
</target>
<target name="create" depends="check-create" unless="create-required">
<delete dir="src/se/rupy/memory" quiet="yes"/>
<java fork="yes" classname="se.rupy.memory.Origin" classpath="lib/memory.jar">
<arg line="${db}"/>
<arg line="res/${name}.xml"/>
<arg line="."/>
<arg line="se.rupy.memory"/>
</java>
<!--ant target="flush"/-->
</target>
<target name="check">
<uptodate property="required" targetfile="bin/${name}.jar">
<srcfiles dir="src" includes="**/*.java"/>
<srcfiles dir="res/jar" includes="**/*.*"/>
<srcfiles file="lib/page.jar"/>
</uptodate>
</target>
<target name="build" depends="page, util, memory, http, create, check" unless="required">
<echo>Building (${name})</echo>
<mkdir dir="bin"/>
<javac srcdir="src" target="1.6" source="1.6" destdir="bin" nowarn="on" debug="on" deprecation="off" classpath="src;${lib}" encoding="UTF-8"/>
<mkdir dir="tmp"/>
<copy todir="tmp">
<fileset dir="bin" includes="**/*.class"/>
</copy>
<java classname="Page" classpath="${lib}">
<arg line="bin/${name}.jar"/>
<arg line="res/jar"/>
</java>
<javac srcdir="res/jar" target="1.6" source="1.6" destdir="res/jar" nowarn="on" debug="on" deprecation="off" classpath="${lib};bin"/>
<copy todir="tmp">
<fileset dir="res/jar"/>
</copy>
<jar jarfile="bin/${name}.jar">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
</manifest>
<fileset dir="tmp"/>
</jar>
<delete dir="tmp" quiet="yes"/>
</target>
<target name="delete">
<delete dir="bin" quiet="no"/>
<delete dir="res/jar/gen" quiet="no"/>
</target>
<target name="clean" depends="delete, build"/>
<target name="deploy" depends="build">
<java fork="yes" classname="se.rupy.http.Deploy" classpath="${lib}">
<arg line="localhost:${port}"/>
<arg line="bin/${name}.jar"/>
<arg line="${pass}"/>
</java>
</target>
<target name="test" depends="build">
<java fork="yes" classname="se.rupy.sprout.User" classpath="bin/${name}.jar:${lib}"/>
</target>
<!-- requires manual flush on unix -->
<target name="flush" unless="unix">
<exec executable="${db}">
<arg line='-u root -D ${name} -e "source create.sql"'/>
</exec>
<exec executable="${db}">
<arg line='-u root -D ${name} -e "source alter.sql"'/>
</exec>
</target>
<target name="doc">
<javadoc access="public" sourcepath="src" destdir="doc" stylesheetfile="sheet.css"/>
</target>
</project>