OSDN Git Service

Add logic to display stacks in notebook tree
[neighbornote/NeighborNote.git] / build.xml
1 <?xml version='1.0' encoding='utf-8'?>
2 <project default="jar" basedir=".">
3   <!-- program name -->
4   <property name="project.name" value="nevernote"/>
5   <property name="application.name" value="sandbox"/>
6
7   <!-- targeted QtJambi library version  -->
8   <property name="qtjambi.ver" value="4.6.3"/>
9
10   <!-- project directory hierarchy -->
11   <property name="src.dir" value="src"/>
12   <property name="classes.dir" value="build"/>
13   <property name="dist.dir" value="dist"/>
14   <property name="lib.dir" value="lib"/>
15   <property name="bin.dir" value="bin"/>
16   <property name="doc.dir" value="doc"/>
17   <property name="tr.dir" value="translations"/>
18
19   <!-- needed for running -->
20   <property name="db.dir" value="db"/>
21   <property name="logs.dir" value="logs"/>
22
23   <!-- debug -->
24   <property name="javac.debug" value="true"/>
25
26   <!-- run parameter -->
27   <!-- heap -->
28   <property name="jvm.xms" value="256M"/><!-- initial memory size -->
29   <property name="jvm.xmm" value="512M"/><!-- maximum memory size -->
30   <property name="jvm.newratio" value="2"/>
31   <property name="jvm.gcs" value="incgc"/><!-- GC strategy -->
32
33   <!-- product jar file -->
34   <property name="jar.name" value="nevernote.jar"/>
35
36   <!-- product exec command -->
37   <property name="shell.command" value="nevernote.sh"/>
38   <property name="bat.command" value="nevernote.bat"/>
39
40   <!-- qt utils -->
41   <property name="linguist.update" value="lupdate"/>
42   <property name="linguist.release" value="lrelease"/>
43
44   <!-- translations -->
45   <property name="linguist.project" value="nevernote.pro"/>
46
47   <!-- documents -->
48   <property name="doc.changelog" value="changelog.txt"/>
49   <property name="doc.release" value="release.txt"/>
50   <property name="doc.readme" value="README.txt"/>
51
52   <!-- check os -->
53   <condition property="isWindows">
54       <os family="windows" />
55   </condition>
56   <condition property="isLinux">
57       <os name="Linux" arch="i386" />
58   </condition>
59   <condition property="isLinux64">
60       <os name="Linux" arch="amd64" />
61   </condition>
62   <condition property="isMacOSX">
63       <os name="Mac OS X" />
64   </condition>
65
66   <!-- flexible looking for qtjambi library path -->
67   <target name="set-jambi-path32" depends="set-jambi-path" unless="qtlib.dir">
68       <available file="../qtjambi-linux32-lgpl-${qtjambi.ver}"
69                  property="qtlib.dir" value="../qtjambi-linux32-lgpl-${qtjambi.ver}"/>
70       <available file="../qtjambi-linux32-community-${qtjambi.ver}"
71                  property="qtlib.dir" value="../qtjambi-linux32-community-${qtjambi.ver}"/>
72   </target>
73   <target name="set-jambi-path64" depends="set-jambi-path" unless="qtlib.dir">
74       <available file="../qtjambi-linux64-lgpl-${qtjambi.ver}"
75                  property="qtlib.dir" value="../qtjambi-linux64-lgpl-${qtjambi.ver}"/>
76       <available file="../qtjambi-linux64-community-${qtjambi.ver}"
77                  property="qtlib.dir" value="../qtjambi-linux64-community-${qtjambi.ver}"/>
78   </target>
79   <target name="set-jambi-pathmac" depends="set-jambi-path" unless="qtlib.dir">
80       <available file="../qtjambi-macosx-lgpl-${qtjambi.ver}"
81                  property="qtlib.dir" value="../qtjambi-macosx-lgpl-${qtjambi.ver}"/>
82       <available file="../qtjambi-macosx-community-${qtjambi.ver}"
83                  property="qtlib.dir" value="../qtjambi-macosx-community-${qtjambi.ver}"/>
84   </target>
85   <target name="set-jambi-path" unless="qtlib.dir">
86       <available file="${user.home}/lib/qtjambi/qtjambi-${qtjambi.ver}.jar" 
87                  property="qtlib.dir" value="${user.home}/lib/qtjambi"/>
88       <available file="${user.home}/lib/qtjambi-${qtjambi.ver}.jar" 
89                  property="qtlib.dir" value="${user.home}/lib"/>
90       <available file="lib/qtjambi-${qtjambi.ver}.jar"
91                  property="qtlib.dir" value="lib"/>
92   </target>
93
94   <!-- os dependent library path and lib file -->
95   <target name="check_syslib_path" depends="lib-if_windows, lib-if_linux, lib-if_linux64"/>
96
97   <target name="lib-if_windows" if="isWindows">
98       <property name="system.lib.dir" value="D:/NeverNote/lib"/>
99       <property name="qtlib.dir" value="D:/qtjambi-${qtjambi.ver}"/>
100       <property name="qtjambi-platform" value="win32-msvc2005"/>
101   </target>
102
103   <target name="lib-if_linux" depends="set-jambi-path32" if="isLinux">
104       <property name="system.lib.dir" value="/usr/share/java"/>
105       <property name="qtjambi.platform" value="linux32-gcc"/>
106       <echo message="use qtjambi library at ${qtlib.dir}"/>
107   </target>
108   <target name="lib-if_linux64" depends="set-jambi-path64" if="isLinux64">
109       <property name="system.lib.dir" value="/usr/share/java"/>
110       <property name="qtjambi.platform" value="linux64-gcc"/>
111       <echo message="use qtjambi library at ${qtlib.dir}"/>
112   </target>
113   <target name="lib-if_macosx" depends="set-jambi-pathmac" if="isMacOSX">
114       <property name="system.lib.dir" value="/Library/Java/Extensions"/>
115       <property name="qtjambi.platform" value="macosx-gcc"/>
116       <echo message="use qtjambi library at ${qtlib.dir}"/>
117   </target>
118
119   <!-- compiler classpath -->
120   <target name="set_classpath" depends="check_syslib_path">
121     <path id="java.classpath">
122       <!-- bundled library -->
123       <pathelement location="${lib.dir}/evernote.jar"/>
124       <pathelement location="${lib.dir}/libthrift.jar"/>
125       <pathelement location="${lib.dir}/PDFRenderer.jar"/>
126       <pathelement location="${lib.dir}/log4j-1.2.14.jar"/>
127       <pathelement location="${lib.dir}/h2-1.2.136.jar"/>
128       <pathelement location="${lib.dir}/commons-lang-2.4.jar"/>
129       <pathelement location="${lib.dir}/jtidy-r938.jar"/>
130       <!-- dependent library -->
131       <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.ver}.jar"/>
132       <pathelement location="${qtlib.dir}/qtjambi-${qtjambi.platform}-${qtjambi.ver}.jar"/>
133       <pathelement location="${qtlib.dir}/qtjambi-util-${qtjambi.ver}.jar"/>
134     </path>
135   </target>
136
137   <target name="init" depends="set_classpath">
138     <tstamp/>
139     <mkdir dir="${classes.dir}"/>
140   </target>
141
142   <!-- translate -->
143   <target name="update-tr" depends="update-tr-if_linux, update-tr-if_linux64, update-tr-if_windows"/>
144   <target name="update-tr-if_windows" depends="init" if="isWindows">
145     <exec dir="." executable="cmd" os="Windows NT">
146         <arg line="/c ${bin.dir}\${linguist.update} ${linguist.project}"/>
147     </exec>
148   </target>
149   <target name="update-tr-if_linux" depends="init" if="isLinux">
150     <exec executable="${linguist.update}">
151         <arg line="${linguist.project}"/>
152     </exec>
153   </target>
154   <target name="update-tr-if_linux64" depends="init" if="isLinux64">
155     <exec executable="${linguist.update}">
156         <arg line="${linguist.project}"/>
157     </exec>
158   </target>
159
160   <target name="release-tr" depends="release-tr-if_linux, release-tr-if_linux64, release-tr-if_windows"/>
161   <target name="release-tr-if_windows" depends="init" if="isWindows">
162     <exec dir="." executable="cmd" os="Windows NT">
163         <arg line="/c ${bin.dir}\${linguist.release} ${linguist.project}"/>
164     </exec>
165   </target>
166   <target name="release-tr-if_linux" depends="init" if="isLinux">
167     <exec executable="${linguist.release}">
168         <arg line="${linguist.project}"/>
169     </exec>
170   </target>
171   <target name="release-tr-if_linux64" depends="init" if="isLinux64">
172     <exec executable="${linguist.release}">
173         <arg line="${linguist.project}"/>
174     </exec>
175   </target>
176
177   <!-- build -->
178   <target name="compile" depends="init">
179     <javac srcdir="${src.dir}"
180        destdir="${classes.dir}"
181        debug="${javac.debug}">
182        <classpath refid="java.classpath"/>
183     </javac>
184   </target>
185
186   <target name="resources" depends="init,release-tr">
187       <mkdir dir="${classes.dir}/cx/fbn/nevernote/icons"/>
188       <copy todir="${classes.dir}/cx/fbn/nevernote/icons">
189           <fileset dir="${src.dir}/cx/fbn/nevernote/icons"/>
190       </copy>
191       <copy file="${src.dir}/com/swabunga/spell/engine/configuration.properties"
192             todir="${classes.dir}/com/swabunga/spell/engine/"/>
193       <mkdir dir="${classes.dir}/translations"/>
194       <copy todir="${classes.dir}/translations">
195           <fileset file="translations/*.qm"/>
196       </copy>
197   </target>
198
199   <target name="jar" depends="compile,resources,release-tr">
200     <jar destfile="${jar.name}" basedir="${classes.dir}"/>
201   </target>
202
203   <!-- make distribution -->
204   <target name="dist-init" depends="init">
205     <mkdir dir="${dist.dir}"/>
206     <mkdir dir="${dist.dir}/lib"/>
207     <mkdir dir="${dist.dir}/bin"/>
208     <mkdir dir="${dist.dir}/doc"/>
209     <mkdir dir="${dist.dir}/db"/>
210     <mkdir dir="${dist.dir}/logs"/>
211   </target>
212
213   <target name="dist" depends="jar, dist-init">
214      <copy file="${bin.dir}/${shell.command}" todir="${dist.dir}/bin"/>
215      <copy file="${bin.dir}/${bat.command}" todir="${dist.dir}/bin"/>
216      <copy todir="${dist.dir}/lib">
217        <fileset file="${jar.name}"/>
218        <fileset dir="${lib.dir}"/>
219      </copy>
220      <copy todir="${dist.dir}/doc">
221        <fileset file="${doc.changelog}"/>
222        <fileset file="${doc.release}"/>
223        <fileset file="${doc.readme}"/>
224        <fileset dir="${doc.dir}"/>
225      </copy>
226      <exec dir="dist" executable="tar">
227          <arg line="czf ../../nevernote-bin.tar.gz ."/>
228      </exec>
229   </target>
230
231   <!-- test run -->
232   <target name="run-init" depends="init, resources, jar">
233     <tstamp/>
234     <mkdir dir="${logs.dir}"/>
235     <mkdir dir="${db.dir}"/>
236     <mkdir dir="res"/>
237   </target>
238
239   <target name="run" depends="run-init">
240     <java classname="cx.fbn.nevernote.NeverNote"
241       fork="yes" maxmemory="${jvm.xmm}"
242       classpathref="java.classpath" classpath="${jar.name}">
243       <jvmarg value="-XX:NewRatio=${jvm.newratio}"/>
244       <jvmarg value="-X${jvm.gcs}"/>
245       <arg value="--name=${application.name}"/>
246     </java>
247   </target>
248
249   <!-- script test run -->
250   <target name="run-script" depends="run-if_windows, run-if_linux, run-if_linux64"
251    description="run starter script">
252   </target>
253
254   <target name="run-if_windows" depends="run-init" if="isWindows">
255     <exec dir="." executable="cmd" os="Windows NT">
256         <arg line="/c ${bin.dir}\${batch.command}"/>
257     </exec>
258   </target>
259   <target name="run-if_linux" depends="run-init" if="isLinux">
260     <exec executable="${bin.dir}/${shell.command}"/>
261   </target>
262   <target name="run-if_linux64" depends="run-init" if="isLinux64">
263     <exec executable="${bin.dir}/${shell.command}"/>
264   </target>
265
266   <!-- clean up -->
267   <target name="clean"
268    description="clean up without classes and run env" >
269     <delete dir="${dist.dir}" />
270     <delete file="${jar.name}"/>
271   </target>
272
273   <target name="all-clean" depends="clean"
274    description="clean up all" >
275     <delete dir="${classes.dir}" />
276     <delete dir="${logs.dir}" />
277     <delete dir="${db.dir}" />
278     <delete file="secure.txt"/>
279     <delete>
280           <fileset file="${tr.dir}/*.qm"/>
281           <fileset file="${tr.dir}/*.po"/>
282     </delete>
283     <delete dir="res"/>
284   </target>
285
286 </project>