OSDN Git Service

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